Time remaining
:
:
Test Status
CORETEST9
Ques 1 :
What is the name of the Collection interface used to represent elements in a sequence (in a particular order). Select the one correct answer.
(A) Collection
(B) Set
(C) List
(D) Map
Ques 2 :
Which of these classes implement the Collection interface SortedMap. Select the one correct answers.
(A) TreeMap
(B) HashMap
(C) Hashtable
(D) HashSet
Ques 3 :
Which statement is true?
(A) ArrayList is a sub class of Vector
(B) HashTable is a sub class of Dictionary
(C) LinkedList is a subclass of ArrayList
(D) Vector is a subclass of Stack
Ques 4 :
What happens when the following program is compiled and run. Select the one correct answer.
public class example
{
int i[] = {0};
public static void main(String args[])
{
int i[] = {1};
change_i(i);
System.out.println(i[0]);
}
public static void change_i(int i[])
{
int j[] = {2};
i = j;
}
}
(A) The program prints 0.
(B) The program prints 2.
(C) The program prints 1.
(D) The program prints 4.
Ques 5 :
Which all lines are part of the output when the following code is compiled and run. Select the three correct answers.
public class test
{
public static void main(String args[])
{
outer :
for(int i = 0; i < 3; i++)
{
for(int j = 3; j >= 0; j--)
{
if(i == j) break outer;
System.out.println(i + " " + j);
}
}
}
.}
a.
0 0
b.
0 1
c.
0 2
d.
0 3
e.
1 0
(A) a, b, c
(B) b, c, d
(C) c, e, a
(D) b, d, e
Ques 6 :
Which of these statements is true?
(A) AbstractSet extends Set
(B) LinkedList extends List
(C) HashSet extends AbstractSet
(D) WeakHashMap extends HashMap
Ques 7 :
Which of the following are true about interfaces. Select the two correct answers.
a.
Methods declared in interfaces are implicitly private.
b.
Variables declared in interfaces are implicitly public, static, and final.
c.
An interface can extend any number of interfaces.
d.
The keyword implements indicate that an interface inherits from another.
(A) a, b
(B) c, d
(C) b, d
(D) b, c
Ques 8 :
Assume that class A extends class B, which extends class C. Also all the three classes implement the method test(). How can a method in a class A invoke the test() method defined in class C (without creating a new instance of class C). Select the one correct answer.
(A) test();
(B) super.test();
(C) C.test();
(D) It is not possible to invoke test() method defined in C from a method in A.
Ques 9 :
By which class we can read object from stream?
(A) Reader
(B) ObjectInputStream
(C) ObjectReader
(D) File
Ques 10 :
By using which modifier we can prevent from overridden?
(A) final
(B) static
(C) we cant prevent
(D) by default it provides
Ques 11 :
Which are true in case of interface?
(A) we can create object implementation to an interface
(B) all type of modifiers are allowed to an interface
(C) we instantiate an interface directly
(D) we can mark interface as final
Ques 12 :
What gets written on the screen when the following program is compiled and run. Select the one right answer.
public class test {
public static void main(String args[]) {
int i;
float f = 2.3f;
double d = 2.7;
i = ((int)Math.ceil(f)) * ((int)Math.round(d));
System.out.println(i);
}
}
(A) 4
(B) 5
(C) 6
(D) 9
Ques 13 :
Which of these statements are true. Select the two correct answers.
a.
For each try block there must be at least one catch block defined.
b.
A try block may be followed by any number of finally blocks.
c.
A try block must be followed by at least one finally or catch block.
d.
If both catch and finally blocks are defined, catch block must precede the finally block.
(A) a, b
(B) c, d
(C) b, d
(D) a, c
Ques 14 :
What is the result of compiling and running the following program.
public class test {
public static void main(String args[]) {
String str1="abc";
String str2="def";
String str3=str1.concat(str2);
str1.concat(str2);
System.out.println(str1);
}
}
(A) def
(B) abc
(C) abcabc
(D) abcdef
Ques 15 :
What are the things we have to follow while creating annotations?
(A) methods must not have any throws clauses
(B) methods must not have any parameters
(C) method should return any one of primitive data types
(D) All the above
Ques 16 :
Why we use @Override annotation?
(A) To check whether the subclass method is overrides from the superclass or not
(B) To say to the compiler not to execute this override method.
(C) To say to compiler that this method is deprecated
(D) None of the above
Ques 17 :
When we go for thread synchronization?
(A) to remove the lock on the thread
(B) when there is a single thread
(C) to make a thread in sleep mode
(D) when we want to prevent any other multiple thread to act an same object
Ques 18 :
Why @SupressWarning Annotation is used?
(A) To suppress exception issued by compiler
(B) To show warnings
(C) To show exceptions
(D) To suppress exception issued by compiler
Ques 19 :
What happens if sleep() and wait() executes in synchronized block?
(A) The object still under lock in both the cases
(B) sleep() the lock is removed ,wait() still under lock
(C) sleep() still under lock ,wait() the lock is removed
(D) Sleep() and wait(),for both the method lock is removed
Ques 20 :
Which are true among below cases?
(A) If programmer want to use several threads then he have to use StringBuffer
(B) StringBuffer Class is synchronized and StringBuilder is not synchronized
(C) String class is immutable, StringBuffer and StringBuilder are mutable
(D) All the above
Submit Answer
Don't Refresh the Page !! ...