Core java MCQ

1.Why java is machine independent language ?

a.It works on WORA(write once run anywhere)

b.It is simple and easy

c.OOPs

d.None of these

Answer:a

2.In which of the following is a keyword.

a.class

b.interface

c.int 

d.float

Answer:b

3.By which keyword we can  access the classes and interfaces in java.

a.import

b.dynamic

c.static import

d.None of the above

Answer:a

4.JVM is machine independent.

a.True

b.False

Answer:b

5.Which block always execute whether exception occur or not.

a.try

b.catch

c.finally

d.final

Answer: c

6.The exception occur at the compile time is known as

a.checked exception

b.unchecked exception

c.error exception

d.None of the these

Answer:a

7.When one class acquire the properties of another class then this mechanism is known as

a.polymorphism

b.abstraction

c.inheritance

d.constructor

Answer:c

8.How we can implement multi-threading in java ?

a.By extending Thread class

b.By extending Runnable interface

c.By implementing run method

d.None of these

Answer:a

9.How we can achieve run-time polymorphism ?

a.By method overloading

b.By method overriding

c.By destructor

d.None of the these

Answer:b

10.How we can achieve compile-time polymorphism ?

a.By method overloading

b.By method overriding

c.By constructor

d.None of the these

Answer:a

11.What do you mean by Collection framework in java ?

a.collection of objects

b.groups of interface

c.collection of class

d.None of these

Answer:a

12.What do you mean by set interface?

a.contains duplicate value

b.does not contains duplicate value

c.Both a&b

d.None of these

Answer:b

13.What do you mean by list interface ?

a.contains duplicate value

b.does not contains duplicate value

c.Both a&b

d.None of these

Answer:a

14.Which of these classes is  not the part of java collection framework.

a.array

b.stack

c.Maps

d.None of these

Answer:c

15.How can traverse the element in forward direction only in java collection framework ?

a.Iterator

b.List iterator

c.for loop

d.None of these

Answer:a

16.How can traverse the element in both  forward and backward direction in collection framework in java ?

a.Iterator

b.ListIterator

c.for loop

d.None of these

Answer:b

17.What do you mean by TreeSet ?

a.sorted the elements in ascending order

b.sorted the elements in descending order

c.same output same as input

d.None of these

Answer:a

18.What do you mean by HashTable ?

a.Contains null value and key

b.Does not contain null value and key

c.Contains one null value and key

d.None of these

Answer:b

19.By which method we can delete all the invoking elements in the  collection framework.

a.delete( )

b.clear( )

c.revoke( )

d.None of these

Answer:b

20.Which of these interface is not part of java collection’s framework.

a.List

B.set

c.sortedList

d.sortedMap

Answer: c