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 technology
  1. to update the working document with the results of service

  2. to update the screen input in working document

  3. to specify the next event to be executed

  4. to format the working document

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

In client events, which handle user interaction, the Out parameter is responsible for updating screen-related input data in the working document. Option A describes service events, not client events. Option C refers to flow control. Option D is not the standard terminology for client event Out parameters.

Multiple choice technology databases
  1. Trap it with a Handler

  2. Propagate it to the Calling Environment

  3. A & Then B

  4. B & Then A

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

Exception handling involves first trapping the exception with a handler in the EXCEPTION block, then optionally propagating it to the calling environment if the handler cannot resolve it. This two-step approach (handle then propagate if needed) is the standard pattern.

Multiple choice technology web technology
  1. log.debug

  2. log.info

  3. log.error

  4. System.out.println

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

For debugging purposes, log.debug is the most appropriate choice as it provides fine-grained diagnostic information that can be enabled in development and disabled in production without performance impact. The info level is for significant application events, error for problems requiring attention, and System.out.println bypasses the logging framework entirely.

Multiple choice technology life sciences
  1. Session.Close()

  2. Session.discard()

  3. Session.Abandon()

  4. Session.Exit()

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

In ASP.NET, the Session.Abandon() method is the standard way to destroy a user's session and release its resources. Alternative methods like Session.Close(), Session.discard(), or Session.Exit() do not exist as valid session termination APIs in the framework.

Multiple choice technology programming languages
  1. Viewlet

  2. Applet

  3. Servlet

  4. Object

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

An Applet is a specialized Java program designed to run within web browsers, transmitted over the Internet and executed client-side. Unlike Servlets which run server-side, Applets provided early web interactivity before modern JavaScript frameworks emerged.

Multiple choice technology web technology
  1. OnItemChanged();

  2. OnFieldChanged();

  3. OnPropertyChanged();

  4. All of the above

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

OnPropertyChanged() is the standard method called when a property value changes in data binding scenarios. This method implements INotifyPropertyChanged and notifies the UI that bound data has changed, triggering UI updates. OnItemChanged and OnFieldChanged are not standard Silverlight/WPF patterns.

Multiple choice technology programming languages
  1. To provide access to the Java runtime system.

  2. To avoid run time exception.

  3. To provide the capability to execute code no matter whether or not an exception is thrown or caught.

  4. Both 2 & 3

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

The Runtime class in Java provides access to the Java runtime environment. It allows applications to interface with the environment in which they are running. Common uses include executing system commands (exec), forcing garbage collection (gc), getting free memory (freeMemory), and terminating the JVM (exit). It does not handle exceptions or provide finally-like behavior.

Multiple choice technology programming languages
  1. all sub-classes of Throwable

  2. not the sub classes of RuntimeException

  3. all sub-classes of Error

  4. None of these

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

Checked exceptions are exceptions that must be either caught or declared in a throws clause. They are all subclasses of Throwable EXCEPT RuntimeException and its subclasses (unchecked exceptions) and Error and its subclasses (system errors). So checked exceptions are 'not the subclasses of RuntimeException' (and also not Error subclasses).

Multiple choice technology programming languages
  1. the heap space occupied by an un-referenced object can be recycled and made available for subsequent new objects

  2. When the total memory allocated to a Java program exceeds some threshold the garbage coollector is invoked

  3. the program does not suspend during garbage collection

  4. garbage collection requires extra memory

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

Java garbage collection typically suspends all application threads during the collection phase, causing 'stop-the-world' pauses. This is necessary to safely identify and reclaim unreachable objects without concurrent modifications.

Multiple choice technology programming languages
  1. FaultException

  2. RESTException

  3. WebFaultException

  4. WebHttpFaultException

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

WebFaultException is the specific exception type for WCF RESTful services (WebHttpBinding). It allows returning HTTP status codes along with fault information. FaultException is for SOAP services. RESTException and WebHttpFaultException do not exist in WCF.