Docsity

Questions on Dynamic Arrays, Exercises of Computer science

Toggle sidebar
bg1
Smithi Gopalakrishnan
3 Questions about Dynamic Arrays (ArrayLists)
1. Where does the add method in an ArrayList store the new element?
a. At index 0
b. At index 1
c. In the middle of the array
d. At the end of the array
2. What method is used to get the number of elements in an ArrayList object?
a. length()
b. size()
c. range()
d. set()
3. Which ArrayList method is overloaded (same method name but can have a
varying amount of parameters)?
a. get()
b. add()
c. size()
d. set()
e. remove()
f. clear()
Answers:
1. d โ€“ At the end of the array
2. b โ€“ size()
3. b โ€“ add()

Partial preview of the text

Download Questions on Dynamic Arrays and more Exercises Computer science in PDF only on Docsity!

Smithi Gopalakrishnan 3 Questions about Dynamic Arrays (ArrayLists)

  1. Where does the add method in an ArrayList store the new element? a. At index 0 b. At index 1 c. In the middle of the array d. At the end of the array
  2. What method is used to get the number of elements in an ArrayList object? a. length() b. size() c. range() d. set()
  3. Which ArrayList method is overloaded (same method name but can have a varying amount of parameters)? a. get() b. add() c. size() d. set() e. remove() f. clear() Answers:
  4. d โ€“ At the end of the array
  5. b โ€“ size()
  6. b โ€“ add()