Core Java Mock 2 Cdac Met
Core Java Mock 2 Cdac Met
6 CJMock Random access in _______ has a complexity of O(n). java.util.ArrayList java.util.LinkedList java.util.HashSet None of the above Option2
94
The wait and notify methods are members of
7 CJMock java.lang.Object java.lang.Thread java.lang.Monitor All of the above Option1
_________
21
A non-static field declared with _______ modifier is
8 CJMock private protected transient None of the above Option3
not serialized.
Annotation with _______ retention policy is discarded
59
9 CJMock SOURCE CLASS RUNTIME All of the above Option1
by the compiler.
The for-each loop syntax requires the source object
07
10 CJMock java.util.Iterable java.lang.Iterable java.util.Iterator All of the above Option2
to implement ________.
11 CJMock Following is true about Abstract class Static inner class Visible outside of its package Friend class Cannot be instantiated Option4
80
12 CJMock Following is true aboutFinal class Static inner class Visible outside of its package Friend class Cannot be extended Option4
13 CJMock Following is true about Public class Static inner class Visible outside of its package Friend class Cannot be extended Option2
.in
14 CJMock Following is true about Nested class Static inner class Visible outside of its package Friend class Cannot be extended Option1
15 CJMock Following is true about Anonymous class Static inner class Exactly one instance Friend class Cannot be extended Option2
ys
Public members of a non-public class are not
16 CJMock TRUE FALSE NA NA Option1
accessible outside its package.
ra
URLClassLoader is the parent of system class-
17 CJMock TRUE FALSE NA NA Option2
loader.
18 CJMock
Static member fields of a class are included in the
serialization process. ar TRUE FALSE NA NA Option2
ith
The default security-manager does not allow
19 CJMock TRUE FALSE NA NA Option1
creation of class-loader.
w
94
A class must implement ____ interface for java.lang.Object.Serializ java.io.Externalizabl
30 CJMock java.io.Enumerable None of the above Option3
custimizing serialization of its objects. able e
21
31 CJMock Final key word can be applied to Class Field method All of the above Option4
To apply static binding on methods use ________
32 CJMock Final virtual static None of the above Option1
modifier to methods
59
33 CJMock To check object identity we can use ________ = instanceof === None of the above Option1
Finalize, Final, Finally, out of this following is used
07
34 CJMock Finally Final Finalize None of the above Option1
in exception handling
35 CJMock Checked Exception are checked at _________ Compile time Runtime Both None of the above Option1
80
36 CJMock Checked Exceptions are inherited from Exception Throwable RuntimeException None of the above Option1
Object has to
If an object need to release its resource You have call finalize on
.in
37 CJMock You have to call close on object implement All of the above Option3
automatically, then ________ object
Autocloseable
ys
Interfaces which
Interfaces which have have only one
Interfaces which have only one
ra
38 CJMock Functional Interfaces are _______ only one abstract implemented None of the above Option1
implementedmethod
method method and one
40 CJMock Wait, notify are method of Thread Class Object Runnable Interface None of the above Option2
Which of these packages contain all the collection
de
import java.util.*;
class Collection_iterators
{
public static void main(String args[])
{
LinkedList list = new LinkedList();
list.add(new Integer(2));
46 CJMock 2851 1582 2 2185 Option2
list.add(new Integer(8));
list.add(new Integer(5));
94
list.add(new Integer(1));
Iterator i = list.iterator();
21
Collections.reverse(list);
while(i.hasNext())
System.out.print(i.next() + " ");
59
}
}
07
dequeue() removes peek() removes and
80
and returns the returns the next item in
dequeue() and peek()
What is difference between dequeue() and peek() dequeue() and peek() return the next item in line line while dequeue()
47 CJMock remove and return the Option3
function of java? next item in line while peek() returns the next item in
.in
next time in line
returns the next line
item in line
ys
Front pointer points to Front pointer points to
Rear pointer points to first Front and read
What are the use of front and rear pointers in first element; rear the first element; rear
48 CJMock element; front pointer points to pointers point to Option3
ra
CircularQueue implementation? pointer points to the pointer points to null
the last element the first element
last element object
49 CJMock
Which of these method of Array class is used sort
an array or its subset? ar binarysort() bubblesort() sort() insert() Option3
ith
Which of this interface must contain a unique
50 CJMock Set List Array Collection Option1
element?
w
Optional type
de
94
which statement, if placed in a class other than MyOuter.MyInner();
MyOuter or MyInner, instantiates an instance of the
21
nested class?
private static void payAnnualInterest(Account[]
accounts){
59
for(Account acc : accounts){ instanceof operator
if(acc instanceof Profitable){ checks whether acc is instanceof operator checks
07
instanceof is a
55 CJMock Profitable p = (Profitable)acc; instance of Profitable whether acc is instance of All of the above Option1
function
p.addInterest(12); but does not do Profitable and does conversion
80
} conversion
}
}
.in
In Java, the == operator
Identical Objects
Following is true about == Operator and equals() compares that two equals() method compares two
56 CJMock are also by default all of the above Option4
ys
Method references are identical objects.
equal.
or not.
ra
It is not necessary
that if the two
arWhen it is invoked
objects are unequal
ith
according to
more than once during
equals() method,
the execution of an
w