wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Basic Test 01

Total questions: 70

Worksheet time: 39mins

Name
Class
Date
1.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
2.
What is a variable?
a)
A box(memory location) where you store values
b)
a type of graphics
c)
Data type
d)
a type of memory
3.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
4.

What will be the output?

name = "Dave"

print (name)

a)

Dave

b)

'Dave'

c)

name

d)

(name)

5.
What is Python?
a)
text based programming language
b)
word processor 
c)
spreadsheet
d)
block based programming language
6.
What Python command lets the user enter an answer to a question?
a)
answer()
b)
open()
c)
print()
d)
input()
7.
Which statement correctly assigns the string "Tanner" to the variable name?
a)
name  = print( "Tanner")
b)
input("Tanner")
c)
name = "Tanner"
d)
name = input("Tanner")
8.

Is python an interpreter or compiler programming language?

a)

Compiler

b)

Interpreter

9.

Python is uses braces to block off code

a)

True

b)

False

10.

Python uses indentation to block code into chunks

a)

True

b)

False

11.

What output will the console show, if 15 and 30 are entered by the user?

a)

Syntax error

b)

The sum of the two numbers - 45

c)

The concatenation of the two numbers - 1530

d)

Complier error

12.

What result will display in the shell if 15 and 20 is entered by the user?

a)

"num1 + num2"

b)

1520

c)

35

13.

What datatype will the answer be if the user enters 15 and 30?

a)

Integer

b)

String

c)

Boolean

d)

Float

14.
What extension must you add to the end of a file when saving?
a)
.xlsx
b)
.pptx
c)
.docx
d)
.py
15.
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.
16.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
17.
What syntax can you use to insert a line break between strings so that they appear over multiple lines?
a)
/
b)
\n
c)
\l
d)
n
18.
The number or word we give to a variable
a)
Value
b)
Bug
c)
Information
d)
Text
19.

What is the Python built-in function used to display numbers and text on the screen?

a)

print

b)

input

c)

output

d)

command

20.

What will the output be from the following code?

print(3+4)

a)

3+4

b)

7

c)

SyntaxError

d)

print(3+4)

21.
print("12"*3)
What would this print?
a)
36
b)
121212
c)
24
d)
12*3
22.

What will the output be from the following Python 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 Python code?

print(9/3)

a)

3

b)

3.0

c)

9/3

d)

SyntaxError

24.

What will the output be from the following Python code?

print(Hello world!)

a)

Hello world!

b)

SyntaxError

c)

Hello world

d)

print(Hello world!)

25.
A location in memory used to store data that can be changed.
a)
Constant
b)
Value
c)
Variable
d)
Iteration
26.
The correct way to write a variable in Python?
a)
my_variable = 10
b)
my variable = 10
c)
my_variable is 10
d)
my_variable: 10
27.

Which of these is correct Python conditional statement?

a)

IF answer == "Yes":

b)

if answer == "Yes"

c)

if answer == "Yes":

d)

if answer = "yes":

28.
In python the ' STRING data type' can be defined as...?
a)
holds alphanumeric text
b)
hold whole numbers
c)
holds numbers with a decimal point
d)
holds either a true or false value
29.
In python the ' INTEGER data type' can be defined as...?
a)
holds alphanumeric data as text
b)
holds whole numbers
c)
holds numbers with a decimal point
d)
holds either ‘true’ or ‘false’
30.
In python the ' FLOAT data type' can be defined as...?
a)
holds alphanumerical data
b)

holds whole numbers

c)

holds a decimal point in a number

d)
hold either true or false
31.
In python the ' BOOLEAN data type' can be defined as...?
a)
holds alphanumerical data
b)
holds whole numbers
c)
holds a number with a decimal point
d)
holds either true or false
32.
If we needed to store information such as a POSTCODE in PYTHON, what data type would we use?
a)
String (alphanumerical)
b)
Float (decimal point)
c)
Boolean (true or false)
33.
what is correct code for INTEGER in python?
a)
in
b)
ing
c)
int
34.
What is the output from the following code?print ("hello world")
a)
Hello World
b)
hello world
c)
print hello world
35.
What best defines an IF statement in python?
a)
Is an embedded string with a variable
b)
An IF statement checks to see if a statement is true or false and then does one of two things depending on the result.
36.

