Java interview questions part 12

Java interview questions part 12

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. At runtime, error is recoverable.

Correct Answer is : FALSE

2. Which of the below is not a subinterface of Queue?

Correct Answer is : BlockingEnque

3. What is the remaining capacity of BlockingQueue whose intrinsic capacity is not defined?

Correct Answer is : Integer.MAX_VALUE

4. PriorityQueue is thread safe.

Correct Answer is : TRUE

5. What is difference between dequeue() and peek() function of java?

Correct Answer is : dequeue() removes and returns the next item in line while peek() returns the next item in line

6. What is the difference between Queue and Stack?

Correct Answer is : Stack is LIFO; Queue is FIFO

7. What are the use of front and rear pointers in CircularQueue implementation?

Correct Answer is : Front and read pointers point to the first element

8. What is the correct method used to insert and delete items from the queue?

Correct Answer is : enqueue and dequeue

9. Which data structure is used in Breadth First Traversal of a graph?

Correct Answer is : Queue

10. Where does a new element be inserted in linked list implementation of a queue?

Correct Answer is : Tail of list

11. If the size of the array used to implement a circular queue is MAX_SIZE. How rear moves to traverse inorder to insert an element in the queue?

Correct Answer is : rear=(rear+1)%MAX_SIZE

12. Which of these packages contain all the collection classes?

Correct Answer is : java.util

13. Which of these classes is not part of Java’s collection framework?

Correct Answer is : Maps

14. Which of this interface is not a part of Java’s collection framework?

Correct Answer is : SortedList

15. Which of these methods deletes all the elements from invoking collection?

Correct Answer is : clear()

16. What is Collection in Java?

Correct Answer is : A group of objects

17. What is the output of this program? import java.util.*; class Array { public static void main(String args[]) { int array[] = new int [5]; for (int i = 5; i > 0; i--) array[5-i] = i; Arrays.fill(array, 1, 4, 8); for (int i = 0; i < 5 ; i++) System.out.print(array[i]); } }

Correct Answer is : 58881

18. What is the output of this program? import java.util.*; class Bitset { public static void main(String args[]) { BitSet obj = new BitSet(5); for (int i = 0; i < 5; ++i) obj.set(i); obj.clear(2); System.out.print(obj); } }

Correct Answer is : {0, 1, 3, 4}

19. Which of the following is not OOPS concept in Java?

Correct Answer is : Compilation

20. Which of the following is a type of polymorphism in Java?

Correct Answer is : Compile time polymorphism

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon