Loading...
QUIZ

Certification Test

 
Que No. 1 ) Which Java data structure provides a way to store key-value pairs?

A.) List
B.) Array
C.) Map
D.) Set


Que No. 2 ) Which of the following is a valid way to create an infinite loop in Java?

A.) for (int i = 0; i < 10; i++) {}
B.) while (true) {}
C.) do {} while (false);
D.) if (1 == 1) {}


Que No. 3 ) What is the purpose of the "toString" method in Java?

A.) To convert an object to a string representation
B.) To parse a string into an object
C.) To compare two strings for equality
D.) To concatenate two strings


Que No. 4 ) Which of the following is a valid way to create a thread in Java?

A.) Thread myThread = new Thread();
B.) Thread myThread = Thread.create();
C.) Thread.start();
D.) Thread myThread = new Thread().start();


Que No. 5 ) What is the purpose of the "try" block in exception handling in Java?

A.) To catch and handle exceptions
B.) To define the code that may throw an exception
C.) To specify the exception type to be thrown
D.) To exit the program


Que No. 6 ) Which Java collection framework interface allows duplicate elements?

A.) Set
B.) List
C.) Map
D.) Queue


Que No. 7 ) What is the purpose of the "instanceof" operator in Java?

A.) To check if an object is an instance of a specific class or interface
B.) To create a new instance of a class
C.) To compare two objects for equality
D.) To determine the size of an array


Que No. 8 ) Which Java data type is used to store a single character?

A.) char
B.) character
C.) string
D.) int


Que No. 9 ) What is the purpose of the "extends" keyword in Java?

A.) To implement an interface
B.) To indicate a class's superclass
C.) To create an instance of a class
D.) To declare a constructor


Que No. 10 ) Which Java keyword is used to exit a loop prematurely?

A.) stop
B.) exit
C.) break
D.) continue