Loading

Q1.

Which of the following access modifiers allows the widest scope of accessibility?

A. private
B. protected
C. public
D. default

Q2.

 Which of the following statements about the final keyword is true?

A. A final class can be inherited.

B. A final variable can be reassigned.

C. A final method cannot be overridden.

D. A final method cannot be called.

Q3.

Which of the following modifiers can be applied to a class?

A. abstract and final

B. public and abstract

C. static and protected

D. private and transient

Q4.

What is the use of the static keyword in Java?

A. To create a constant variable

B. To make a variable or method belong to the class instead of an object

C. To restrict inheritance

D. To synchronize threads

Q5.

 Which of the following modifiers is used for thread safety in Java?

A. volatile

B. final

C. abstract

D. synchronized