0% found this document useful (0 votes)
39 views2 pages

Computer Applications (Test) Class X 24-25-1

Uploaded by

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

Computer Applications (Test) Class X 24-25-1

Uploaded by

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

Computer Applications (Class X) x) This access specifier can be accessed only by the

Section – A (40 marks) subclass in other package or any class within the same
Question 1. Choose the correct answers to the package.
questions from the given options. [20] a) protected b) private c) public d) default
i) The output of the statement xi) Assertion (A) Class initialisation is the explicit
"CONCENTRATION".indexOf('T') is initialisation of class fields to values.
a) 9 b) 7 c) 6 d) -1 Reason (R) Each class field explicitly initialises to a
ii) The number of bytes occupied by a character array value via a class field initialiser.
of four rows and three columns are a) Both Assertion and Reason are true, and Reason is a
a) 12 b) 24 c) 96 d) 48 correct explanation of Assertion.
iii) If the name of the class is "Yellow", what can be b) Both Assertion and Reason are true, and Reason is
the possible name for its constructors? not a correct explanation of Assertion.
a) yellow b) YELLOW c) Assertion is true, and Reason is false.
c) Yell d) Yellow d) Assertion is false, and Reason (R) is true.
iv) Invoking a method by passing the objects of a class xii) Read the following text and choose the correct
is termed as answer:
a) call by reference b) call by value Java constructor overloading is a technique in which a
c) call by method d) call by constructor class can have any number of constructors that differ
v) The parameters that are passed to the method in parameter list. The compiler differentiates these
when it is invoked are called constructors by taking into account the number of
a) formal parameters b) actual parameters parameters in the list and their type.
c) informal parameters d) void parameters Why do we use constructor overloading?
vi) What will be the output of the following code? a) To use different types of constructors.
String a[] = {"MI", "Samsung", "Micromax", "One b) Because it's a feature provided.
Plus"}; c) To initialise the object in different ways.
System.out.println(a[3].length()); d) To differentiate one constructor from another.
a) 8 b) 7 c) 5 d) 9 xiii) String is ............... in Java.
vii) Polymorphism is broadly used in implementing. a) interface b) mutable
a) inheritance b) encapsulation c) method d) immutable
c) abstraction d) literals xiv) Which of the following statement is true for
viii) Give the output of the following logical errors?
switch (x) a) The compiler does not detect these errors.
{ b) There is no indication of error when the program is
case 'M': System.out.print ("Microsoft Teams"); executed.
break; c) The program may produce correct results for some
case 'G': System.out.print ("Google Meet"); input data and wrong results for other input data.
default: System.out.print("Any Software"); d) All of the above.
break; xv) This variable can be accessed by calling with the
case 'W': System.out.print("Web Ex"); class name.
break; a) Instance b) Local
} c) Class d) None of these
when x = 'g' xvi) If int arr [] = new int[0];
a) Google Meet b) Any Software How many bytes will be occupied by array?
c) Google Meet d) Web Ex a) 0 bytes b) 2 bytes
Any Software c) 4 bytes d) Error, size cannot be zero
ix) Assume x = 1 with the following code snippet: xvii) Assertion (A) Method should be called explicitly
x=x−−; either with object reference or class reference.
Which one of the following is true? Reason (R) Method can be any user defined name.
a) x = 1 b) x = 0 c) x = -1 d) x = 2 a) Both Assertion and Reason are true, and Reason is a
correct explanation of Assertion.
b) Both Assertion and Reason are true, and Reason is while(n!=0)
not a correct explanation of Assertion. { if(n%10!=0)
c) Assertion is true, and Reason is false. {
d) Assertion is false, and Reason is true. S=S+(n%10+(int)(Math.pow(10,C));
xviii) Which of the following is the correct way to C++;
declare an integer matrix of order 3x4? }
a) int[ ] a[ ]=new int[3][4]; n/=10;
b) int a[3][4]; }
c) int a[ ][ ]=new [3]int[4]; System.out.println(S);
d) int a[ ][ ]=new int[3](4); vi) What is the output of the following Java program
xix) What is the value returned by function when method main() is executed? [2]
compareTo( ), if the invoking string is less than the public class Constructor {
string compared? Contructor(int a) {
a) zero System.out.println("Book = "+a);
b) value less than zero }
c) value greater than zero Contructor(float a) {
d) None of the above System.out.println("Pen = "+a);
xx) }
public static void main(){
Constructor con =new Constructor(50.5f);
}}
vii) int[ ] A={2,4,6,8}; [2]
int[ ] B= {2,4,6,8};
if(A==B)
Name the above structure:
System.out.println("Arrays are equal");
a) One dimensional array
else
b) Two-Dimensional array with 4 rows and 5 columns
System.out.println("Array A is NOT equal to array B");
c) Three-dimensional array
What will be the output of the above code?
d) Two-Dimensional array with 5 rows and 4 columns
viii) What will be the output of the following program
Question 2.
snippet? [2]
i) How many times will the following loop execute?
String str= "Lucknow"; int m=100, n=200;
Write the output of the code: [2]
String result=m+n+str;
∫ x=10 ; System.out.println(result);
while (true){ ix) double sum (int x, int y) { [2]
System . out . println ( x++ ¿ 2 ) ; return (double) (x + y);
if (x % 3=¿ 0) }
break ; void printSum(int a, int b) {
} int x = sum(a + b);
ii) What two advantages of using functions in a System.out.println(x);
program. [2] }
iii) What will be the output of the following code? Re-write the code for method printSum( ) after
int k=5, j=9; [2] correcting the error(s) present in it.
k + ¿ k ++−++ j+ k +++− j; x) Write the output of the following program snippet:
System.out.println("K = "+k); String str = "EXPLANATIONS"; [2]
System.out.println("J = "+j); System.out.println(str.substring(5, 11 ).index Oft' A'));
iv) Write an expression in Java for [2]
10
5 x +2 y
z=
x+ y
v) Write the output of the following program if the
value of n is 508075. [2]
Int S=0, C=0;

You might also like