Java keywords MCQs

Java keywords MCQs

Try to answer these Java keywords MCQs and check your understanding of the Java keywords subject. Scroll down and let's begin!

1: A declaration for an enumerated type begins with the ________ key word.

A.   Enumerated

B.   Enum_type

C.   Enum

D.   ENUM

2: Which of the following is a Java keyword?

A.   execute

B.   for

C.   method

D.   output

3: What is the purpose of the "final" keyword in Java?

A.   To declare a constant variable

B.   To indicate the end of a program

C.   To specify the return type of a method

D.   To prevent inheritance or overriding of a class or method

4: Which keyword is used to define a class in Java?

A.   define

B.   class

C.   create

D.   declare

5: What is the purpose of the "static" keyword in Java?

A.   To define a variable with a fixed value

B.   To create an instance of a class

C.   To indicate that a method or variable belongs to the class itself rather than an instance of the class

D.   To allow multiple threads to access a method simultaneously

6: Which keyword is used to define a method in Java?

A.   method (Incorrect)

B.   define

C.   create

D.   void

7: What is the purpose of the "this" keyword in Java?

A.   To refer to the current object or instance of a class

B.   To indicate the end of a loop

C.   To specify the data type of a variable

D.   To break out of a switch statement

8: Which keyword is used to create a new object in Java?

A.   create

B.   instance

C.   new

D.   allocate

9: What is the purpose of the "try-catch" keywords in Java?

A.   To define a loop and execute a block of code repeatedly

B.   To handle exceptions and catch any errors that may occur

C.   To execute a block of code based on a condition

D.   To stop the execution of a program abruptly

10: Which keyword is used to control the flow of execution in a loop?

A.   run

B.   break

C.   end

D.   continue

11: What is the purpose of the "public" keyword in Java?

A.   To specify the access level of a class, method, or variable

B.   To indicate that a method does not return a value

C.   To convert a value from one data type to another

D.   To define a variable with a fixed value