wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

PLTW Computer Science

Total questions: 110

Worksheet time: 2hrs 50mins

Name
Class
Date
1.

The bash tab is located in the.....

a)

Top left corner of the page

b)

the bottom of the page

c)

The bottom right of the page

d)

the top right of the page

2.

What is another name for bash?

a)

Bash 2.0

b)

The Command Line

c)

Integral

d)

Bam

3.

What does Modulo do

a)

Gives the difference of two numbers

b)

Does simple arithmetic

c)

Give the product when mutiplying

d)

Returns the reminder when divding

4.

What does the following code statement mean "from .models import Question"?

a)

The code statement allows the views.py file to access to your Question data type defined in the models.py file.

b)

The code statement allows the views.py file access to your Question data type defined in the urls.py file.

c)

The code statement allows the views.py file access to your Question data type defined in the admin.py file.

d)

The code statement allows the views.py file access to your Question data type defined in the views.py file.

5.
To repeat a fixed number of times use a
a)
while loop
b)
for loop
c)
if loop
d)
indentation
6.
To repeat until a particular condition is true use
a)
while loop
b)
for loop
c)
if loop
d)
indentation
7.
The second part of if, that is executed when the condition is false
a)
if
b)
else
c)
for
d)
input
8.
Data type that can only be true or false
a)
int
b)
string
c)
bool
d)
float
9.
A variable that can hold a collection of values, often called an array in other programming languages
a)
list
b)
int
c)
string
d)
constant
10.
The character that must be at the end of the line for if, while, for etc.
a)
:
b)
;
c)
.
d)
,
11.
Decides if a string only contains numbers
a)
isalpha()
b)
isnumeric()
c)
int()
d)
string()
12.
Tells the interpreter that the code which follows is a function
a)
const
b)
int
c)
def
d)
while
13.
Converts a number to a string
a)
str()
b)
int()
c)
parseInt()
d)
convert
14.
Python identifies blocks of code by
a)
BEGIN and END keywords
b)
{ and }
c)
aligning up the starts of lines (indentation)
d)
guessing
15.
What is python named after
a)
The snake
b)
Television show called Monty Python
16.
What extension must you add to the end of a file when saving?
a)
.xlsx
b)
.pptx
c)
.docx
d)
.py
17.
What does the term 'debug' mean?
a)
Identify errors and fix them.
b)
Making a calculation
c)
A set of instructions
d)
Looking at code
18.
What does the print function do in python?
a)
It's a variable.
b)
It can input data.
c)
It displays something like a string or integer
d)
It loops the code.
19.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
20.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
21.
What will the output be from the following code?
print("Hello world!")
a)
SyntaxError
b)
Hello world!
c)
"Hello world!"
d)
print(Hello world!)
22.
What will the output be from the following code?
Print("Hello world!")
a)
NameError
b)
Hello world!
c)
"Hello world"
d)
Print(Hello world!)
23.
What will the output be from the following code?
print(3+4)
a)
3+4
b)
7
c)
SyntaxError
d)
print(3+4)
24.
What will the output be from the following code?
print("3+4")
a)
7
b)
3+4
c)
34
d)
SyntaxError
25.
What will the output be from the following code?
print(3*4)
a)
34
b)
7
c)
12
d)
3*4
26.
What will the output be from the following code?
print(3*4+5)
a)
27
b)
17
c)
12
d)
SyntaxError
27.
What will the output be from the following code?
print("3*4+5")
a)
SyntaxErrror
b)
17
c)
3*4+5
d)
12
28.
What will the output be from the following code?
print(9/3)
a)
3
b)
3.0
c)
9/3
d)
SyntaxError
29.
What will the output be from the following code?
print(9/3*2+4-5)
a)
19
b)
5.0
c)
0.5
d)
5
30.
What will the output be from the following code?
print("Hello" + "world!")
a)
Hello world!
b)
Helloworld!
c)
SyntaxError
d)
"Hello" "world!"
31.
What will the output be from the following code?
print("Hello" + "world" + "today")
a)
Helloworldtoday
b)
Hello world today
c)
"Hello" "world" "today"
d)
SyntaxError
32.
What will the output be from the following code?
print("Hello" + 2 + "world")
a)
Hello 2 world
b)
Hello2world
c)
TypeError
d)
HelloHelloworld
33.
What will the output be from the following code?
print("Hello world!" * 2 * "Hello world!")
a)
TypeError
b)
Hello world! Hello world! Hello world! Hello world!
c)
Hello Hello World! World!
d)
Hello world! Hello world!
34.
What will the output be from the following code?
print("Hello" + str(2) + "world!")
a)
Hello world! Hello world!
b)
Hello2world!
c)
Hello Hello world! world!
d)
SyntaxError
35.
Joining elements together to make a string is called what?
a)
Combining
b)
Connecting
c)
Concatenation
d)
Stringing
36.
Which Python command is used to output information to the screen?
a)
read
b)
output
c)
print
d)
display
37.
What is syntax?
a)
Syntax is the word used to describe an error
b)
Syntax is the rules of the programming language
c)
It is used to read information
d)
It is used to output information 
38.
A data type consisting of numbers, letters and symbols.
a)
String
b)
Integer
c)
Float
d)
Boolean
39.
Code repeated / looped until a condition has been met or a set number of times.
a)
Sequence
b)
Selection
c)
Iteration
d)
Variable
40.
Count controlled loop - code executed a given number of times
a)
While loop
b)
For loop
c)
Repeat loop
d)
If...else
41.
Data type for a whole number
a)
String
b)
Integer
c)
Boolean
d)
Float
42.
A location in memory used to store data that can be changed.
a)
Constant
b)
Value
c)
Variable
d)
Iteration
43.
To solve a problem that requires the user to enter 10 numbers would use what type of iteration?
a)
While loop
b)
For loop
c)
Variable
d)
Selection
44.
The user is asked to enter a number which must be below one hundred. What type of iteration would be used to check this?
a)
For loop
b)
While loop
c)
Check loop
d)
Repeat loop
45.

