© A+ Computer Science - www.apluscompsci.
com
This is a sample of the types of questions
included in the multiple-choice question
review banks.
This is a sample and does not contain all of
the questions found in the actual banks.
Most question banks contain over fifty
questions each. There are over 1100
questions included.
These M/C Review Question Banks cover
AP CS A, AP CS Principles, UIL, and Data
Structures Topics.
www.apluscompsci.com
© A+ Computer Science - www.apluscompsci.com
© A+ Computer Science - www.apluscompsci.com
AP CS A / UIL Java - DATA TYPE SAMPLE QUESTIONS
1. Which of the following could fill <*1> without causing a compile error?
<*1> x = 89;
I. int
II. byte
III. short
IV. long
V. double
a. I only d. I, II, III, and IV only
b. I and II only e. I, II, III, IV, and V
c. I, II, and IV only
2. Which of the following could fill <*1> without causing a compile error?
<*1> x = 160;
I. int
II. byte
III. short
IV. long
V. double
a. I only d. I, III, IV, and V only
b. I and II only e. I, II, III, IV, and V
c. I, II, and IV only
3. Which of the following could fill <*1> without causing a compile error?
<*1> x = 32799;
I. int
II. byte
III. short
IV. long
V. double
a. I only d. I, III, IV, and V only
b. I and II only e. I, IV, and V only
c. I, II, and IV only
© A+ Computer Science - www.apluscompsci.com
© A+ Computer Science - www.apluscompsci.com
AP CS A / UIL Java - RECURSION SAMPLE QUESTIONS
1. public void f(int a, int b)
{
if (a/b != 0)
f(a/b,b);
System.out.print(a % b);
}
Given the method above, what is printed by the call f(4,2) ?
a. 221
b. 201
c. 3
d. 100
e. 101
2. public void f(int a, int b)
{
if (a/b != 0)
f(a/b,b);
System.out.print(a % b);
}
Given the method above, what is printed by the call f(5,2) ?
a. 221
b. 201
c. 3
d. 100
e. 101
3. public void f(int a, int b)
{
if (a/b != 0)
f(a/b,b);
System.out.print(a % b);
}
Given the method above, what is printed by the call f(3,7) ?
a. 221
b. 201
c. 3
d. 100
e. 101
© A+ Computer Science - www.apluscompsci.com
© A+ Computer Science - www.apluscompsci.com
AP CS A / UIL Java - SORT / SEARCH SAMPLE QUESTIONS
17. If a search value exists in a sorted list of 3000 items, what is the maximum number of comparisons that may be
needed to find the search value using a binary search?
a. 11
b. 8
c. 12
d. 10
e. 9
18. If a search value exists in a sorted list of 1000 items, what is the maximum number of comparisons that may be
needed to find the search value using a binary search?
a. 11
b. 8
c. 12
d. 10
e. 9
19. How many times will method go() be called given the call check( 10 ) ?
public static void check( int n )
{
for( int i = 0; i < n; i++ )
for( int j = 0; j < n; j++ )
go( i * j );
}
a. 100
b. 55
c. 45
d. 90
e. 54
© A+ Computer Science - www.apluscompsci.com
© A+ Computer Science - www.apluscompsci.com
AP CS PRINCIPLES - PSUEDOCODE SAMPLE QUESTIONS
The psuedocode used in this M/C review is similar to Scratch, python, and the psuedocode used on the
AP CS Principles exam.
Consult the quick reference on the AP CS Principles practice exam.
For the AP CSP psuedocode, <- is the assignment operator [ = ].
1. What is output by the following psuedoccode?
c <- 30
repeat until c < 10
c <- c - 5
display c
A. 30
B. 20
C. 10
D. 5
E. 0
2. What is output by the following psuedoccode?
c <- 0
repeat until ( c > 15 )
{
c <- c + 4
}
display( c )
A. 18
B. 20
C. 12
D. 16
E. 0
© A+ Computer Science - www.apluscompsci.com
© A+ Computer Science - www.apluscompsci.com
10. What is output by the following psuedoccode?
c <- 0
repeat until ( c > 10 )
c <- c + 3
display c
A. 12
B. 9
C. 10
D. 6
E. 0
48. What is the ouput of the code segment below?
procedure go( x )
{
if( x mod 2 == 0 )
return 1
return 2
}
display( go( 8 ) )
A. 0
B. 1
C. 2
D. 3
E. 4
49. What is the ouput of the code segment below?
procedure go( x )
{
if( x > 5 )
return 1
if( x > 2 )
return 2
return 3
}
display( go( 8 ) )
A. 0
B. 1
C. 2
D. 3
E. 4
© A+ Computer Science - www.apluscompsci.com
© A+ Computer Science - www.apluscompsci.com
DATA STRUCTURES / UIL - SAMPLE QUESTIONS
1. Give the tree shown below, which of the following data structures best describes the tree?
4
2 6
1 3 5 7
a. binary tree
b. max-heap
c. binary search tree
d. min-heap
e. stack
2. Give the tree shown below, which of the following data structures best describes the tree?
10
3 18
2 1 15 14
0 -2
a. binary tree
b. max-heap
c. binary search tree
d. min-heap
e. stack
3. Give the tree shown below, which of the following data structures best describes the tree?
15
3 8
1 2 7 6
0 -2
a. binary tree
b. max-heap
c. binary search tree
d. min-heap
e. stack
© A+ Computer Science - www.apluscompsci.com
© A+ Computer Science - www.apluscompsci.com
This is a sample of the types of questions
included in the multiple-choice question
review banks.
This is a sample and does not contain all of
the questions found in the actual banks.
Most question banks contain over fifty
questions each. There are over 1100
questions included.
These M/C Review Question Banks cover
AP CS A, AP CS Principles, UIL, and Data
Structures Topics.
www.apluscompsci.com
© A+ Computer Science - www.apluscompsci.com