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

Class 10 ICSE Practice Paper 2

This document is a practice paper for Class 10 students containing multiple-choice questions (MCQs) related to Java programming concepts. The questions cover various topics such as output of code snippets, method overloading, switch statements, and operator precedence. Each question provides multiple answer options for students to choose from.

Uploaded by

Rituraj Pradhan
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)
17 views6 pages

Class 10 ICSE Practice Paper 2

This document is a practice paper for Class 10 students containing multiple-choice questions (MCQs) related to Java programming concepts. The questions cover various topics such as output of code snippets, method overloading, switch statements, and operator precedence. Each question provides multiple answer options for students to choose from.

Uploaded by

Rituraj Pradhan
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

CLASS 10 MCQ PRACTICE PAPER - 2

1) System.out.println(“a”+0+’A’);
1) a0A b) a065 c) a65 d) a4564

2) System.out.println(“B”+”a”);
System.out.println(‘B’+’a’);
a) Ba b) Ba c) Ba d) 163
Ba 6697 163 Ba

3) System.out.println(‘A’+’1’+“B”);
a) A1B b) A49B c) 651B d) 114B

4) System.out.print(‘A’+’1’);
a) A1 b) 651 c) 6549 d) 114

5) System.out.println(‘B’+9+’z’);
a) B9z b) 669122 c) 245 d) 197

6) System.out.println(“ADD”+(‘A’+’B’));
a) ADDAB b) ADD6566 c) ADD131 d) ADDA+B

7) String n=”210”;
n=n+’A’;
System.out.println(n);
System.out.println(Integer.parseInt(n)+20));
a) 210A b) 210A c) 21065 d) 210A
21020 230 230 Error

8) String n=”210”, m=”302”;


int n = Integer.parseInt(n)+Integer.parseInt(m);
System.out.println(n);
a) 210302 b) 512 c) 210+302 d) Error

9) double d=35.45, e=25.55;


System.out.println(String.valueOf(d)+String.valueOf(e));
a) 35.4525.55 b) 61.00 c) 65.45+25.55 d) Error

10) double d=45.35, e=15.55;


System.out.println(Double.toString(d)+Double.toString(e));
a) 45.3515.55 b) 60.90 c) 45.35+15.55 d) Error

11) int a=100,b=200;


System.out.println("ADD"+a+b);
a)ADD100200 b) ADD300 c) ADD100+200 d) Error

12) int a=400,b=500;


System.out.println("ADD"+(a+b));
a)ADD400500 b) ADD400+500 c) ADD900 d) Error

13) int a=600,b=500;


System.out.println("ADD"+a-b);
a)ADD600-500 b) ADD100 c) ADD600500 d) Error

14) int a=600,b=500;


System.out.println("ADD"+(a-b));
a)ADD600-500 b) ADD100 c) ADD600500 d) Error
15) Which one of the types cannot be used as a switch variable?
a) char b) byte c) int d) float

16) Which operation will be performed first in the given expression: ++x / b+c * d % e
a) ++ b) + c) * d) %

17) Arrange the following in ascending order of precedence: + , != , || , % , ++


a) ++ , % , + , !=, || b) ++ , % , + , ||, !=, c) % ,++ , + , !=, || d) ++ ,, + , %, !=, ||

18) In the following program segment what are x and y?


void main()
{
int x=10, y=15;
display(x,y);
}
a) actual parameter b) formal parameter c) local parameter d) none of them

19) An identifier in Java can begin with:


a) digit b) space c) letter d) any symbol

20) Pick the odd one out:


a) method b) block of code in {} c) function d) package

21) The method that does not modify its parameters:


a) virtual function b) pure function c) impure function d) accessor function

22) Which of the methods will be called by reference?


a) void Sample(int a) b) void Sample(int a[]) c) void Sample(char d) d) void Sample(float f)

23) Given the following method prototype: int Change(int p, int q);
The statement to call the method is:
a) Change(10,20); b) s = Change(10,20); c) Change(4.5,5.6); d)s=Change(4.5,5.5);

24) Function signature means:


a) list of arguments b) return type c) name of method d) return value

25) The prototype of a function Show(), that returns a float and takes two integer arguments is:
a) void Show(int a,int b) b) float Show(int a, int b) c) float Show(int a) d) static Show(int a,int b)

26) Fill in the blanks to import all the classes of the package “Education”,
import Education.____;
a) # b) all c) * d) **

27) What is the output produced by the following lines of program code?
char x,z;
int y;
x = 'A';
y = ++x;
z = (char)y;
System.out.println(x+"\t"+y+"\t"+z);
a) B 66 B b) A 66 B c) A 65 B d) Error

28) Write the output of the following statement:


System.out.println("A picture is worth \t \"A thousand words.\" ");
a) A picture is worth A thousand words.
b) A picture is worth “A thousand words.”
c) A picture is worth “A thousand words.”
d) “A picture is worth “A thousand words.””
29) for(a=0;a<5;a++)
System.out.print(a*a);
System.out.print(a);
a) 0 1 4 9 16 0 1 2 3 4 b) 0 0 1 1 4 2 9 3 16 4 c) 0 1 4 9 16 6 d) 0 1 4 9 16 5

