wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Basics

Total questions: 23

Worksheet time: 11mins

Name
Class
Date
1.

To display something on the screen, use this command:

a)

print()

b)

Print()

c)

screen()

d)

write()

e)

display()

2.

To display the following on screen

Hello World!

the following command should be used:

a)

print(Hello World!)

b)

print("Hello World!")

c)

print("Hello World" + !)

d)

print"(Hello World!)"

3.
Which symbol do we use if we want to add a comment to our code?
a)
@
b)
#
c)
*
d)
&
4.
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
5.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
6.
What will be the output?
name = 'Dave'
print (name)
a)
Dave
b)
'Dave'
c)
name
d)
(name)
7.

Which operator performs a division?

a)

-

b)

+

c)

/

d)

*

8.

Which operator checks if a value is equal to another value?

a)

+

b)

=

c)

==

d)

!=

9.

Which operator checks if a value is not equal to another value?

a)

==

b)

+=

c)

!=

d)

=

10.
If you want more than one option for your code, what do you use (after if)?
a)
elif
b)
else
c)
ifif
11.
The character that must be at the end of the line for if, while, for etc.
a)
:
b)
;
c)
.
d)
,
12.
Converts a number to a string
a)
str()
b)
int()
c)
parseInt()
d)
convert
13.
a data type than can have one of two values: True or False
a)
boolean
b)
variable
c)
modulo
d)
interpreter
14.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
15.
Which of the following is a float?
a)
new_var = 1234
b)
new_var = True
c)
new_var = 1.234
d)
new_var = "True"
16.
Which of the following is not a string?
a)
new_var = "True"
b)
new_var = "3123"
c)
new_var = "3.123"
d)
new_var = False
17.
Numbers with a decimal point belong to a type called...
a)
pointing
b)
integers
c)
decimal
d)
float
18.
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
19.
Why is it called 'Python'?
a)
The guy who created it loves snakes
b)
The guy who created it loves Monty Python films
c)
You can create a game on python called snake
d)
It was created by someone called Mr Python
20.
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
21.

Which of the following is correct?

a)

Comments are for programmers for better understanding of the program.

b)

Python Interpreter ignores comment.

c)

You can write multi-line comments in Python using triple quotes, either ''' or """.

d)

All of the above

22.

In the following code, n is a/an _______?


n = '5'

a)

integer

b)

string

c)

tuple

d)

operator

23.

What is used to take input from the user in Python?

a)

cin

b)

scanf()

c)

input()

d)

<>