slug
csareviewmcq
type
Post
status
Published
category
8-AP CSA
date
Mar 21, 2024
summary
tags
Review
password
icon
Below is a 42-question multiple-choice set in English based on the 30 Java code examples. The answer key is at the end only.

AP CSA Practice MCQs

Based on 30 Java Code Examples

1.

Consider the code:
What is printed?
A. 73
B. 10
C. 21
D. 7 + 3

2.

Consider the code:
What is printed?
A. 2
B. 2.0
C. 2.3333333333
D. 3

3.

Consider the code:
Which statement is true?
A. It prints 2
B. It prints a decimal value close to 2.333...
C. It does not compile
D. It prints 7.0/3

4.

Consider the code:
What is printed?
A. 10 25
B. 25 10
C. 25 25
D. 10 10

5.

Consider the code:
What is printed?
A. 3
B. 3.0
C. 3.4
D. 4.0

6.

Consider the code:
What is printed?
A. 3
B. 3.0
C. 3.4
D. 4

7.

Consider the code:
What is printed?
A. 33
B. 34
C. 35
D. 36

8.

Consider the code:
What is printed?
A. 7
B. 10
C. 25
D. 32.0

9.

Consider the code:
What is printed?
A. 15
B. 16
C. 17
D. 18

10.

Consider the code:
What is printed?
A. Computer
B. Computer Science
C. Science
D. Compute

11.

Consider the code:
What is printed?
A. 8
B. 9
C. 10
D. 11

12.

Consider the code:
What is printed?
A. APCSA2026
B. AP CSA 2026
C. AP + CSA + 2026
D. AP, CSA, 2026

13.

Consider the method:
What is returned by square(6)?
A. 6
B. 12
C. 18
D. 36

14.

Consider the method:
What is returned by average(5, 8)?
A. 6
B. 6.0
C. 6.5
D. 7.0

15.

Consider the code:
What is printed?
A. Hot
B. Not hot
C. Hot and Not hot
D. Nothing

16.

Consider the code:
What is printed?
A. Pass
B. Fail
C. 87
D. Nothing

17.

Consider the code:
What is printed?
A. Failed
B. Passed but not A range
C. A range
D. 91

18.

Consider the code:
What is printed?
A. Can enter
B. Cannot enter
C. true
D. false

19.

Consider the code:
How many numbers are printed?
A. 4
B. 5
C. 6
D. Infinite loop

20.

Consider the code:
What is printed?
A. 45
B. 50
C. 55
D. 60

21.

Consider the method:
What is returned by countVowels("Education")?
A. 4
B. 5
C. 6
D. 7

22.

Consider the method:
What is returned by repeatFront("code", 5)?
A. codecodecodecodecode
B. ccccc
C. ooooo
D. ccode

23.

Consider the class:
Which line correctly creates a student with name "Amy" and grade 11?
A. Ex17_Student s = new Ex17_Student();
B. Ex17_Student s = new Ex17_Student("Amy");
C. Ex17_Student s = new Ex17_Student("Amy", 11);
D. Ex17_Student s = Ex17_Student("Amy", 11);

24.

Using the class in Question 23, what is returned by s.getGrade() if s was created by
A. Amy
B. 11
C. "11"
D. grade

25.

Consider the class:
If the following code runs,
what is printed?
A. 120.0
B. 130.0
C. 150.0
D. 170.0

26.

Consider the class:
Which statement best describes this.x = x; inside setX?
A. It sets the parameter equal to itself
B. It sets the instance variable to the parameter value
C. It causes a syntax error
D. It declares a new local variable

27.

Consider the class:
What is printed by the following code?
A. 0
B. 1
C. 2
D. It does not compile

28.

Why is count declared static in Question 27?
A. So each object has its own separate count
B. So the variable belongs to the class, shared by all objects
C. So the variable cannot change
D. So the constructor cannot access it

29.

Consider the class:
What is printed by:
A. 7
B. 9
C. 14
D. 49

30.

Consider the class:
What is printed by:
A. Ex22_Book
B. Java Basics
C. Java Basics (180 pages)
D. title + pages

31.

Consider the class:
What is returned by area() for a rectangle created with (4, 4)?
A. 4
B. 8
C. 16
D. true

32.

Using the class in Question 31, what is returned by isSquare() for a rectangle created with (4, 4)?
A. 4
B. false
C. true
D. It does not compile

33.

Consider the code:
Which pair is printed?
A. 3 and 12
B. 3 and 9
C. 6 and 12
D. 6 and 9

34.

Consider the method:
What is returned by findMax(new int[]{4, 15, 2, 19, 8})?
A. 15
B. 19
C. 8
D. 4

35.

Consider the code:
What is printed?
A. AP
B. CSA
C. Java
D. 1

36.

Using the same words list as in Question 35, what is the size after:
A. 1
B. 2
C. 3
D. 4

37.

Consider the method:
What is returned for the list ["cat", "apple", "banana", "go"]?
A. 1
B. 2
C. 3
D. 4

38.

Consider the method:
What is returned by:
A. 15
B. 18
C. 21
D. 24

39.

Consider the method:
What is returned by:
A. 6
B. 8
C. 9
D. 12

40.

Consider the recursive method:
What is returned by factorial(5)?
A. 25
B. 60
C. 120
D. 125

41.

Consider the method:
After selectionSort is called on {5, 2, 8, 1, 3}, what is the array?
A. {8, 5, 3, 2, 1}
B. {1, 2, 3, 5, 8}
C. {2, 1, 3, 5, 8}
D. {5, 2, 8, 1, 3}

42.

Which topic is most directly tested by the selectionSort and factorial examples together?
A. String concatenation and output
B. Constructors and instance variables
C. Sorting and recursion
D. Casting and compound assignment

Answer Key

answer key
  1. B
  1. A
  1. B
  1. B
  1. B
  1. C
  1. A
  1. D
  1. B
  1. A
  1. B
  1. B
  1. D
  1. C
  1. A
  1. A
  1. C
  1. A
  1. B
  1. C
  1. B
  1. B
  1. C
  1. B
  1. B
  1. B
  1. C
  1. B
  1. C
  1. C
  1. C
  1. C
  1. A
  1. B
  1. B
  1. B
  1. B
  1. C
  1. C
  1. C
  1. B
  1. C
 
AP CSA 总复习-2026AP CSA 总复习-2025
Loading...