wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Programming

Total questions: 20

Worksheet time: 12mins

Name
Class
Date
1.
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
2.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
3.

Which of the following is an advantage of using local variables?

a)

They allow the variable to be used throughout the whole program

b)

They allow variable identifiers to be reused each time

c)

They are easier to program than global variables

d)

A wider range of data types can be used

4.

What term is used to describe data passed into/out of a program?

a)

Variable

b)

Loop

c)

Constant

d)

Parameter

5.

What term is used to describe data passed into/out of a program?

a)

Variable

b)

Loop

c)

Constant

d)

Parameter

6.

Leo wants to create a subroutine that will roll a dice. Which syntax is correct?

a)

def dice roll ():

b)

def diceroll ()

c)

def diceroll ():

d)

def diceroll []:

7.

What would the output be from the program shown here? (assuming that the user enters "John" and "Smith"

a)

John

b)

Smith

c)

John Smith

d)

Error

8.
what is 8%2
a)
0
b)
16
c)
24
d)
86
9.
Code executed based on a condition being true
a)
Sequence
b)
Selection
c)
Iteration
d)
Variable
10.

What does the following code do? myAge = int (myAge)

a)

Converts the var (variable) myAge to a string

b)

Converts the var (variable) myAge to a integer

c)

Converts the var (variable) myAge from a integer to a string

d)

Converts the var (variable) myAge to if statement

11.

How do we get user input from the keyboard?

a)

input = (What is your name?)

b)

input = What is your name?

c)

output = ("What is your name?")

d)

input("What is your name? ")

12.

Which data type is the most suited to store a telephone number in a variable?

a)

string

b)

integer

c)

float

d)

boolean

13.

Which data type would you use for the quantity of stock in a shop?

a)

integer

b)

float

c)

string

d)

boolean

14.
Which two statements are used to implement iteration?
a)
IF and WHILE
b)
ELSE and WHILE
c)
FOR and WHILE
d)
IF and ELSE
15.

A condition is

a)

a statement that is either True or False

b)

a string

c)

an integer

d)

a list

16.

Which kind of loop would be used?


I need a program that will keep letting me add money to a piggy bank until I get to £100.

a)

FOR Loop

b)

WHILE Loop

17.
Converts a number to a string
a)
str()
b)
int()
c)
parseInt()
d)
convert
18.
a data type than can have one of two values: True or False
a)
boolean
b)
variable
c)
modulo
d)
interpreter
19.

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

print (people[1])

what would this result be?

a)
John
b)
Rob
c)
Bob
20.

List items have an index number. In the following list, which item has the index number of 3?

["John", "Harry", "Jesse", "John", "Jeremy", "Tom"]

a)

"John"

b)

"Harry"

c)

"Jesse"

d)

"Jeremy"