Verityprep
Question Bank · Unit 4

AP® Computer Science A Data Collections Practice Questions

Work through AP Computer Science A practice questions on Data Collections, then check each answer against a worked solution.

Free · no sign-up Open questions need no account. Sign up or log in to open the rest.

Questions 991–1,000 of 1,222
  1. 991
  2. 992
  3. 993
  4. 994
  5. 995
  6. 996
  7. 997
  8. 998
  9. 999
  10. 1000

Question 991

Multiple choice Sorting And Searching
What is printed when the following main method is executed? public class Searcher { private int[] arr = {1, 3, 5, 8, 9}; public int mystery(int low, int high,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 992

Free response Arrays
This question involves the design of a class that maintains a collection of tasks. The following Task class is provided. public class Task { private String…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 993

Free response Arraylists
This question involves the design of a class that maintains a collection of books on a library shelf. The following Book class is provided. public class Book {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 994

Free response 2D Arrays
Consider a class MessageGrid that stores words in a two-dimensional array. The 2D array grid may contain null rows, and a non-null row may contain null…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 995

Free response 2D Arrays
You will write the NumberGrid class, which stores integers in a two-dimensional array. The declaration of the NumberGrid class is shown below. You may assume…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 996

Free response 2D Arrays
You will write the WordGrid class, which stores words in a two-dimensional array. The declaration of the WordGrid class is shown below. You may assume that grid…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 997

Multiple choice Using Text Files
A text file contains a single line: 42. What is printed by the following code? Assume sc is a properly constructed Scanner reading that file.
int x = sc.nextInt();
sc.close();
System.out.println(x + 8);
Pick an answer, then check it. The solution opens in a window.

Question 998

Multiple choice Using Text Files
A text file contains a single line: Hello World. What is printed?
String s = sc.nextLine();
sc.close();
System.out.println(s.length());
Pick an answer, then check it. The solution opens in a window.

Question 999

Multiple choice Using Text Files
A text file contains: apple banana cherry. What is printed?
String s = sc.next();
sc.close();
System.out.println(s);
Pick an answer, then check it. The solution opens in a window.

Question 1000

Multiple choice Using Text Files
A text file contains: 3.5. What is printed?
double d = sc.nextDouble();
sc.close();
System.out.println(d * 2 + 1);
Pick an answer, then check it. The solution opens in a window.
Question 991 of 1,222
Page 100 of 123