Programming MCQs

Java Multiple-Choice Questions With Answer set-8

Pinterest LinkedIn Tumblr
Here are the collections of java multiple-choice questions with answer includes the MCQ questions on the fundamentals of Java programming language with answers. It includes multiple-choice questions on keywords and variables used in java, the data type used in java, the method in a java class and the default constructor used in java along with their answers.

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

Read Also: MCQ on Java Programming With Answers

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

Read Next: Quitz Questions on Java with Answers set-9

Author

Shuseel Baral is a web programmer and the founder of InfoTechSite has over 8 years of experience in software development, internet, SEO, blogging and marketing digital products and services is passionate about exceeding your expectations.

Comments are closed.