0% found this document useful (0 votes)
151 views6 pages

Mock Test 1 2024-25

Uploaded by

happpiii2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
151 views6 pages

Mock Test 1 2024-25

Uploaded by

happpiii2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

CALL: 7003064812 / 9007466531 / 9038770877

SHREYAN NAG COMPUTER CLASSES


MOCK TEST 1
SESSION: 2024-25
COMPUTER APPLICATION
CLASS – 10
Maximum Marks: 100
Time allowed: 2 hours

This paper is divided into two Sections.


Attempt all questions from Section A and any four Questions from Section B.
SECTION A (Attempt all questions from this Section.)
Question 1 [20]
Choose the correct answer and write.

(i) Name the feature of java depicted in the below picture.


(a) Encapsulation (b) Inheritance (c) Abstraction (d) Polymorphism

(ii) Polymorphism is implemented by using


(a) Function overriding
(b) Function prototype
(c) Function overloading
(d) Constructor

(iii) Multiple branching statement in java is:


(a) switch
(b) while
(c) for
(d) if-else

Page 1 of 6
CALL: 7003064812 / 9007466531 / 9038770877
(iv) Find the output of the following code:
int s=14;
if(s>20)
System.out.print(“AB”+((char)(s+64;));
else
System.out.print(“BB”+((char)s+96);
System.out.print(“ CC”);
(a) ABC BBN CC
(b) AB BBn CC
(c) BbNCc
(d) BBnCC

(v) Which of the following is not a keyword?

(a) public
(b) static
(c) main
(d) void

(vi) Choose the odd one out from the following:


(a) =
(b) !
(c) &&
(d) ||

(vii) What will be the output of the expression given below:


If a=14; then b= (++a * (a++ + 5)).

(a) 120
(b) 625
(c) 300
(d) 230

(viii) double x= Math.pow(“COMET”.indexOf(‘M’),3) +


“PAPER”.compareTo(“PEN”);
What will be the final value stored in the variable x?
(a) 11.0
(b) 7.0
(c) 8.0
(d) 10.0

(ix) The correct ascending order precedence of operator is:


(a) + , ++, < , ?=
(b) ++, + , <, ?=
(c) ?=, + , < , ++

Page 1 of 6
CALL: 7003064812 / 9007466531 / 9038770877
(d) ++,?=,<,+

(x) The number of bytes occupied by the constant true is:


(a) 8 bytes
(b) 1 bytes
(c) 1 bit
(d) 16 bits

(xi) int i=1;


while(i<=10)
{
if(i%2==0)
{
continue;
}
System.out.print(i+“ ”);
i=i+1;
}
What will be the output of the following code?
(a) 1 2 3 4 5 6 7 8 9 10
(b) 2 4 6 8 10
(c) 1 3 5 7 9
(d) infinite loop

(xii) Assertion (A): Functions in programming help in modularizing code for better
organization.
Reason (R): Functions allow code reusability by encapsulating a set of
instructions that can be used multiple times.

(a) Both Assertion (A) and Reason (R) are true and Reason (R) is a correct
explanation of Assertion (A)
(b) Both Assertion (A) and Reason (R) are true and Reason (R) is not a correct
explanation of Assertion (A)
(c) Assertion (A) is false and Reason (R) is true
(d) Assertion (A) is true and Reason (R) is false

(xiii) Read the following text, and choose the correct answer: The actual parameter is
copied to the formal parameter in such a way that any change made in the formal
parameter does not affect the actual parameter.
Which of the following options discusses the above mentioned statement?
(a) call by reference
(b)call by value
(c) Methods
(d) constructors

(xiv) If a string contains p characters, then what will be the middle index?
(a) p.length()/2-1
(b) p.length()-1
(c) p.length()/2
(d) 0

Page 2 of 6
CALL: 7003064812 / 9007466531 / 9038770877
(xv) Assertion(A): An array is used to store multiple values of different data types
under the same variable name.
Reason(R): An array is an example for reference datatype.

(a) Both Assertion (A) and Reason (R) are true and Reason (R) is a correct
explanation of Assertion (A)
(b) Both Assertion (A) and Reason (R) are true and Reason (R) is not a correct
explanation of Assertion (A)
(c) Assertion (A) is true and Reason (R) is false
(d) Assertion (A) is false and Reason (R) is true

(xvi) What will be the output of the following method


“KEYBOARD”.substring(3,8).compareTo(“KEYBOARD”.substring(5));
(a) 2
(b) 1
(c) 3
(d) 4

(xvii) The array char a[20] occupies :


(a) 64 bits
(b) 320 bits
(c) 20 bits
(d) 1280 bits

(xviii) What will be the output:


String x[]={“AA”, “BB”, “CC”, “DD”, “EE”, “FF”}
System.out.println(x[x.length/2].compareTo(x[2]));
(a) 3
(b) 12
(c) 9
(d) 6

(xix) Which of the following packages contain Math functions?


(a) java.lang
(b) java.String
(c) java.awt
(d) java.math

(xx) Predict the output [show the dry run/working]


String m = “SUS”;
int a=0,i=0;
while(i<m.length())
{
a+=(int)m.charAt(i++);
}
System.out.println(“a= “+a+”\ni= “+i);

Question 2
(i) What will be the output of the given code: [2]

Page 3 of 6
CALL: 7003064812 / 9007466531 / 9038770877
String str= “ALPHA”
System.out.println(str.charAt(0)*str.charAt(str.length()-1));

(ii) Solve the given expression: [2]


int a=, b=10;
z = a++ * ++b - ++a /++b

(iii) The following code segment should print the absolute of num. However, the [2]
code has errors. Fix the code so that it compiles and runs correctly.
public class Type {
public int getDouble(double num)
{
Double Value = Math.cbrt(8);
System.out.println(Value);
}
public static void main(String[] args) {
System.out.println("Absolute of number = " + getDouble(5));
}
}

(iv) Name the data type and the value returned by the following functions. [2]
a. Math.sqrt(16)
b. “COMIC”.compareTo(“COMET”);

(v) Given array A[][] = { {“BABA”, “DAD”, “MAA”},{“90”, “95”, “65”} }; [2]
System.out.println(A[0][1].length() * Integer.parseInt(A[1][1]));
System.out.println(A.length * Integer.parseInt(A[1][0]));

(vi) Give the output of the following method definition: [2]


void test(char c)
{
System.out.println((char)(c+10));
}
If ‘e’ is passed to c.

(vii) Write a function prototype for the function binary() which accepts two String [2]
and one double values and returns character.

(viii) Name the methods [2]


a. To find the size of the array.
b. To extract parts from a string.

(ix) What will be the ouput of the following statements: [2]


int des[]={5,8,3,1,0,3,5}
des[3]=des[5];
System.out.println((char)(des.length+64));
System.out.println(“=”+(char)(des[5]+64)+(char)(des[5]+96));

(x) String s[]={“Cyber”,“Punk”,“Far”,“Cry”,“Wukong”}; [2]


a. Write java statement to display the elements that starts with even ascii
character.
b. Write the output: s[3].substring(1).compareToIgnoreCase(s[0].substring(2));

SECTION B(60 MARKS)


Attempt any four questions from this Section.

Page 2 of 6
CALL: 7003064812 / 9007466531 / 9038770877
The answers in this Section should consist of the Programs in either BlueJ environment
or any program environment with Java as the base.

Q.3 Design a class to accept integers in a matrix (double dimensional) of 3x3 Display [15]
the sum of the left and right diagonal also display the product of the boundary
elements.

Q.4 Write a program to accept 10 characters in an array. Sort the array in descending [15]
order using bubblesort algorithm. Then display the array.

Q.5 Write a program to overload a function display() as per the details given below: [15]
(a) void display (String st, Char ch) – to display all vowels in the string if ch
is ‘v’ else display all the characters.
(b) void display (String s1, String s2) – to find the larger word by
comparing alphabet wise.
(c) void display (int n) – to check whether the prime factors of the number
n.

Q.6 Design a class to accept 10 words in an array and arrange them in descending [15]
order using the selection sort technique. Display the sorted array. Then accept a
word from the user and find the position of the word using binary search.

Q.7 Write a program to accept a number. Display the digits of the numbers in [15]
ascending order. Then display the appropriate alphabet based on the position.
Example Input: Enter a number: 3421
Example Output: Ascending order: 1234
Characters:
1 -> A
2 -> B
3 -> C
4 -> D

Q.8 Design a class to overload a function show() as follows [15]


void show(): to print the following pattern
A
BC
DEF
GHIJ
void show(int p): To print the odds digits present in the given number Example:
p=754329
Output: 9,3,5,7

void show(String s): to print the following pattern


S
SN
SNC
SNCC
If the string s=SNCC
Write a main method, create object and call the above function

Page 3 of 6

You might also like