Sail E0 Webinar

MCQs

Total Questions : 45 | Page 3 of 5 pages
Question 21. Which of these methods can be used to delete the last element in a LinkedList object?
  1.    remove()
  2.    delete()
  3.    removeLast()
  4.    deleteLast()
 Discuss Question
Answer: Option C. -> removeLast()


removeLast() and removeFirst() methods are used to remove elements in end and beginning of a linked list.


Question 22. Which of these classes provide implementation of map interface?
  1.    ArrayList
  2.    HashMap
  3.    LinkedList
  4.    DynamicList
 Discuss Question
Answer: Option B. -> HashMap


AbstractMap, WeakHashMap, HashMap and TreeMap provide implementation of map interface.


Question 23. Which of these object stores association between keys and values?
  1.    Hash table
  2.    Map
  3.    Array
  4.    String
 Discuss Question
Answer: Option B. -> Map


Map


Question 24. Which of these method is used to remove all keys/values pair from the invoking map?
  1.    delete()
  2.    remove()
  3.    clear()
  4.    removeAll()
 Discuss Question
Answer: Option B. -> remove()


remove()


Question 25. Which of these method is used to change an element in a LinkedList Object?
  1.    change()
  2.    set()
  3.    redo()
  4.    add()
 Discuss Question
Answer: Option C. -> redo()


An element in a LinkedList object can be changed by first using get() to obtain the index or location of that object and the passing that location to method set() along with its new value.


Question 26. Which of these classes implements Set interface?
  1.    ArrayList
  2.    HashSet
  3.    LinkedList
  4.    DynamicList
 Discuss Question
Answer: Option B. -> HashSet


HashSet and TreeSet implements Set interface where as LinkedList and ArrayList implements List interface.


Question 27. Which of these method is used to change an element in a LinkedList Object?
  1.    change()
  2.    set()
  3.    redo()
  4.    add()
 Discuss Question
Answer: Option C. -> redo()


An element in a LinkedList object can be changed by first using get() to obtain the index or location of that object and the passing that location to method set() along with its new value.


Question 28. Which of these method of Array class is used sort an array or its subset?
  1.    binarysort()
  2.    bubblesort()
  3.    sort()
  4.    insert()
 Discuss Question
Answer: Option C. -> sort()


sort()


Question 29. Which of these methods can be used to search an element in a list?
  1.    find()
  2.    sort()
  3.    get()
  4.    binaryserach()
 Discuss Question
Answer: Option D. -> binaryserach()


binaryserach() method uses binary search to find a specified value. This method must be applied to sorted arrays.


Question 30. Which of these method is used to make all elements of an equal to specified value?
  1.    add()
  2.    fill()
  3.    all()
  4.    set()
 Discuss Question
Answer: Option B. -> fill()


fill() method assigns a value to all the elements in an array, in other words it fills the array with specified value.


Latest Videos

Latest Test Papers