Quiz1 (OOP) Time: 30 Minute Max Marks:10
Quiz1 (OOP) Time: 30 Minute Max Marks:10
Q4. Which method of java is invoked by JVM to reclaim the inaccessible memory location
A. reclaim() B. final() C. finalize() D. both b and c
Q6.Which keyword represents object of the present class
A. interface B. package C. this D. static
Q9. A class member declared protected becomes member of subclass of which type?
A) public member B) private member C) protected member D) static member
11. Which of these is used to access member of class before object of that class is created?
A) public B) private C) static D) protected
12. Which of these class relies upon its subclasses for complete implementation of its methods?
A) Object class B) abstract class C) Array class D) None of the mentioned
14. Which of the following package stores all the standard java classes?
A) lang B) java C) util D) java.packages
Q1.1 Q1.2 Which four options describe the correct default
switch(x) values for array elements of the types indicated?
{ 1. int -> 0
default: 2. String -> "null"
System.out.println("Hello"); 3. Dog -> null
} 4. char -> '\u0000'
Which are acceptable types for x? 5. float -> 0.0f
byte, long, char 6. boolean -> true
float, Short , Long
Q1.3 public void test(int x) Q1.4 public class While
{ {
int odd = 1; public void loop()
if(odd) {
{ int x= 0;
System.out.println("odd"); while ( 1 )
} {
else System.out.print("x plus one is " + (x + 1));
{ }
System.out.println("even"); }
} }
} Which statement is true?
Which statement is true? A. There is a syntax error on line 1.
A. Compilation fails. B. There are syntax errors on lines 1 and 6.
B. "odd" will always be output. C. There are syntax errors on lines 1, 6, and 8.
C. "even" will always be output. D. There is a syntax error on line 6.
D. "odd" will be output for odd values of x,
and "even" for even values.
Q1.5 Which one is a valid declaration of a Q1.6 Which three are valid declarations of a float?
boolean? float f1 = -343;
A. boolean b1 = 0; float f2 = 3.14;
B. boolean b2 = 'false'; float f3 = 0x12345;
C. boolean b3 = false; float f4 = 42e7;
D. boolean b4 = Boolean.false(); float f5 = 2001.0D;
E. boolean b5 = no; float f6 = 2.81F;
Q1.7 What is the numerical range of a char? Q1.8 Which is the default package in Java which
A. -128 to 127 B. -(215) to (215) - 1 automatically imported in every Java program?
C. 0 to 32767 D. 0 to 65535 Java.lang
Q1.9 JVM stands for Q1.10
A. Java Verified Machine JRE stands for
B. Java Virtual Machine A. Java Real Environment
C. Java Very large Machine B. Java Rapid Enterprise
D. Java Very small Machine C. Java Runtime Environment
D. None of the above