wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Basics v1.0 ( Medvedev School )

Total questions: 30

Worksheet time: 18mins

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 Python command lets the user enter an answer to a question?
a)
answer()
b)
open()
c)
print()
d)
input()
6.
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")
7.
What is the name of the environment in Python that write your programs and then test them out?
a)
Shell
b)
Window
c)
IDLE
d)
CLI
8.
What extension must you add to the end of a file when saving?
a)
.xlsx
b)
.pptx
c)
.docx
d)
.py
9.
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
10.
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.
11.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
12.
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
13.

Python is _____ sensitive which means you must use the same indentation every time.

a)

space

b)

colour

c)

code

d)

word

14.
What will the output be from the following code?
print(3*4+5)
a)
27
b)
17
c)
12
d)
SyntaxError
15.
What is the correct definition for a VARIABLE?
a)
a changeable value, such as a score in a computer game.
b)
a value that cannot be changed
16.

Python uses indentation to block code into chunks

a)

True

b)

False

17.

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

18.

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

a)

"num1 + num2"

b)

1520

c)

35

19.

Which one will display when this code is run?

a)
b)
c)
d)
20.
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
21.
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 
22.

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

23.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
24.
Tells the interpreter that the code which follows is a function
a)
const
b)
int
c)
def
d)
while
25.
Joining elements together to make a string is called what?
a)
Combining
b)
Connecting
c)
Concatenation
d)
Stringing
26.
If you want more than one option for your code, what do you use (after if)?
a)
elif
b)
else
c)
ifif
27.

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

print (people[1])

what would this result be?

a)
John
b)
Rob
c)
Bob
28.

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

print (people[-1])

what would this result be?

a)
John
b)
Rob
c)
Bob
29.

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

print (people[4])

what would this result be?

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

Choose the correct Python keywords

a)

if

b)

why not

c)

else

d)

elseif

e)

maybe