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 technology testing
  1. A. Pop-up window, object state, VBScript event

  2. B. Object State, VBScript event, Application crash

  3. C. Pop-up window, object state, test run error, QTP crash

  4. D. Pop-up window, object state, test run error, application crash

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

QTP/UFT provides four main trigger event types for Recovery Scenarios: Pop-up window (unexpected dialog), Object State (property changes), Test run error (script failures), and Application crash (application terminates). These events trigger recovery operations to handle exceptions automatically during test execution. VBScript events are not trigger types in this context.

Multiple choice technology programming languages
  1. System.free()

  2. System.setGarbageCollection()

  3. System.setGarbageCollector()

  4. System.gc()

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

System.gc() is the correct method to suggest garbage collection to the JVM. Options A, B, and C list non-existent methods - System has no free(), setGarbageCollection(), or setGarbageCollector() methods.

Multiple choice technology programming languages
  1. Structured Exception Handling

  2. Unstructured Exception Handling

  3. Both A and B

  4. None of the Above

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

VB.NET supports both structured exception handling (Try...Catch...Finally blocks) and unstructured exception handling (On Error GoTo statements) for backward compatibility with VB6. This dual approach allows developers to choose modern error handling or legacy-style error management.

Multiple choice technology programming languages
  1. setContentWriter()

  2. setWriter()

  3. setPrintType()

  4. setContentType()

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

The setContentType() method must be called before using PrintWriter because it sets the content type (MIME type) of the response being sent to the client. Once the PrintWriter is obtained and used to write content, the response headers are committed and cannot be modified.

Multiple choice technology programming languages
  1. None of the above

  2. content safe

  3. synchornised

  4. thread safe

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

Setting <%@ page isThreadSafe="false" %> indicates the JSP is not thread-safe, implementing the SingleThreadModel interface. This ensures only one thread executes the JSP at a time by serializing requests through the same servlet instance, making it thread-safe by preventing concurrent access.

Multiple choice technology programming languages
  1. All implementations of the List interface provide fast random access.

  2. A LinkedList provides faster random access than an ArrayList.

  3. The LinkedList implements the RandomAccess interface.

  4. The RandomAccess interface declares the next and hasNext methods.

  5. None of the above.

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

Statement A is false - only implementations of RandomAccess (ArrayList, Vector) provide fast random access. Statement B is false - LinkedList has slower random access than ArrayList. Statement C is false - LinkedList does NOT implement RandomAccess. Statement D is false - RandomAccess is a marker interface with no methods. Thus 'None of the above' (E) is correct.

Multiple choice technology testing
  1. By recording

  2. Object Spy

  3. Net Spy

  4. Step Generator

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

Object Spy is QTP's built-in tool specifically designed to view and retrieve object properties, methods, and identification properties. Recording captures actions, Net Spy doesn't exist in QTP, and Step Generator creates test steps.

Multiple choice technology testing
  1. GetToProperty

  2. GetProperty

  3. GetRoProperty

  4. ObjectProperty

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

In QTP/UFT automation, GetRoProperty ('Run-time Object Property') retrieves the actual property value from the application during test execution, while GetProperty retrieves values from the object repository. Options A, B, and D are not valid QTP methods for retrieving runtime properties.

Multiple choice technology web technology
  1. CellData(Row, Column)

  2. TableCellData(Row, Column)

  3. CellDataValue(Row, Column)

  4. GetCellData(Row, Column)

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

GetCellData(Row, Column) is the correct QTP method to extract a specific cell value from a WebTable when you know the row and column numbers. The other options (CellData, TableCellData, CellDataValue) are not valid QTP methods.

Multiple choice technology web technology
  1. ActionEvent

  2. ActionListener

  3. ApplicationInstance

  4. None of the above

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

ActionListener is the standard interface used for event handling in Echo2 (a web framework). ActionEvent is typically an event class, not the listener interface. ApplicationInstance is a different component entirely.

Multiple choice technology programming languages
  1. Thread.GetData

  2. Monitor.Pulse

  3. Thread.SpinWait

  4. Monitor.Wait

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

Monitor.Pulse notifies a single waiting thread in the waiting queue that the locked object's state has changed. The waiting thread can then re-acquire the lock and proceed. Thread.GetData retrieves thread-local data, Thread.SpinWait is a busy-wait mechanism, and Monitor.Wait releases the lock and puts the thread in the waiting queue.