Which of these is spelled correctly...

a)

Iteration

b)

Iteraton

c)

Iteretion

d)

Iterasion

46.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
47.
A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly
a)
True
b)
False
48.
When you have an error in your code what is the term to summarise finding and fixing that error?
a)
Error checking
b)
Debugging
c)
Syntax finder
d)
Error finder
49.
Python is an example of a....
a)
Text-based programming language
b)
Object orientated programming language
c)
language written in java script
d)
Visual-based programming language
50.
Which of these would work as a piece of code?
a)
IF answer == "Yes":
b)
if answer == "Yes"
c)
if answer == "Yes":
d)
if answer = "yes":
51.
If you want more than one option for your code, what do you use (after if)?
a)
elif
b)
else
c)
ifif
52.

people = ["John", "Rob", "Bob"]

print (people[1])

what would this result be?

a)
John
b)
Rob
c)
Bob
53.

people = ["John", "Rob", "Bob"]

print (people[-1])

what would this result be?

a)
John
b)
Rob
c)
Bob
54.

people = ["John", "Rob", "Bob"]

print (people[4])

what would this result be?

a)
John
b)
Rob
c)
Bob
d)
Error
55.

What is a returned value?

a)

The value passed from a function back to the line of code calling the function

b)

A place in memory to store a value

c)

Rules about what words from a programming language are allowed to go together and how

d)

A block of code given a name that is able to be called by referencing the function name

56.

Local is the opposite of global. Properties of components are global variables. Any variable that you initialize at the start of a program in App Inventor is a global variable.

a)

True

b)

False

57.

A variable and pattern designed to keep a running total through multiple iterations

a)

Accumulator Pattern

b)

Concatenation

c)

While Loop

d)

Counted Loop

58.

A procedure to follow, especially using iteration and conditionals

a)

For Loop

b)

Algorithm

c)

Return Value

d)

Concatenation

59.
A(n) Boolean expression is:
a)
An expression that can be evaluted as TRUE or FALSE. Often used in CONDITIONAL STATEMENTS, such as IF (condition) THEN (action1) ELSE (action2)
b)
Operators that are used to combine or change Boolean Expressions. The 3 standard operators are AND, OR, and NOT.
c)
Control block that looks for events to then perform action
d)
A symbol that represents a compare action for a computer to take. Examples are: ">" (greater than), "<" (less than) and "=" (equal)
60.

A(n) arithmetic operator is:

a)

Values that a program provides to a function or subroutine

b)

Type of code to perform a math operation, such as + - * /

c)

A set of steps to accomplish a task.

d)

Way to manage complexity, hide details or remove duplication

61.

A(n) relational operator is:

a)

An expression that can be evaluted as TRUE or FALSE. Often used in CONDITIONAL STATEMENTS, such as IF (condition) THEN (action1) ELSE (action2)