30) if ( n > m)
System.out.print(“GOOD”);
System.out.print(“LUCK”);
else
System.out.print(“DONE”);
What will be the output if n=6 and m=4?
a) GOOD b) GOODLUCK c) DONE d) Error
31) System.out.println(Math.ceil(-9.4)+Math.sqrt(9.0));
a) 6.0 b) -6.0 c) -5.0 d) 5.0

32) Which of the following statements is not true about a static method?
a) It can be invoked without creating an object.
b) It can be called by a non-static method.
c) It can access instance variables directly.
d) It can access static variables directly.

33) To successfully overload a method in Java, the return types must be ___.
a) Same
b) Different
c) Same but using superclass or subclass types also work
d) None

34) What is the output of the below Java program with multiple methods?
public class MethodOverloading1
{
void show(int a, char b)
{
System.out.println("KING KONG");
}

void show(char a, int b)


{
System.out.println("JIM JAM");
}

public static void main(String[] args)


{
MethodOverloading1 m = new MethodOverloading1();
m.show(10, 'A');
m.show('B', 10);
}
}
a)
JIM JAM
JIM JAM
b)
KING KONG
KING KONG
c)
KING KONG
JIM JAM
d) compiler error

35) What is the output of the below Java program?


public class MethodOverloading2
{
int info()
{
System.out.println("PLANE");
return 0;
}
void info()
{
System.out.println("AIRPORT");
}
public static void main(String[] args)
{
MethodOverloading2 m = new MethodOverloading2();
int a = m.info();
}
}
a) PLANE
b) AIRPORT
c) Compiler error
d) None

36) A Java constructor is like a method without ___.


a) statements
b) return type
c) argument list
d) None

37) The placement of a constructor inside a class should be ___.


a) Always at the beginning of class
b) Always at the end of class
c) Anywhere in the class
d) None

38) The condition of an IF statement evaluates to boolean only if the expression contains?
a) logical operators
b) relational operators
c) boolean operands
d) All

39) If the condition of an IF-statement is false, which is true below.


a) IF block is executed.
b) ELSE block is executed.
c) Both IF and ELSE blocks are skipped.
d) Both IF and ELSE blocks are executed.

40) An IF-ELSE statement is better than a SWITCH statement in which scenario below?
a) Checking for More-than condition
b) Checking for Less-than condition
d) Checking for Ranges
d) All

41) What is the output of Java program with SWITCH?


int num=20;
switch(num)
{
case 10: System.out.println("TEN"); break;
case 20: System.out.println("TWENTY"); break;
case 30: System.out.println("THIRTY");
}
a) TEN
b) TWENTY
c) THIRTY
d) TEN TWENTY
42) What is the output of Java program below?
int num=40;
switch(num)
{
case 5: System.out.println("FIVE"); break;
case 35+5: System.out.println("FORTY"); break;
case 20+30: System.out.println("FIFTY");
}
a) FIVE
b) FORTY
c) FIFTY
d) Compiler error

43) What is the output of the below Java program with a SWITCH statement?
int points=6;
switch(points)
{
case 6: ;
case 7: System.out.println("PASS");break;
case 8: ;
case 9: System.out.println("Excellent");break;
case 10: System.out.println("Outstanding"); break;
default: System.out.println("FAIL");
}
a) PASS
b) Excellent
c) Outstanding
d) FAIL

44) Choose the correct statement about Java SWITCH statements.


a) A SWITCH can contain another SWITCH statement.
b) Switch case statements are allowed inside IF-ELSE ladders.
c) Switch statements are allowed inside Loops like for, while and do while.
d) All

45) What is the output of the below Java program?


int hours = 10;
switch(hours)
{
case 10: System.out.println("TEN");break;
case 10: System.out.println("TEN AGAIN"); break;
default: System.out.println("TEN AS USUAL");
}
a) TEN
b) TEN AGAIN
c) TEN AS USUAL
d) Compiler error

46) A java Ternary operator has priority less than ___.


a) Relational operators
b) Arithmetic operators
c) Logical and bitwise operators
d) All

47) What is the output of the Java code snippet with Ternary operator?
int num = false?10:20;
System.out.println(num);
A) 10
B) 20
C) 0
D) Compiler error

48) What are the types of data that can be used along with Relational operators in Java?
a) char, boolean, Object
b) byte, short, int, long
c) float, double
d) All the above

49) Choose the Conditional operators of Java listed below.


a) >, >=
b) <, <=
c) ==, !=
d) All the above

50) What is the output of Java code snippet?


int a=5, b=10;
if(++b>10||a++=5)
{
System.out.println("PIZZA="+a);
}
else
{
System.out.println("BURGER="+a);
}
a) PIZZA=5
b) PIZZA=6
c) BURGER=5
d) BURGER=6

You might also like