wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Programming Concepts Quiz

Total questions: 35

Worksheet time: 28mins

Name
Class
Date
1.

Why is collaboration important in programming?

a)

To work with project stakeholders and understand functionality needs

b)

To create well-named variables and procedures

c)

To use procedures/functions rather than duplicating code

d)

To identify syntax errors and correct them

2.

What is the purpose of debugging in programming?

a)

To create a clear understanding of the issues to solve

b)

To trace through a program and understand its purpose

c)

To troubleshoot and fix errors in the code

d)

To ensure all features work in the way the user needs

3.

What is an algorithm in programming?

a)

A collection of items

b)

A computer procedure that tells your computer what steps to take to solve a problem

c)

A placeholder for values a program needs to use

d)

A text field denoted by quotation marks around the field

4.

What is a list in programming?

a)

The position of the items in a collection

b)

The number of elements in a collection

c)

A loop that iterates through each element in a collection

d)

A collection of numbers, words, phrases, or a combination of these

5.

In this code, what is the "i"

a)

a while loop

b)

a variable

c)

iteration

d)

a loop

e)

random letter

6.

What will this code output?

a)

nothing at all

b)

dude

c)

dude, 4 times

d)

dude, 6 times

e)

dude, 3 times

7.

In this code, what is "range"?

a)

a function

b)

a variable

c)

iteration

d)

a loop

e)

selection

8.

In this code, what is "for"?

a)

a function

b)

sequence

c)

iteration

d)

a while loop

e)

selection

9.

In this code, how would the code need to be changed, to print "dude" 10 times?

a)

change the "dude", to a 10

b)

change the 4, to a 10

c)

change the for, to a while

d)

change the 4, to an 11

e)

change the print to an input()

10.

What will be displayed?

a)

1,2,3,4

b)

2,3,4,5

c)

1,1,1,1

d)

1,2,3

e)

0,1,2,3

11.

what does int mean?

a)

whole number

b)

single character

c)

True or False

d)

A decimal

e)

collection of characters

12.

What value will "num" start with when the code is run?

a)

0

b)

1

c)

10

d)

2

e)

Whatever is input from the user

13.

Correct this line of code

input=num

(a)  

14.

Correct this line of code.

Vote_Age=>18

(a)  

15.
The second part of if, that is executed when the condition is false
a)
if
b)
else
c)
for
d)
input
16.
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:
17.

What is the output?

a)

more than 7

b)

more than 23

c)

spam

d)

7

18.

Pieces of code that only run "under certain conditions":

a)

conditional statements

b)

control flow statments

c)

syntax

d)

variables

19.

Which symbol means "not equal to"?

a)

==

b)

<=

c)

>=

d)

!=

20.

What is the output?

a)

True

b)

False

c)

condition1

d)

condition2

21.

What will be displayed at the end of the program?

a)

Case 1

b)

Case 2

c)

Nothing will be displayed.

d)

Case 1 and Case 2

22.

What will display at the end of the program running?

a)

You can ride the carousel!

b)

Nothing will display

c)

You cannot ride the carousel!

d)

There will be an error.

23.

What is the name of the function?

4 lines
24.
What will print?
a)
nothing
b)
5
c)
6
d)
an error message
25.

Which of the following is the correct code to define a function?

a)

def area ( ):

b)

area ( )

c)

def area:

d)

def area ( )

26.

How do you identify the statements that belong to the body of a function?

a)

Indent those statement the same amount underneath the function "def" statement

b)

Add opening and closing curly braces { and } to mark the start and stop of the function body

c)

Add the "def" keyword to the beginning of each statement

d)

Add the same comment (#) to the right of each statement within the body

27.

If a function named "mystery" is defined as taking no parameters, how would you call that function from your code?

a)

#mystery

b)

mystery[]

c)

mystery()

d)

mystery

28.

Which of the following is NOT a Python rule for naming functions?

a)

Functions names can contain letters, numbers and underscores

b)

Function names must be less than 32 characters

c)

The first character in a function name cannot be a number

d)

Function names are case-sensitive

29.

If X is odd and Y is even, then X must have a greater value than Y. Which example(s) support this statement?

a)

X = 3, Y = 2

b)

X = 4, Y = 3

c)

X = 11, Y = 12

d)

X = 2, Y = 2

30.
Which two statements are used to implement iteration?
a)
IF and WHILE
b)
ELSE and WHILE
c)
FOR and WHILE
d)
IF and ELSE
31.
Which type of loop iterates until instructed otherwise?
a)
FOR loop
b)
A count-controlled loop
c)
Repeat-once loop
d)
WHILE loop
32.
The condition for a while loop to continue could include which of the following?
a)
While something equals something
b)
While something is greater than something
c)
While something is True
d)
All of these
33.
Which of the following symbols is used in Python to mean "Greater than or equal to"?
a)
<=
b)
>>
c)
>=
d)
=>
34.
a)
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
(repeated continuously)
b)
Hello world!
c)
Hello world!
break              
d)
Error
35.
Which of the following symbols is used in Python to mean "Less than or equal to"?
a)
<<
b)
=<
c)
<=
d)
!=