If i want to continuously check for a correct answer, what loop would i use?

a)

for loop

b)

while loop

37.

A condition controlled loop is...

a)

A while loop

b)

A for loop

38.

How do you define(assign) variables?

a)

var="String"

b)

func==Hello

c)

var : 123

d)

word= Hello

39.

A line of text that Python won't try to run as code

a)

Integer

b)

Comment

c)

Strings

d)

Input

40.

A data type than can have one of two values: True or False

a)

Boolean

b)

Basic Calculation

c)

For

d)

While

41.

Data type for a whole number

a)

Float

b)

Boolean

c)

Integer

d)

String

42.

A Python data type that holds positive and negative whole numbers

a)

String

b)

int

c)

str

d)

input

43.

The Boolean operator that returns true if EITHER of its operands are true

a)

and

b)

or

c)

not

d)

equal

44.

// means:

a)

two times division

b)

integer division

c)

exact division with floating number

d)

Put a slash

45.

What does symbol % do?

a)

Integer exact division

b)

Percentage

c)

Division

d)

Remainder

46.

What does "\t " make?

a)

Goes to next line

b)

Horizontal space between two strings

c)

Give a title

d)

Add a slash

47.

In programming, what is iteration?

a)

The repetition of steps within a program

b)

The order in which instructions are carried out

c)

A decision point in a program

d)

Testing a program to make sure it works

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

Which type of loop iterates until instructed otherwise?

a)

FOR loop

b)

WHILE loop

50.

WHILE loops are

a)

loops which run an unknown number of times

b)

loops which run for a specific number of times

c)

the same as if statements

d)

not part of programming

51.

A condition is

a)

a statement that is either True or False

b)

a string

c)

an integer

d)

a list

52.

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

53.

Which kind of loop would be used?


I need a program that will keep letting me add a monthly payment for 12 months.

a)

FOR Loop

b)

WHILE Loop

54.

Which kind of loop would be used?


I need a guessing game program that will let me keep guessing until I get the right answer.

a)

FOR Loop

b)

WHILE Loop

55.

Which kind of loop would be used?


I need a revision program that will run through revision questions 4 times.

a)

FOR Loop

b)

WHILE Loop

56.
The second part of if, that is executed when the condition is false
a)
if
b)
else
c)
for
d)
input
57.
The character that must be at the end of the line for if, while, for etc.
a)
:
b)
;
c)
.
d)
,
58.
Python identifies blocks of code by
a)
BEGIN and END keywords
b)
{ and }
c)
aligning up the starts of lines (indentation)
d)
guessing
59.
What will the output be from the following code?
print("3+4")
a)
7
b)
3+4
c)
34
d)
SyntaxError
60.
What will the output be from the following code?
print(3*4)
a)
34
b)
7
c)
12
d)
3*4
61.
What will the output be from the following code?
print(3*4+5)
a)
27
b)
17
c)
12
d)
SyntaxError
62.
What will the output be from the following code?
print("3*4+5")
a)
SyntaxErrror
b)
17
c)
3*4+5
d)
12
63.
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
64.
What will the output be from the following code?
print("Hello" + "world!")
a)
Hello world!
b)
Helloworld!
c)
SyntaxError
d)
"Hello" "world!"
65.
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
66.
What will the output be from the following code?
print("Hello" + 2 + "world")
a)
Hello 2 world
b)
Hello2world
c)
TypeError
d)
HelloHelloworld
67.
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
68.
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!
69.
Joining elements together to make a string is called what?
a)
Combining
b)
Connecting
c)
Concatenation
d)
Stringing
70.
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