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

Quiz1 (OOP) Time: 30 Minute Max Marks:10

This document contains a quiz with 14 multiple choice questions related to object-oriented programming concepts in Java. The questions cover topics such as classes, subclasses, keywords, variables, packages, arrays and their default values.

Uploaded by

Jalaj Gupta
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)
73 views2 pages

Quiz1 (OOP) Time: 30 Minute Max Marks:10

This document contains a quiz with 14 multiple choice questions related to object-oriented programming concepts in Java. The questions cover topics such as classes, subclasses, keywords, variables, packages, arrays and their default values.

Uploaded by

Jalaj Gupta
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/ 2

Quiz1(OOP)

Time: 30 Minute Max Marks:10

Q1. Which class cannot be a subclass in java


A. abstract class B. parent class C. Final class D. None of above

Q2. String is the predefined


A. Method B. Class C. Variable D. Object

Q3. super is the predefined


A. Keyword B. Method C. Keyword and Method D. None of above

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

Q7. Which method can't be overidden


A. super B. static C. final D. println

Q8.Which of the following statements is true?


A. A static variable cannot be initialized in a constructor
B. A static variable must be declared final
C. An instance variable can't be declared final
D. A static method can't access an instance variable
E. Only a static method can access a static variable

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

10.What is the return type of Constructors?


A) int B) float C) void D) None of the mentioned

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

13. Which of the following is incorrect statement about packages?


A. Package defines a namespace in which classes are stored.
B. A package can contain other package within it.
C. Java uses file system directories to store packages.
D. A package can be renamed without renaming the directory in which the classes are stored.

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

You might also like