Object Class MCQs

Object Class MCQs

Our experts have gathered these Object Class MCQs through research, and we hope that you will be able to see how much knowledge base you have for the subject of Object Class by answering these 10+ multiple-choice questions.
Get started now by scrolling down!

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

A.   True

B.   False

2: The clone() method is defined in?

A.   Abstract class

B.   ArrayList class

C.   Object Class

D.   None

3: The object cloning is a way to create exact copy of an object?

A.   False

B.   True

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

A.   Protected Object clone() throws CloneNotSupportedException

B.   Protected void finalize()throws Throwable

C.   Public final void wait(long timeout,int nanos)throws InterruptedException

D.   Public final void wait(long timeout)throws InterruptedException

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

A.   None

B.   StringBuffer class

C.   StringBuilder class And StringBuffer class

D.   StringBuilder class

6: Which method of object class can clone an object?

A.   Object Copy()

B.   Copy()

C.   Clone()

D.   Object Clone()

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

A.   Package

B.   Class

C.   Object

D.   None

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

A.   EqualIgnoreCase()

B.   Length()

C.   CharAt()

D.   Replace()

9: How many constructors are defined in StringTokenizer class?

A.   4

B.   2

C.   3

D.   5

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

A.   None

B.   StringBuffer(int capacity)

C.   StringBuffer(String str)

D.   StringBuffer()

11: Java defines a peer class of String, called?

A.   StringBuffer

B.   StringBuilder And StringBuffer

C.   StringBuilder

D.   None

12: 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?

A.   False

B.   True

13: In which standard collection classes implements a linked list data structure?

A.   LinkedList

B.   None

C.   AbstractList

D.   HashSet

14: Which method compares the given object to this object?

A.   Public final ClassgetClass()

B.   Public final void notify()

C.   Public final void notifyAll()

D.   Public boolean equals(Object obj)

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

A.   Public String substring(int beginIndex)

B.   Public int length()

C.   Public synchronized StringBuffer append(String s)

D.   Public synchronized StringBuffer insert(int offset, String s)