b)

A symbol that represents a compare action for a computer to take. Examples are: ">" (greater than), "<" (less than) and "=" (equal)

c)

Operators that are used to combine or change Boolean Expressions. The 3 standard operators are AND, OR, and NOT.

d)

Control block that looks for events to then perform action

62.

A(n) logical operator is:

a)

An expression that can be evaluted as TRUE or FALSE. Often used in CONDITIONAL STATEMENTS, such as IF (condition) THEN (action1) ELSE (action2)

b)

Control block that looks for events to then perform action

c)

A symbol that represents a compare action for a computer to take. Examples are: ">" (greater than), "<" (less than) and "=" (equal)

d)

Operators that are used to combine or change Boolean Expressions. The 3 standard operators are AND, OR, and NOT.

63.
A(n) float is:
a)
A precise number by including values after the decimal place
b)
A programming statement that directs control flow - it uses BOOLEAN expressions to make a choice between different paths (IF (condition) THEN (path1) ELSE (path2)
c)
A data type that can have only 2 values - TRUE or FALSE
d)
A whole number, it does not have any digits after a decimal.
64.

A(n) integer is:

a)

A programming statement that directs control flow - it uses BOOLEAN expressions to make a choice between different paths (IF (condition) THEN (path1) ELSE (path2)

b)

A precise number by including values after the decimal place

c)

A whole number, it does not have any digits after a decimal.

d)

A data type that can have only 2 values - TRUE or FALSE

65.
A(n) boolean is:
a)
A data type that can have only 2 values - TRUE or FALSE
b)
A whole number, it does not have any digits after a decimal.
c)
A precise number by including values after the decimal place
d)
A programming statement that directs control flow - it uses BOOLEAN expressions to make a choice between different paths (IF (condition) THEN (path1) ELSE (path2)
66.

A(n) conditional statement is:

a)

A precise number by including values after the decimal place

b)

A data type that can have only 2 values - TRUE or FALSE

c)

A whole number, it does not have any digits after a decimal.

d)

A programming statement that directs control flow - it uses BOOLEAN expressions to make a choice between different paths (IF (condition) THEN (path1) ELSE (path2)

67.

A(n) string is:

a)

An object such as a number or word. A _____ is an expression that cannot be evaluated any further. Variables are evaluated to a final ____ before operators (arithmetic, relational, or logical) are then used on them.

b)

An action (such as clicking a button) or occurrence (receiving a text message) that happens during runtime that will trigger a response or behavior by the software.

c)

The smallest unit of data storage that a program can use.

d)

A type of variable that holds text (characters, numbers, punctuation or math symbols). Uses quotes to tell the computer to not treat what is inside the string (inside the quotes) as code.

68.

A(n) value is:

a)

A type of variable that holds text (characters, numbers, punctuation or math symbols). Uses quotes to tell the computer to not treat what is inside the string (inside the quotes) as code.

b)

An object such as a number or word. A _____ is an expression that cannot be evaluated any further. Variables are evaluated to a final ____ before operators (arithmetic, relational, or logical) are then used on them.

c)

An action (such as clicking a button) or occurrence (receiving a text message) that happens during runtime that will trigger a response or behavior by the software.

d)

The smallest unit of data storage that a program can use.

69.

A(n) variable is:

a)

An action (such as clicking a button) or occurrence (receiving a text message) that happens during runtime that will trigger a response or behavior by the software.

b)

An object such as a number or word. A _____ is an expression that cannot be evaluated any further. Variables are evaluated to a final ____ before operators (arithmetic, relational, or logical) are then used on them.

c)

A type of variable that holds text (characters, numbers, punctuation or math symbols). Uses quotes to tell the computer to not treat what is inside the string (inside the quotes) as code.

d)

The smallest unit of data storage that a program can use.

70.

What numbers are included in this range call: range(2, 10, 2)

a)

2, 4, 6, 8, 10

b)

2, 4, 6, 8

c)

1, 2, 3, 4, 5, 6, 7, 8, 9

d)

2, 3, 4, 5, 6, 7, 8, 9

71.

A value that a function evaluates to.

a)

Return Value

b)

None

c)

Parameter

d)

Argument

72.

A statement used in a function to exit the function.

a)

return

b)

break

c)

exit

d)

quit

