Computer Knowledge

Java Core Classes and Threads

1,935 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. setName()

  2. isName()

  3. Name

  4. Start()

  5. getName()

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

Each thread has a Name property that we can set for the benefit of debugging. We can set the name of a thread only once. Naming a thread has its advantages while debugging an application.

Multiple choice
  1. StringBuilder represents a mutable string of characters.

  2. StringBuilder should be used when we want to make a significant number of changes to a string.

  3. If characters are added to the StringBuilder object, its length increases at runtime.

  4. We should always use StringBuilder in place of String.

  5. We can remove characters from a StringBuilder at runtime.

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

Although the StringBuilder class generally offers better performance than the String class, we should not always replace String with StringBuilder. It depends on whether we want to edit the string during the runtime or not.

Multiple choice
  1. Garbage collection

  2. Structured exception handling

  3. Allows creation of multithreaded, scalable applications

  4. Use of delegates instead of function pointers for increased type safety and security

  5. Support for ADO.NET

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

ADO.NET is an object-oriented set of libraries that allows you to interact with data sources. It cannot be said as an advantage of CLR.

Multiple choice
  1. It is used for concurrency issue in the application.

  2. It makes sure that no race condition in the application code.

  3. This technique does not maintain the thread safety in the application.

  4. This technique allows the developer to delay the instantiation of the object until it is first called upon.

  5. Both (1) and (3).

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

These are the correct statements.

Multiple choice
  1. It causes a server control to perform final clean up.

  2. It checks the accessibility of the object.

  3. It is used to search a container for a specified control.

  4. This method is fired when the control is loaded in the page.

  5. This method is loaded when the data is retrieved.

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

It is the task of Load method.