Declare and construct an ArrayList with an initial capacity of 20 references to Object.

C4 Week 9 Wednesday

Quiz
•
Other
•
Professional Development
•
Medium

Ahmetcan türk
Used 14+ times
FREE Resource
11 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Object list(20) = new ArrayList() ;
ArrayList list[20] = new ArrayList() ;
ArrayList[Object] list = new ArrayList(20) ;
ArrayList<Object> list = new ArrayList<Object>(20) ;
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Examine the following code:
ArrayList<String> list = new ArrayList<String>(10) ;
list.add( "Ann" );
list.add( "Bob" );
list.add( "Eve" );
After the code has executed, what is the capacity of list? What is its size?
3, 3
3, 10
10, 3
10, 10
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Examine the following code:
ArrayList<String> list = new ArrayList<String>(10) ;
list.add( "Andy" );
list.add( "Bart" );
list.add( "Carl" );
list.add( 0, "Eve" );
What element will be at index 2 of the list?
Eve
Andy
Bart
carl
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Examine the following code:
ArrayList<String> list = new ArrayList<String>() ;
list.add( "Andy" );
list.add( "Bart" );
list.add( "Carl" );
list.add( "Doug" );
list.add( "Elmo" );
Which of the following will replace the element "Carl" with "Zoltan" ?
list[2] = "Zoltan" ;
list.set( "Zoltan", "Carl" );
list.add( "Zoltan", list.indexOf("Carl") );
list.set( list.indexOf("Carl"), "Zoltan" );
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Examine the following code:
ArrayList<String> list = new ArrayList<String>() ;
list.add( "Andy" );
list.add( "Bart" );
list.add( "Carl" );
list.add( "Doug" );
list.add( "Elmo" );
Which of the following will change the list so that it looks like:
Andy
Bart
Carl
Doug
Oscar
Elmo
list.add( 3, "Oscar" ) ;
list.add( 4, "Oscar" ) ;
list.set( 3, "Oscar" ) ;
list.set( 4, "Oscar" ) ;
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Examine the following code:
ArrayList<String> list = new ArrayList<String>() ;
list.add( "Andy" );
list.add( "Bart" );
list.add( "Carl" );
list.add( "Doug" );
list.add( "Elmo" );
Which of the following will change the list so that it looks like:
Andy
Bart
Doug
Elmo
list.remove( 3 );
list.remove( 2 );
list.add( 2, null );
list.set( list.indexOf( "Carl" ), "Doug" );
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Examine the following code:
ArrayList<String> list = new ArrayList<String>() ;
list.add( "Andy" );
list.add( "Bart" );
list.add( "Carl" );
list.add( "Doug" );
list.add( "Elmo" );
Which of the following will change the list so that it looks like:
Andy
Bart
Carl
Doug
list.remove( list.size() );
list.remove( list.size()-1 );
list.remove( 5 );
list.clear( "Elmo" );
Create a free account and access millions of resources
Similar Resources on Quizizz
9 questions
Python Functions

Quiz
•
Professional Development
15 questions
Avaluación inicial M07

Quiz
•
Professional Development
15 questions
Python & SQL

Quiz
•
Professional Development
10 questions
Python Basics

Quiz
•
Professional Development
11 questions
PySpark Quiz Round

Quiz
•
Professional Development
15 questions
Lists and operators

Quiz
•
Professional Development
10 questions
ADP 5 - Ice Breaking Serius

Quiz
•
Professional Development
14 questions
HTML Basics

Quiz
•
Professional Development
Popular Resources on Quizizz
15 questions
Multiplication Facts

Quiz
•
4th Grade
25 questions
SS Combined Advisory Quiz

Quiz
•
6th - 8th Grade
40 questions
Week 4 Student In Class Practice Set

Quiz
•
9th - 12th Grade
40 questions
SOL: ILE DNA Tech, Gen, Evol 2025

Quiz
•
9th - 12th Grade
20 questions
NC Universities (R2H)

Quiz
•
9th - 12th Grade
15 questions
June Review Quiz

Quiz
•
Professional Development
20 questions
Congruent and Similar Triangles

Quiz
•
8th Grade
25 questions
Triangle Inequalities

Quiz
•
10th - 12th Grade