Java Multiple Choice Questions [Solved PDF] – 8

1. Using which keyword we can access value of the instance variables and class variables of that class inside the method of that class itself.
A) super
B) final
C) this
D) either super or this

2. If a variable is declared final, it must include …………………. value.

A) integer
B) no
C) initial
D) float

3. State true or false.
i) Jpanel is a class included in awt package.
ii) Anonymous classes are mostly used for event handling.
iii) Names of anonymous classes must be unique
iv) JOptionPane is an inner class

A) i-false, ii-false, iii-true, iv-true
B) i-true, ii-false, iii-true, iv-false
C) i-false, ii-true, iii-false, iv-false
D) i-true, ii-false, iii-false, iv-true

4. In java, string is a ………….
A) primitive data type
B) abstract data type
C) combination of boolean
D) None of the above

5. Methods can be overloaded with a difference only in the type of the return value ..
A) Not supported
B) False
C) True
D) None of the above

6. Each method in a java class must have a unique name .
A) Not necessary
B) True
C) False
D) None of the above

7. State true or false.
i) comparisons precede logical operations in java
ii) assignment operations succeed increment operations
iii) arithmetic operations succeed comparisons
iv) x precede +

A) i-true, ii-true, iii-false, iv-true
B) i-true, ii-false, iii-true, iv-false
C) i-false, ii-true, iii-false, iv-false
D) i-true, ii-false, iii-false, iv-true

8. It is important feature of java that it always provides a default constructor to a class.
A) Not supported
B) False
C) True
D) None of the above

9. ………………….. is the key to ………………
A) Serialization, persistence
B) Persistence, inheritance
C) Inheritance, object
D) Persistence, serialization

10. State true of false.
i) Public can only be assigned to class
ii) Protected protects a statement
iii) Protected method is never accessible outside the package
iv) Friendly variable may be accessible outside class

A) i-true, ii-true, iii-false, iv-true
B) i-true, ii-false, iii-true, iv-false
C) i-false, ii-true, iii-false, iv-false
D) i-true, ii-false, iii-false, iv-true

Answers:

1.  C) this
2.  C) initial
3.  C) i-false, ii-true, iii-false, iv-false
4.  B) abstract data type
5.  B) False
6.  A) Not necessary
7.  A) i-true, ii-true, iii-false, iv-true
8.  C) True
9.  A) Serialization, persistence
10.C) i-false, ii-true, iii-false, iv-false

Recommended Books...

Leave a Comment

Your email address will not be published. Required fields are marked *