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 programming languages
  1. Tree

  2. Stack

  3. Queue

  4. Array

  5. LinkedList

  6. Map

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

Map is a core interface in the Java Collections Framework that represents a mapping of keys to values. Tree, Stack, Queue, and LinkedList are implementation classes, not interfaces. Array is a language construct, not a Collections Framework interface.

Multiple choice technology programming languages
  1. abstract, default, if, private, this

  2. do, implements, protected, boolean, throw

  3. case, extends, int, short, try

  4. import, break, double, exception, throws

  5. byte, else, instanceof, return, transient

  6. None of the above

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

All words in options A, B, C, and E are Java keywords. Option D contains 'exception' which is not a keyword (it's a class name in java.lang). 'import', 'break', 'double', and 'throws' are valid keywords.

Multiple choice technology programming languages
  1. )Integer

  2. Boolean

  3. Character

  4. Long

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

The Character wrapper class does not have a valueOf(String) method because it would be unclear which character from a multi-character string should be returned. Character only has valueOf(char). Other wrappers like Integer, Boolean, and Long all accept String input for conversion.

Multiple choice technology programming languages
  1. ModifyQuery()

  2. Modify()

  3. Change()

  4. ChangeQuery()

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

In PowerBuilder, the Modify() method is used to dynamically alter the properties of a DataWindow object at runtime, including modifying its SQL query. There are no standard PowerBuilder functions named ModifyQuery(), Change(), or ChangeQuery() for this purpose.

Multiple choice technology platforms and products
  1. Right click on the class and select ‘Run as > Java Application’

  2. Right click on the class and select ‘Run’

  3. It is not possible in Eclipse.

  4. All of the above

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

The standard way to supply runtime arguments in Eclipse is through the Run menu or Run Configurations. Option A (Run as Java Application) uses default/previous settings without prompting, while option B (Run) opens the configuration dialog where arguments can be specified before execution.

Multiple choice technology platforms and products
  1. Highlight the method and select References > Workspace option in the search drop-down

  2. Possible only when we have MyEclipse plug-in

  3. N/A in Eclipse

  4. None of these

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

Eclipse provides a 'References' search feature in the context menu. By highlighting a method name and selecting References > Workspace from the search dropdown, you can find all places where that method is called. This works without requiring any additional plugins like MyEclipse.

Multiple choice technology web technology
  1. Hibernate does not support lazy initialization for detached objects.

  2. Access to a lazy association outside of the context of an open Hibernate session will result in an exception.

  3. Lazy fetching is way to avoid unnecessary column reads.

  4. All the above.

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

All statements are true: Hibernate cannot lazily initialize associations on detached objects; accessing a lazy association outside an open session throws a LazyInitializationException; and lazy fetching avoids unnecessary database reads.

Multiple choice technology web technology
  1. RequiredFieldValidator

  2. RegularExpressionValidator

  3. CompareValidator

  4. The equals() method of the field.

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

The CompareValidator control is specifically designed to validate that two fields (like password and confirm password) are equal. RequiredFieldValidator checks for non-empty values, RegularExpressionValidator validates patterns, and there is no equals() method on fields - this is a concept from programming, not ASP.NET validation controls.

Multiple choice technology programming languages
  1. @Print

  2. @StatusBar

  3. @MessageBox

  4. @MessageBar

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

The @StatusBar function displays text on the status bar at the bottom of the Notes client, which performs a similar function to the Lotus Script Print method that outputs to the status bar. @Print doesn't exist in formula language, @MessageBox displays dialog boxes, and @MessageBar is not a valid function.

Multiple choice technology programming languages
  1. @Name

  2. @FieldName

  3. @ThisName

  4. @FieldTitle

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

The @ThisName function returns the name of the current field when used within a field's formula, allowing formulas to reference their own field name dynamically. @Name returns a hierarchical name, @FieldName doesn't exist in formula language, and @FieldTitle is not a standard function.

Multiple choice technology programming languages
  1. integer

  2. boolean

  3. character

  4. long

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

In Java, the wrapper classes Integer, Boolean, and Long all have static valueOf(String) methods that parse string representations into their respective wrapper types. The Character wrapper class does not have a valueOf(String) method - it has valueOf(char) instead, which requires a char primitive.

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

  2. System.setGarbageCollection()

  3. System.setGarbage()

  4. System.gc()

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

System.gc() is the standard method to suggest JVM garbage collection, though it's only a suggestion to the JVM rather than a guarantee. The other options (System.free(), System.setGarbageCollection(), System.setGarbage()) are not valid Java API methods.