73.
What will the output be from the following code?
print("Hello world!\nHello world!")
a)
Hello world! Hello world!
b)
Hello world!
Hello world!
c)
SyntaxError
d)
Hello world!
74.
What will the output be from the following code?
print("Hello world!" * 2)
a)
TypeError
b)
Hello world world!
c)
Hello world!Hello world!
d)
Hello world! * 2
75.
To create a newline at the end of prompt, you can use which of the following expressions?
a)
\new
b)
\n
c)
\break
d)
\return
76.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
77.
What is the name of the programming language we are learning?
a)
Scratch
b)
Python
c)
Pie thin
d)
Scribble
78.
What will be the output?
name = 'Dave'
print (name)
a)
Dave
b)
'Dave'
c)
name
d)
(name)
79.
What will be the output?
name = 'Dave'
greeting = "Good morning" + name
print (greeting)
a)
Good moning 'Dave'
b)
Good morning Dave
c)
Good morning name
d)
Good morning + Dave
80.
What would print (10 + 16) produce?
a)
20
b)
22
c)
24
d)
26
81.
What is the answer to print (12/6)?
a)
1
b)
2
c)
6
d)
10
82.
How do you display text?
a)
input
b)
output
c)
print
d)
variable 
83.
<
a)
greater than
b)
less than
c)
equal to
d)
less than or equal to
84.
>
a)
less than
b)
not equal to
c)
less than or equal to
d)
greater than
85.
<=
a)
less than
b)
less than or equal to
86.
! =
a)
greater than variable
b)
less than variable
c)
equal to
d)
not equal to
87.
2 = = 3
a)
TRUE
b)
FALSE
88.
3<=4
a)
TRUE
b)
FALSE
89.
Choose the correct Python code.
Display: Welcome to the quiz!
a)
print ("Welcome to the quiz!")
b)
print (Welcome to the quiz!)
90.
Choose the correct Python code.
if age is less than 20 and greater than equal or equal to 15 then
a)
if age <20 and age >=15:
b)
if age <20>=15 :
91.

The modulo operation finds only the remainder when one number is divided by another. True or false?

a)

True

b)

False

92.
a)
5
b)
6
c)
21
d)
36
93.
a)

5

b)

6

c)

21

d)

36

94.
a)
A
b)
B
c)
C
d)
D
95.
What will the following lines of code print?
a)
A
b)
B
C
c)
A
C
d)
Nothing, it will return an error.
96.
What is another way of writing the following code? 
Score = Score + 1 
a)
Score.add(1)
b)
score + 1
c)
Score + Score
d)
Score += 1
97.
Which statement will check to see if a is equal to b?
a)
if a == b
b)
if a = b:
c)
if a != b:
d)
if a == b:
98.
What are the two main types of loops that we have learned about in Python?
a)
IF Function & Variables
b)
FOR and WHILE Loops
c)
Forever and Fixed Loop
d)
Data Types and Numbers
99.
What would amount equal in this piece of code:

amount = 2 + 5 * 2
a)
12
b)
9
c)
14
d)
5
100.
What will be printed after running this FOR loop:

for number in range(6):
 
    print(number)
a)
The number 6 
b)
The numbers 0 - 5
c)
The number 5
d)
The numbers 1 - 6
101.
How many times does the following program print the word ‘computer’:

word= "computer"  
for num in range(1,6):
 
    print(word)
a)
5
b)
6
c)
1
d)
0
102.
Look at the code below and identify which of the statements below are true:

for loopCounter in range(10,101,10):
               
     print(loopCounter)
a)
Starts at 10, goes up to 100, increases by 10
b)
Starts at 10, goes upto 101, increases by 10
c)
Starts at 1, goes upto 100, increases by 1
d)
Starts at 10, goes upto 10, increases by 10
103.
a)
5
4
3
2
1
b)
4
3
2
1
0
c)
5  4  3  2  1
d)
4  3  2  1  0
104.
A loop repeated if the condition is true / false
a)
While loop
b)
For loop
c)
Repeat loop
d)
If...else
105.
What will print?
a)
1
2
11
b)
1
2
21
c)
1
2
3
11
d)
1
2
3
21
106.
a)

hello

b)

bye

c)

5

d)

4

107.
a)

1

b)

0

c)

3

d)

6

108.
a)

bird

b)

fish

c)

bird fish cat dog

d)

cat

109.
a)

0

b)

i

c)

0 1 2

d)

0 0 0 0 0 0 0 0 0 0 0 0 0 ...

110.
a)

1

b)

i

c)

3

d)

6