Sail E0 Webinar

MCQs

Total Questions : 45 | Page 2 of 5 pages
Question 11. Which of these class can generate an array which can increase and decrease in size automatically?
  1.    ArrayList()
  2.    DynamicList()
  3.    LinkedList()
  4.    DynamicList()
 Discuss Question
Answer: Option A. -> ArrayList()


ArrayList()


Question 12. Which of these method of ArrayList class is used to obtain present size of an object?
  1.    size()
  2.    length()
  3.    index()
  4.    capacity()
 Discuss Question
Answer: Option A. -> size()


size()


Question 13. Which of these method can be used to increase the capacity of ArrayList object manually?
  1.    Capacity()
  2.    increaseCapacity()
  3.    increasecapacity()
  4.    ensureCapacity()
 Discuss Question
Answer: Option D. -> ensureCapacity()


When we add an element, the capacity of ArrayList object increases automatically, but we can increase it manually to specified length x by using function ensureCapacity(x)


Question 14. Which of these methods can be used to obtain a static array from an ArrayList object?
  1.    Array()
  2.    covertArray()
  3.    toArray()
  4.    covertoArray()
 Discuss Question
Answer: Option A. -> Array()


Array()


Question 15. Which of these standard collection classes implements a dynamic array?
  1.    AbstractList
  2.    LinkedList
  3.    ArrayList
  4.    AbstractSet
 Discuss Question
Answer: Option C. -> ArrayList


ArrayList class implements a dynamic array by extending AbstractList class.


Question 16. Which of these method is used to reduce the capacity of an ArrayList object?
  1.    trim()
  2.    trimSize()
  3.    trimTosize()
  4.    trimToSize()
 Discuss Question
Answer: Option D. -> trimToSize()


trimTosize() is used to reduce the size of the array that underlines an ArrayList object.


Question 17. Which of these method is used to add an element to the start of a LinkedList object?
  1.    add()
  2.    first()
  3.    AddFirst()
  4.    addFirst()
 Discuss Question
Answer: Option D. -> addFirst()


addFirst()


Question 18. Which of these standard collection classes implements a linked list data structure?
  1.    AbstractList
  2.    LinkedList
  3.    HashSet
  4.    AbstractSet
 Discuss Question
Answer: Option B. -> LinkedList


LinkedList


Question 19. Which of these method of HashSet class is used to add elements to its object?
  1.    add()
  2.    Add()
  3.    addFirst()
  4.    insert()
 Discuss Question
Answer: Option A. -> add()


add()


Question 20. 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.


Latest Videos

Latest Test Papers