Sail E0 Webinar

MCQs

Total Questions : 45 | Page 4 of 5 pages
Question 31. Which of these method Map class is used to obtain an element in the map having specified key?
  1.    search()
  2.    get()
  3.    set()
  4.    look()
 Discuss Question
Answer: Option A. -> search()


search()


Question 32. Which of these methods can be used to obtain set of all keys in a map?
  1.    getAll()
  2.    getKeys()
  3.    keyall()
  4.    keySet()
 Discuss Question
Answer: Option D. -> keySet()


keySet() methods is used to get a set containing all the keys used in a map. This method provides set view of the keys in the invoking map.


Question 33. Which of these method is used add an element and corresponding key to a map?
  1.    put()
  2.    set()
  3.    redo()
  4.    add()
 Discuss Question
Answer: Option A. -> put()


Maps revolve around two basic operations “ get() and put(). to put a value into a map, use put(), specifying the key and the value. To obtain a value, call get() , passing the key as an argument. The value is returned


Question 34. Which of these standard collection classes implements all the standard functions on list data structure?
  1.    Array
  2.    LinkedList
  3.    HashSet
  4.    AbstractSet
 Discuss Question
Answer: Option A. -> Array


Array


Question 35. 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 36. Which of these class object can be used to form a dynamic array?
  1.    ArrayList
  2.    Map
  3.    Vector
  4.    Both a & b
 Discuss Question
Answer: Option D. -> Both a & b


Vectors are dynamic arrays, it contains many legacy methods that are not part of collection framework, and hence these methods are not present in ArrayList. But both are used to form dynamic arrays.


Question 37. What is the name of data member of class Vector which is used to store number of elements in the vector?
  1.    length
  2.    elements
  3.    elementCount
  4.    capacity
 Discuss Question
Answer: Option C. -> elementCount


elementCount


Question 38. Which of these methods is used to add elements in vector at specific location?
  1.    add()
  2.    set()
  3.    AddElement()
  4.    addElement()
 Discuss Question
Answer: Option D. -> addElement()


addElement() is used to add data in the vector, to obtain the data we use elementAt() and to first and last element we use firstElement() and lastElement() respectively.


Question 39. Which of these are legacy classes?
  1.    Stack
  2.    Hashtable
  3.    Vector
  4.    All of the mentioned
 Discuss Question
Answer: Option D. -> All of the mentioned


Stack, Hashtable, Vector, Properties and Dictionary are legacy classes.


Question 40. Which of these is the interface of legacy?
  1.    Map
  2.    Enumeration
  3.    HashMap
  4.    Hashtable
 Discuss Question
Answer: Option B. -> Enumeration


Enumeration


Latest Videos

Latest Test Papers