Collections and ArrayLists
Peer Instruction 12
Collections and ArrayLists
What are the size of the ArrayList after the following code executes?
ArrayList list = new ArrayList(10); list.add("Java"); list.add("Basic"); list.add("C++"); list.add(2, "Python"); list.add(3, "Fortran"); list.remove("Java"); list.trimToSize();
size, capacity: A. 4, 4 B. 4, 10 C. 10, 4 D. 10, 10
cs163/164: Peer 12 - Collections: ArrayList - Fall Semester 2016
Question - 1
What are the size of the ArrayList after the following code executes?
ArrayList list = new ArrayList(10); list.add("Java"); list.add("Basic"); list.add("C++"); list.add(2, "Python"); list.add(3, "Fortran"); list.remove("Java"); list.trimToSize();
size, capacity: A. 4, 4 B. 4, 10 C. 10, 4 D. 10, 10
cs163/164: Peer 12 - Collections: ArrayList - Fall Semester 2016
Question - 2
3/28/2017 1
What is the contents of theArrayList after the following code executes?
ArrayList list = new ArrayList();
list.add("Java"); list.add("Basic");
A. [Java, Basic, Python, Fortran, C++]
list.add("C++");
B. [Java, Python, C++, Fortran]
list.add(2, "Python"); list.add(3, "Fortran"); list.remove(1);
C. [Basic, Python, Fortran, C++] D. [Java, Python, Fortran, C++]
cs163/164: Peer 12 - Collections: ArrayList - Fall Semester 2016
Question - 3
What is the contents of theArrayList after the following code executes?
ArrayList list = new ArrayList();
list.add("Java"); list.add("Basic");
A. [Java, Basic, Python, Fortran, C++]
list.add("C++");
B. [Java, Python, C++, Fortran]
list.add(2, "Python"); list.add(3, "Fortran"); list.remove(1);
C. [Basic, Python, Fortran, C++] D. [Java, Python, Fortran, C++]
cs163/164: Peer 12 - Collections: ArrayList - Fall Semester 2016
Question - 4
Select the statement that best defines an ArrayList.
A. ArrayList is an interface that provides a set of methods to concrete classes such as LinkedList.
B. ArrayList is a concrete class provided by Java that implements a data structure and associated methods.
C. ArrayList is a better data structure than an array because it is more efficient in terms of memory usage.
D. ArrayList is a data structure that represents a list of primitives or objects stored in memory.
cs163/164: Peer 12 - Collections: ArrayList - Fall Semester 2016
Question - 5
3/28/2017 2
Select the statement that best defines an ArrayList.
A. ArrayList is an interface that provides a set of methods to concrete classes such as LinkedList.
B. ArrayList is a concrete class provided by Java that implements a data structure and associated methods.
C. ArrayList is a better data structure than an array because it is more efficient in terms of memory usage.
D. ArrayList is a data structure that represents a list of primitives or objects stored in memory.
cs163/164: Peer 12 - Collections: ArrayList - Fall Semester 2016
Question - 6
Select the statement that best describes the attributes of an ArrayList.
A. An ArrayList can grow or shrink dynamically if the programmer explicitly modifies the capacity.
B. An ArrayList can grow or shrink dynamically without any limitations or special action by the programmer.
C. An ArrayList can grow or shrink dynamically, but an element can only be added at the beginning or end.
D. An ArrayList cannot grow or shrink dynamically, it must be defined by the programmer.
cs163/164: Peer 12 - Collections: ArrayList - Fall Semester 2016
Question - 7
Select the statement that best describes the attributes of an ArrayList.
A. An ArrayList can grow or shrink dynamically if the programmer explicitly modifies the capacity.
B. An ArrayList can grow or shrink dynamically without any limitations or special action by the programmer.
C. An ArrayList can grow or shrink dynamically, but an element can only be added at the beginning or end.
D. An ArrayList cannot grow or shrink dynamically, it must be defined by the programmer.
cs163/164: Peer 12 - Collections: ArrayList - Fall Semester 2016
Question - 8
3/28/2017 3
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- debt management and collections system
- debt management and collections stud
- department management and collections system
- debt management and collections system greenville tx
- debt management and collections student loans
- credit and collections job description
- debt management and collections services
- credit and collections job titles
- credit and collections job duties
- collections policy and procedures
- department of tax and collections santa clara
- credit and collections manager jobs