Computer Knowledge

Java Core Classes and Threads

1,473 Questions

Java core classes and threads form the foundation of object oriented programming and are crucial for IT officer and programming exams. This includes concepts like string mutability, collections, and multithreading. Solve these questions to test your practical coding and theoretical knowledge.

String and StringBuffer classesThread execution methodsJava collections frameworkCharacter streams input outputVariable serialization rules

Java Core Classes and Threads Questions

Multiple choice
  1. Poll() method retrieves and removes the head of the queue or returns Null if the queue is empty.

  2. Remove() method retrieves and removes the head of the queue or returns Null if the queue is empty.

  3. Poll() method retrieves and removes the head of the queue or throws an exception if the queue is empty.

  4. Remove() method retrieves and removes the head of the queue, but doesn’t return anything if the queue is empty.

  5. Poll() method retrieves the head of the queue or returns Null if the queue is empty.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

This is the correct choice.

Multiple choice
  1. Peek() method retrieves and removes the head of the queue and returns Null if the queue is empty.

  2. Peek() method retrieves and removes the head of the queue and returns nothing if the queue is empty.

  3. Peek() method retrieves, but doesn’t remove the head of the queue and returns Null if the queue is empty.

  4. Peek() method retrieves and removes the head of the queue and throws an exception if the queue is empty.

  5. Peek() method retrieves, but doesn’t remove the head of the queue and throws an exception if the queue is empty.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

This is the correct answer.

Multiple choice
  1. This method is used to unbind any object associated with the current session.

  2. This method is used to remove the object, binds with the specified name.

  3. This method is used to bind an object to the session with the specified name.

  4. This method is used to create a new session.

  5. None of the above

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Yes, this is true about invalidate() method in JSP.