Object Class MCQ

Object Class MCQ

1. This method of StringBuffer Class is used to insert the specified string with this string at the specified position?

Answer

Correct Answer: Public synchronized StringBuffer insert(int offset, String s)

Note: This Question is unanswered, help us to find answer for this one

2. Which method compares the given object to this object?

Answer

Correct Answer: Public boolean equals(Object obj)

Note: This Question is unanswered, help us to find answer for this one

3. In which standard collection classes implements a linked list data structure?

Answer

Correct Answer: LinkedList

Note: This Question is unanswered, help us to find answer for this one

4. By overriding the toString() method of the Object class, we can return values of the object, so we don't need to write much code?

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

5. Java defines a peer class of String, called?

Answer

Correct Answer: StringBuffer

Note: This Question is unanswered, help us to find answer for this one

6. Which constructor creates an empty string buffer with the specified capacity as length.

Answer

Correct Answer: StringBuffer(int capacity)

Note: This Question is unanswered, help us to find answer for this one

7. How many constructors are defined in StringTokenizer class?

Answer

Correct Answer: 3

Note: This Question is unanswered, help us to find answer for this one

8. In which string class function returns the number of characters in a string?

Answer

Correct Answer: Length()

Note: This Question is unanswered, help us to find answer for this one

9. Generally string is a sequence of characters, But in java, string is an:

Answer

Correct Answer: Object

Note: This Question is unanswered, help us to find answer for this one

10. Which method of object class can clone an object?

Answer

Correct Answer: Object Clone()

Note: This Question is unanswered, help us to find answer for this one

11. Which class is thread-safe i.e. multiple threads cannot access it simultaneously,So it is safe and will result in an order?

Answer

Correct Answer: StringBuffer class

Note: This Question is unanswered, help us to find answer for this one

12. Which method causes the current thread to wait for the specified milliseconds, until another thread notifies? (invokes notify() or notifyAll() method)?

Answer

Correct Answer: Public final void wait(long timeout)throws InterruptedException

Note: This Question is unanswered, help us to find answer for this one

13. The object cloning is a way to create exact copy of an object?

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

14. The clone() method is defined in?

Answer

Correct Answer: Object Class

Note: This Question is unanswered, help us to find answer for this one

15. The Object class is not a parent class of all the classes in java by default?

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

search