wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

AP CS+ September 2025 to date

Total questions: 66

Worksheet time: 1hrs 26mins

Name
Class
Date
1.

What is the variable in this code?

a)

keep score

b)

random position

c)

edge

2.
A conditional statement is also referred to as a(n):
a)
Question
b)
If/Then Statement
c)
Object
d)
Syntax
3.

An argument is:

a)

an object that contains a parameter.

b)

event that contains a parameter.

c)

a value that is passed to a routine.

d)

a function that contains an argument.

4.
Syntax
a)
Element that expresses action
b)
Input added to a function
c)
Anything we interact with in a scene
d)
Rules for how a language is written
5.

Debugging is

a)

how characters are arranged in a statement

b)

detecting or removing errors from a program

c)

removing viruses from a computer

d)

the meaning of each of the characters and symbols in the program

6.

In programming, a (n) _______________ is a value that can change, depending on conditions or on information passed to the program

a)

string

b)

block

c)

instruction

d)

variable

7.
Algorithm
a)
Step by step set of operations to be performed 
b)
Storage unit of data used when needed
c)
Objects that share a common name
d)
Actions in program
8.
Functions
a)
Input keys on keyboard
b)
Instructions given to a computer
c)
Actions in your program
d)
An element in a function
9.

What will print?

a)

0

b)

1

c)

100

d)

101

10.

Which is an example of an input?

a)

monitor

b)

printer

c)

keyboard

11.

Which is an example of an output?

a)

monitor

b)

keyboard

c)

mouse

12.

What is a detailed outline or rough draft of a program?

a)

Integrated Development Environment

b)

pseudocode

c)

algorithm

13.

What is the 1st step in writing a computer program?

a)

type the functions in

b)

pick the programming language

c)

create a plan

d)

declare the class and the class main(~~~) stuff

14.

If one of a paired punctuation such as parentheses is missing:

a)

The robot will assume that it is there and continue running

b)

The program will not compile and the programmer will see an error message

c)

The program will bypass that statement

d)

The program will delete the paired punctuation that is not missing

15.

A single line comment in Java begins with:

a)

A single slash (/)

b)

Two slashes(//)

c)

A slash and asterisk (/*)

d)

An asterisk and a slash (*/)

16.

a mistake in the algorithm, not the language syntax, that causes it to behave incorrectly

a)

parameter error

b)

logic error

c)

procedure error

d)

argument

17.

Consider the following code segment. What is the output?

a)

m,n,p

b)

8,6,3

c)

8,3,6

d)

Error- there is no input.

18.

a collection of program statements that are part of program

a)

strings

b)

numbers

c)

code segments

d)

programming segments

19.

A loop that repeats forever until the level is beaten

a)

while loop

b)

loop

c)

forever loop

d)

infinite loop/while true loop

20.

In python, comment lines start with this symbol

a)

#

b)

//

c)

&

d)

%

21.

Repeat a block of code while a certain condition is true (they do not go on forever).

a)

loop

b)

while loop

c)

infinite loop

d)

syntax

22.

A way of repeating code

a)

repeat

b)

do again

c)

loop

d)

method

23.

Try something a bunch of times, then change a little each time until it's right.

a)

syntax

b)

property

c)

iterate

d)

code

24.

Notes that explain to others what each part of your program does.

a)

code

b)

comment

c)

notes

d)

plan

25.

An action performed by an object

a)

object

b)

method

c)

syntax

d)

plan

26.

All values in a programming language have a "type" - such as a Number, Boolean, or String - that dictates how the computer will interpret it.

a)

Data Type

b)

Variable

c)

Operation

d)

Bug

27.
What Python command lets the user enter an answer to a question?
a)
answer()
b)
open()
c)
print()
d)
input()
28.

Which of these operators means EQUAL TO?

a)

'='

b)

'=>'

c)

'<='

d)

'=='

29.

How many lines will this code print?

x = 10

while x > 0:

print(x)

x = x - 3

a)

5

b)

2

c)

3

d)

4

30.
A computer communicates in __________ language, which is a collection of bits.
a)
Assembly
b)
Cobol
c)
Binary
d)
Java
31.
A collection of 8 bits is a _______, or a single allocation unit in RAM.
a)
Bite
b)
Byte
c)
Word
d)
Circuit
32.

A string

a)

carries out an action

b)

the elements of a command

c)

a collection of characters

d)

how elements in a commad are arranged

33.

The (a)   statement is used to exit a function and return a value to the calling function.

34.

Which of the following statements about Java variables is TRUE?

a)

Java variable names can start with a digit.

b)

Java variable names are not case-sensitive.

c)

Java variable names can start with an underscore or a letter.

d)

Java variable names can include spaces.

35.

Given the expression: int result = 5 + 2.5 * 4; What is the value of result?

a)

15

b)

13

c)

21

d)

25

36.

Which method is used to read integer input from the console in Java using a Scanner object?

