FlashKeepers

Computer Science · AP · Test Prep

AP Computer Science A: Data Structures

ArrayLists, 2D arrays, inheritance, and recursion concepts tested on AP Computer Science A.

About this set

35 basic cards for AP Computer Science. Set 3 of 5 in AP Computer Science A. It opens with "What is an ArrayList in Java?" and "How does an ArrayList differ from a regular array?". Study it alongside the other AP sets below.

35 cards · basic cards · AI-written, checked twice. Edit anything.

Study this set free Look inside first Get FlashKeepers for iPhone

Opens in your browser, no account. Get the iPhone and iPad app · Android app

What is an ArrayList in Java?
Show answerA resizable array that can grow or shrink dynamically at runtime
How does an ArrayList differ from a regular array?
Show answerArrayList is resizable and part of the Collections Framework, while arrays have a fixed size set at creation
What method adds an element to an ArrayList?
Show answeradd()
What method removes an element from an ArrayList by index?
Show answerremove()
What method accesses an element in an ArrayList at a specific index?
Show answerget()
What import statement is required to use ArrayList?
Show answerimport java.util.ArrayList;
What does the size() method return for an ArrayList?
Show answerThe number of elements currently in the ArrayList
What exception is thrown when accessing an invalid ArrayList index?
Show answerIndexOutOfBoundsException
What is the time complexity of accessing an ArrayList element by index?
Show answerO(1) - constant time
What is a 2D array?
Show answerAn array of arrays, organized in rows and columns like a table or matrix
How do you declare a 2D array of integers named matrix with 3 rows and 4 columns?
Show answerint[][] matrix = new int[3][4];
How do you access the element at row 1, column 2 in a 2D array?
Show answerarray[1][2]
What does matrix.length return for a 2D array?
Show answerThe number of rows in the 2D array
What does matrix[0].length return for a 2D array?
Show answerThe number of columns in the first row
What is a ragged array?
Show answerA 2D array where rows can have different numbers of columns

20 more cards in the app

Study this set free