Java Collections and GUI (GATE)

Collection Framework Questions

15 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

How many constructors are there of ArrayList class in Java?

  1. 6
  2. 5
  3. 4
  4. 3
  5. 2
Question 2 Multiple Choice (Single Answer)

How many constructors are there of Vector class in Java collection framework?

  1. 6
  2. 5
  3. 4
  4. 3
  5. 2
Question 3 Multiple Choice (Single Answer)

Which of the following methods is present in ListIterator interface in Java collections?

  1. nextIndex()
  2. addAll()
  3. IndexOf()
  4. listIterator()
  5. subList(startindex,endindex)
Question 4 Multiple Choice (Single Answer)

Which of the following methods is present in the Stack class in Java collections framework?

  1. remove()
  2. element()
  3. Pop()
  4. poll()
  5. exit()
Question 5 Multiple Choice (Single Answer)

Which of the following methods are present in the queue interface?

  1. poll()
  2. search(o:Object)
  3. empty()
  4. exit()
  5. Pop()
Question 6 Multiple Choice (Single Answer)

Which of the following methods is present in LinkedList class in Java collections?

  1. addFirst()
  2. setFirst()
  3. setLast()
  4. indexOf(e:Element)
  5. lastIndexOf(e:element)
Question 7 Multiple Choice (Single Answer)

Which of the following methods is/are static in collections class?

  1. Frequency(c : collection, o : object)
  2. Reverse(List)
  3. Sort(List)
  4. Both 1 and 2
  5. All of the above
Question 8 Multiple Choice (Single Answer)

Which of the following methods in collections class is not static?

  1. Min(c:Collection)
  2. Shuffle(list)
  3. Frequency(c :collection, o :object)
  4. Copy(destination,source)
  5. Merge(c:collection,c1:collection)
Question 9 Multiple Choice (Single Answer)

Which of the following methods is not present in Vector class in Java collections framework?

  1. elementAt(index)
  2. firstElement()
  3. removeElementAt(int)
  4. setSize(int)
  5. removeFirst()
Question 10 Multiple Choice (Single Answer)

What is the third argument passed to the Constructor of GridLayout?

  1. Int rows
  2. Int columns
  3. Int HorizontalGap
  4. Int VerticalGap
  5. Int Alignmnent
Question 11 Multiple Choice (Single Answer)

What is the second argument passed to the constructor of GridLayout?

  1. Int rows
  2. Int columns
  3. Int horizontalGap
  4. Int VerticalGap
  5. Int Alignment
Question 12 Multiple Choice (Single Answer)

What is the initial capacity of Vector?

  1. 16
  2. 10
  3. 20
  4. 12
  5. 18
Question 13 Multiple Choice (Single Answer)

Which of the following methods is present in Vector class in Java collections framework?

  1. removeAllElements()
  2. element()
  3. removeLast()
  4. get(index : int)
  5. set(index,element)
Question 14 Multiple Choice (Single Answer)

What is the third argument passed to the Constructor of BorderLayout?

  1. Int alignment
  2. Int horizontalGap
  3. Int VerticalGap
  4. Int Rows
  5. None of these
Question 15 Multiple Choice (Single Answer)

Which of the following arguments is the third argument passed to the constructor of the FlowLayout?

  1. Int horizontalGap
  2. Int VerticalGap
  3. Int Alignment
  4. Int Rows
  5. Int Columns