a)

scanner.nextLine()

b)

scanner.nextFloat()

c)

scanner.next()

d)

scanner.nextInt()

37.

What is the result of the expression int result = 7 / 2; in Java?

a)

3.5

b)

4

c)

3

d)

2

38.

Software refers to

a)

programs

b)

the physical components a computer is made of

c)

firmware

d)

data stored in RAM

39.

Validating the results of a program is important to

a)

correct runtime errors

b)

make sure the program solves the original problem

c)

create a model of the program

d)

correct syntax error

40.

String x = "10";

String y = "20";

String z = x + y;

System.out.println(z);

Guess the output.

a)

1020

b)

10 20

c)

30

d)

"10 20"

41.

String txt = "Hello World";

System.out.println(txt.toUpperCase());


Choose the correct output.

a)

"HELLO WORLD"

b)

HELLO WORLD

c)

Hello world

d)

Hello World

42.

Is String a primitive data type?

a)

Yes

b)

No

c)

Both

43.

In programming, is there anything more important than performance?.

a)

Yes

b)

No

44.

Explain the function of the buttons on the micro:bit board.

a)

Input commands or trigger actions

b)

Change the color of the micro:bit

c)

Connect to the internet

d)

Play music

45.

What is the purpose of the radio communication feature in micro:bit?

a)

To enable wireless communication between micro:bits

b)

To control the temperature

c)

To play music

d)

To display the time

46.

How can you use the temperature sensor in a micro:bit project?

a)

By using it to measure wind speed

b)

By connecting it to a camera

c)

By programming it to measure the temperature and display the result on the LED screen or use it to trigger other actions in the project.

d)

By using it to play music

47.

Identify the problem in following block of source code

a)

dead code

b)

duplication

c)

inconsistency

48.

Choose the correct name for variable, which will contain running total of checks written to date, and it will be placed inside one method only:

a)

runningTotalOfChecksWrittenToDate

b)

x

c)

runningTotal

49.

Choose the correct recommendation for naming

a)

Don't use such word's pair like begin/end or min/max.

b)

Use Intention-Revealing Names.

c)

Use names that are totally unrelated to what the variables represent.

50.

What value is returned in the following code snippet?

bool isValid(int number)

{

bool status;

if (number >= 1 && number <= 100)

status = true;

else

status = false;

return status;

}

a)

number between 1 to 100

b)

valid or invalid

c)

"status"

d)

true or false

51.

Why is the following call to method minOfTwo, which returns the minimum number of 2 given numbers, incorrect?

int min = minOfTwo(8,"9");

a)

The method minOfTwo only takes in one parameter.

b)

The method minOfTwo does not return anything.

c)

The method minOfTwo takes in two integers, but a String is being passed in.

d)

There is nothing incorrect with this method call.

52.

What will be printed from the following code snippet, where minOfTwo is a method that returns the minimum number?

System.out.println(minOfTwo(10,-1));

a)

10

b)

-1

c)

Nothing, there is an error

d)

minOfTwo(10,-1)

53.

What do I put as the return type if I don't want to return anything from a method?

a)

int

b)

none

c)

void

d)

leave it empty!

54.

True or False:

A method does not need to have any parameters.

a)

True

b)

False

55.

What is the correct way to define a method that subtracts two numbers, returning the difference?

a)

public static void subtract(int num1, int num2)

b)

public static int subtract (int num1, int num2)

c)

public static int subtract(String num1, String num2)

d)

public static void subtract(int num1, num2)

56.

Fill in the blank for defining a method that returns the square root of a number:

public static (a)   squareRoot(double number);

57.

OUTPUT?

int i = 1;

while (i < 5) {

System.out.println("Hello");

i++;

}

a)

Hello

Hello

Hello

Hello

Hello

b)

Hello

Hello

Hello

Hello

c)

Hello

Hello

Hello

d)

Hello

58.

How many stars are printed?

a)

7

b)

3

c)

4

d)

5

e)

Infinite Loop

59.
True/False
If a loop condition is never satisfied then the loop does not execute.
a)
True
b)
False
60.

What is the output for the given code?

a)

Good day

b)

Good evening

c)

time=20

d)

Error

61.

A while loop has the following format:

a)

while (condition)

{

...

}

b)

while

{

...

}

c)

continue while (condition)

{

...

}

d)

while [condition]

[

...;

]

62.

What is the data type of the variable 'x' in the following code: x = 5

a)

float

b)

integer

c)

string

d)

boolean

63.

What is the keyword used to define a function in Python?

a)

function

b)

def

c)

var

d)

class

64.

What is the data type of the variable 'name' in the following code: name = 'John'

a)

integer

b)

boolean

c)

float

d)

string

65.

What is the output of the following Python code: print(5 + 3)

a)

8

b)

53

c)

5 + 3

d)

None of the above

66.

Which function has the correct function syntax?

a)
b)
c)
d)