Class 10 MCQ Practice Paper
Class 10 MCQ Practice Paper
7) Which variables are created when an object is created with the use of the
keyword 'new' and destroyed when the object is destroyed?
A. Local variables
B. Instance variables
C. Class Variables
D. Static variables
Answer: _______________
11) Which of these is returned by Greater Than, Less Than and Equal To (i.e
Relational) operator ?
A. Float
B. Integer
C. Boolean
D. Double
Answer: _______________
12) Which statement transfer execution to different parts of your code based on
the value of an expression?
A. If
B. Switch
C. Nested-if
D. if-else-if
Answer: _______________
16) In Java code, the line that begins with /* and ends with */ is known as?
A. Multiline comment
B. Single line comment
C. Both A & B
D. None of these
Answer: _______________
23) Evaluate the following Java expression, if x=3, y=5, and z=10:
++z + y - y + z + x++
A. 24
B. 23
C. 20
D. 25
Answer: _______________
25) Given that Student is a class, how many reference variables and objects are
created by the following code?
Student studentName, studentId;
studentName = new Student();
Student stud_class = new Student();
A. Three reference variables and two objects are created.
B. Two reference variables and two objects are created.
C. One reference variable and two objects are created.
D. Three reference variables and three objects are created.
Answer: _______________
1)
A. Student()
B. Student
C. student
D. Student;
Answer: _______________
2)
A. Student
B. Student();
C. Student()
D. student();
Answer: _______________
3)
A. Void
B. void
C. int
D. float
Answer: _______________
4)
A. Math.max(m1,m2,m3);
B. Math.max(m1,Math.max(m2,m3));
C. Math.max(m1,Math.max(m2,m3));
D. Math.max(m1;m2;m3);
Answer: _______________
5)
A. obj.compute();
B. obj.compute;
C. obj.calculate();
D. Obj.compute();
Answer: _______________
32) Read the following program and answer the questions given below
class Method
{
double compute(int a, int b)
{
return (a+b)/2.0;
}
static void main()
{
Method ob=new Method():
_______A______;
}
}
Which of the following statements will correctly invoke the method compute() in
line ‘A’;
A. System.out.println(ob.compute(15));
B. ob.compute(15,19);
C. ob.compute();
D. System.out.println(ob.compute(15,19));
Answer: _______________
33) Which of the following statements is not the correct way to declare
overloaded methods.
A. void area(int x)
B. void area(float x)
C. int area(int x)
D. void area(double x)
Answer: _______________
35) Every loop in Java has a condition that should be ___ in order to proceed for
execution.
A. FALSE
B. TRUE
Answer: _______________
36) A WHILE loop in Java executes the statements at least once even the
condition is not satisfied.
A. FALSE
B. TRUE
Answer: _______________
38) What is the output of the below Java program with WHILE, BREAK and
CONTINUE?
int cnt=0;
while(true)
{
if(cnt > 4)
break;
if(cnt==0)
{
cnt++;
continue;
}
System.out.print(cnt + ",");
cnt++;
}
A. 0,1,2,3,4,
B. 1,2,3,4,
C. 1,2,3,4
D. Compiler error
Answer: _______________
39) What is the main difference between a WHILE and a DO-WHILE loop in Java?
A. WHILE loop executes the statements inside of it at least once even if the
condition is false.
B. DO-WHILE loop executes the statements inside of it at least once even if the
condition is false.
C. WHILE loop is fast.
D. DO-WHILE loop is fast.
Answer: _______________