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 .net vb
  1. Assert( )

  2. Open()

  3. Flush( )

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

To solve this question, the user needs to have knowledge about the Debug class and its methods.

The Debug class is a class in C# that provides a set of methods, properties, and events to assist in debugging applications. It is mainly used for debugging purposes, such as tracing, logging, and error handling.

Now, let's go through each option and explain why it is right or wrong:

A. Assert( ): This is a method of the Debug class, which is used to check whether a condition is true or false. If the condition is false, it will stop the execution of the program and display an error message. Therefore, option A is not the correct answer.

B. Open(): This method is not a part of the Debug class. It is a method of the File class, which is used to open a file in the specified mode. Therefore, option B is the correct answer.

C. Flush( ): This is a method of the Debug class, which is used to clear the output buffer and send any pending messages to the listeners. Therefore, option C is not the correct answer.

The Answer is: B

Multiple choice java core java
  1. 1.add(Object x)

  2. 2.remove(Object x)

  3. 3.contains(Object x)

  4. 4.insert(int i,Object x)

  5. 5.set(int I,Object x)

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

ArrayList has add(), remove(), contains(), and set() methods, but does not have an insert() method - the equivalent functionality is provided by add(int index, E element). Option D correctly identifies the non-existent method.

Multiple choice java core java
  1. 1.program ignores exceptn

  2. 2.program halts immediately

  3. 3.Program will not compile

  4. 4.None of the above

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

When an unchecked exception (like RuntimeException) is thrown and not caught by any catch block, it propagates up the call stack. If no method in the call stack handles it, the JVM terminates the program and prints the stack trace. The program compiles successfully because unchecked exceptions don't require mandatory catch blocks - only checked exceptions do. Option A is wrong because the exception is not ignored. Option C is wrong because the absence of a catch block for unchecked exceptions is a compile-time legal scenario.

Multiple choice c sharp
  1. RowChanged

  2. ColumnChanged

  3. RowChanging

  4. All of above

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

To solve this question, the user needs to have knowledge of the DataTable object and the events that it exposes.

The DataTable object is a part of the ADO.NET framework and represents a table of data in memory. It is used to store and manipulate data retrieved from a database or other data source.

Now, let's go through each option and explain why it is right or wrong:

A. RowChanged: This option is correct. The RowChanged event is exposed by the DataTable object. It is raised when a row in the DataTable has been changed.

B. ColumnChanged: This option is correct. The ColumnChanged event is exposed by the DataTable object. It is raised when a value in a column of the DataTable has been changed.

C. RowChanging: This option is correct. The RowChanging event is exposed by the DataTable object. It is raised before a row in the DataTable is about to be changed.

D. All of the above: This option is correct. All of the events mentioned in options A, B, and C are exposed by the DataTable object. These events provide different points in the data manipulation process where custom logic can be executed.

Therefore, the correct answer is:

The Answer is: D. All of the above

Multiple choice return type of
  1. B. void returns no data type.

  2. C. void is not supported in Java

  3. D. None of the above

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

void indicates that a method returns no value. Option A is correct - void means the method returns nothing, not 'no data type' which is awkward phrasing but captures the intent.

Multiple choice javascript
  1. stringName.charAt(0);

  2. stringName.substring(1);

  3. stringName.charAt(1);

  4. stringName.charAt(2);

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

charAt(0) returns the first character in a string because indexing starts at 0. charAt(1) would return the second character.

Multiple choice javascript
  1. popUp(PageURL,WindowName,settings);

  2. window.launch(PageURL,WindowName,settings);

  3. window.close(PageURL,WindowName,settings);

  4. window.open(PageURL,WindowName,settings);

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

window.open() is the correct JavaScript method to open a new browser window. It takes URL, window name, and feature settings as parameters.

Multiple choice javascript
  1. stringVariable.substring(subString)

  2. stringVariable.find(subString)

  3. stringVariable.indexOf(subString)

  4. stringVariable.indexOf(charAt(0))

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

The indexOf() method returns the position of the first occurrence of a specified value in a string, effectively searching for the substring. substring() extracts characters, and find() is not a standard JavaScript String method.

Multiple choice general knowledge
  1. map pointer

  2. identifier

  3. ideo locator

  4. route pointer

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

Ideolocator is the technical cartographic term for the 'you are here' indicator on maps. The term combines 'ideo' (related to representation/idea) and 'locator' (position-finding device). Note it's one word.

Multiple choice general knowledge science & technology
  1. none of the below

  2. J

  3. JJM

  4. JVM

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

Java uses the Java Virtual Machine (JVM) as its runtime environment. The JVM executes Java bytecode and provides platform independence. The options 'J' and 'JJM' are meaningless in the context of Java architecture.

Multiple choice general knowledge science & technology
  1. constructor

  2. destructor

  3. mutators

  4. accessors

  5. behaviour

Reveal answer Fill a bubble to check yourself
A,C,D,E Correct answer
Explanation

This question uses a specific classification system for Java methods. Constructors (A) initialize objects. Accessors/getters (D) retrieve private field values. Mutators/setters (C) modify private field values. Behavior methods (E) perform actions or operations. Option B (destructor) is incorrect because Java doesn't have destructors - it uses garbage collection instead.