MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
How do you add 21 to an ArrayList of Integers?
A
list.add(21);
B
list.put(21);
C
21.add(list);
D
list.add("21");
Explanation: 

Detailed explanation-1: -Further, new ArrayList<>(100) will set the initial capacity of the array list to 100; this is useful if you know that you don’t want to incur the cost of the array list increasing its size every time it hits the limit. It does not fill any values into the array list.

There is 1 question to complete.