WorksheetsAP CS+ September 2025 to date
Total questions: 66
Worksheet time: 1hrs 26mins
What is the variable in this code?
keep score
random position
edge
An argument is:
an object that contains a parameter.
event that contains a parameter.
a value that is passed to a routine.
a function that contains an argument.
Debugging is
how characters are arranged in a statement
detecting or removing errors from a program
removing viruses from a computer
the meaning of each of the characters and symbols in the program
In programming, a (n) _______________ is a value that can change, depending on conditions or on information passed to the program
string
block
instruction
variable
What will print?
0
1
100
101
Which is an example of an input?
monitor
printer
keyboard
Which is an example of an output?
monitor
keyboard
mouse
What is a detailed outline or rough draft of a program?
Integrated Development Environment
pseudocode
algorithm
What is the 1st step in writing a computer program?
type the functions in
pick the programming language
create a plan
declare the class and the class main(~~~) stuff
If one of a paired punctuation such as parentheses is missing:
The robot will assume that it is there and continue running
The program will not compile and the programmer will see an error message
The program will bypass that statement
The program will delete the paired punctuation that is not missing
A single line comment in Java begins with:
A single slash (/)
Two slashes(//)
A slash and asterisk (/*)
An asterisk and a slash (*/)
a mistake in the algorithm, not the language syntax, that causes it to behave incorrectly
parameter error
logic error
procedure error
argument
Consider the following code segment. What is the output?
m,n,p
8,6,3
8,3,6
Error- there is no input.
a collection of program statements that are part of program
strings
numbers
code segments
programming segments
A loop that repeats forever until the level is beaten
while loop
loop
forever loop
infinite loop/while true loop
In python, comment lines start with this symbol
#
//
&
%
Repeat a block of code while a certain condition is true (they do not go on forever).
loop
while loop
infinite loop
syntax
A way of repeating code
repeat
do again
loop
method
Try something a bunch of times, then change a little each time until it's right.
syntax
property
iterate
code
Notes that explain to others what each part of your program does.
code
comment
notes
plan
An action performed by an object
object
method
syntax
plan
All values in a programming language have a "type" - such as a Number, Boolean, or String - that dictates how the computer will interpret it.
Data Type
Variable
Operation
Bug
Which of these operators means EQUAL TO?
'='
'=>'
'<='
'=='
How many lines will this code print?
x = 10
while x > 0:
print(x)
x = x - 3
5
2
3
4
A string
carries out an action
the elements of a command
a collection of characters
how elements in a commad are arranged
The (a) statement is used to exit a function and return a value to the calling function.
Which of the following statements about Java variables is TRUE?
Java variable names can start with a digit.
Java variable names are not case-sensitive.
Java variable names can start with an underscore or a letter.
Java variable names can include spaces.
Given the expression: int result = 5 + 2.5 * 4; What is the value of result?
15
13
21
25
Which method is used to read integer input from the console in Java using a Scanner object?
scanner.nextLine()
scanner.nextFloat()
scanner.next()
scanner.nextInt()
What is the result of the expression int result = 7 / 2; in Java?
3.5
4
3
2
Software refers to
programs
the physical components a computer is made of
firmware
data stored in RAM
Validating the results of a program is important to
correct runtime errors
make sure the program solves the original problem
create a model of the program
correct syntax error
String x = "10";
String y = "20";
String z = x + y;
System.out.println(z);
Guess the output.
1020
10 20
30
"10 20"
String txt = "Hello World";
System.out.println(txt.toUpperCase());
Choose the correct output.
"HELLO WORLD"
HELLO WORLD
Hello world
Hello World
Is String a primitive data type?
Yes
No
Both
In programming, is there anything more important than performance?.
Yes
No
Explain the function of the buttons on the micro:bit board.
Input commands or trigger actions
Change the color of the micro:bit
Connect to the internet
Play music
What is the purpose of the radio communication feature in micro:bit?
To enable wireless communication between micro:bits
To control the temperature
To play music
To display the time
How can you use the temperature sensor in a micro:bit project?
By using it to measure wind speed
By connecting it to a camera
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.
By using it to play music
Identify the problem in following block of source code
dead code
duplication
inconsistency
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:
runningTotalOfChecksWrittenToDate
x
runningTotal
Choose the correct recommendation for naming
Don't use such word's pair like begin/end or min/max.
Use Intention-Revealing Names.
Use names that are totally unrelated to what the variables represent.
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;
}
number between 1 to 100
valid or invalid
"status"
true or false
Why is the following call to method minOfTwo, which returns the minimum number of 2 given numbers, incorrect?
int min = minOfTwo(8,"9");
The method minOfTwo only takes in one parameter.
The method minOfTwo does not return anything.
The method minOfTwo takes in two integers, but a String is being passed in.
There is nothing incorrect with this method call.
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));
10
-1
Nothing, there is an error
minOfTwo(10,-1)
What do I put as the return type if I don't want to return anything from a method?
int
none
void
leave it empty!
True or False:
A method does not need to have any parameters.
True
False
What is the correct way to define a method that subtracts two numbers, returning the difference?
public static void subtract(int num1, int num2)
public static int subtract (int num1, int num2)
public static int subtract(String num1, String num2)
public static void subtract(int num1, num2)
Fill in the blank for defining a method that returns the square root of a number:
public static (a) squareRoot(double number);
OUTPUT?
int i = 1;
while (i < 5) {
System.out.println("Hello");
i++;
}
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
How many stars are printed?
7
3
4
5
Infinite Loop
If a loop condition is never satisfied then the loop does not execute.
What is the output for the given code?
Good day
Good evening
time=20
Error
A while loop has the following format:
while (condition)
{
...
}
while
{
...
}
continue while (condition)
{
...
}
while [condition]
[
...;
]
What is the data type of the variable 'x' in the following code: x = 5
float
integer
string
boolean
What is the keyword used to define a function in Python?
function
def
var
class
What is the data type of the variable 'name' in the following code: name = 'John'
integer
boolean
float
string
What is the output of the following Python code: print(5 + 3)
8
53
5 + 3
None of the above
Which function has the correct function syntax?
