wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Introduction to Python

Total questions: 25

Worksheet time: 4mins

Name
Class
Date
1.
What kind of programming language is Python?
a)
High Level  & Object Orientated
b)
Low Level & Object Orientated
c)
High Level & Procedural
d)
Low Level & Procedural
2.
How would would you print a text string?
a)
output "Hello!"
b)
print "Hello!"
c)
print (Hello!)
d)
output (Hello!)
3.
How would you assign an integer to a variable?
a)
new_var = 4
b)
new_var == 4
c)
new_var = "4"
d)
new var "4"
4.
What are the 4 main datatypes used in python?
a)
Text, Image, Boolean & Number
b)
Number, String, Text & Boolean
c)
String, Integer, Float & Boolean
d)
Text, String, Integer & Float
5.
Changing the value of a variable e.g. from new_var = 5 to new_var = 10 is called?
a)
Reassignment
b)
Switching
c)
Initiating
d)
Re-initiating 
6.
The variable new_var = 7.  To print the value of new_var, which statement would you use?
a)
output "new_var"
b)
print new_var
c)
print "new_var"
d)
output "7"
7.
Your code will not work unless you indent and format code properly.  Another word used for indenting is..?
a)
whitespace
b)
alignment
c)
assignment
d)
initiation
8.
What do we call the window where you type your code?
a)
The Editor
b)
The Data Entry Screen 
c)
The Code Area
d)
The Statement Window
9.
The window where the output of our code appears is called either the console or the..?
a)
Interface
b)
Print Screen
c)
Compiler
d)
Interpreter
10.
Which symbol do we use if we want to add a comment to our code?
a)
@
b)
#
c)
*
d)
&
11.
Which of the following is a multi-line comment?
a)
"""Multi-line Comment Here"""
b)
""Multi-line Comment Here""
c)
"Multi-line Comment Here"
d)
'Multi-line Comment Here'
12.
To create a variable named new_var and assign it a value of 81 divided by 9, which statement would you use?
a)
new_var = 81 \ 9
b)
new_var = "81 / 9"
c)
new_var = "81 \ 9"
d)
new_var = 81 / 9
13.
Choose the statement that assigns 4 to the power of 3 to the variable new_var...
a)
new_var = 4 ** 3
b)
new_var = 3 ** 4
c)
new var = 3 ** 4
d)
new_var = 4 ^^ 3
14.
Which of the following statements would return the value 2?
a)
new_var = 8 % 3
b)
new_var = 4 % 2
c)
new_var = 10 ** 2
d)
new_var = "4 % 2"
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.
Which of the following text strings is correct?
a)
new_var = "Tim/'s Computer"
b)
new_var = "Tim\'s Computer"
c)
new_var = "Tim's Computer"
d)
new_var = Tim's Computer
18.
How would we assign the first letter of a text string to a variable?
a)
new_var = "School"[0]
b)
new_var = "School"[1]
c)
new_var = "School"(0)
d)
new_var = "School"(1)
19.
How would you assign the value of "n" to new_var?
a)
new_var = "Python"[6]
b)
new_var = "Python"(5)
c)
new_var = "Python"(6)
d)
new_var = "Python"[5]
20.
How would you output the number of characters in the string "Python", where new_var = "Python"?
a)
print len(new_var)
b)
print len(Python)
c)
print len("new_var")
d)
print length(new_var)
21.
How would you convert "YES" to lower case?
a)
"YES".lower()
b)
lower"YES"
c)
lower.("YES")
d)
("YES").lower
22.
How would you output the variable new_var = "python" to uppercase?
a)
print new_var.upper()
b)
print (new_var).upper
c)
print new_var.upper[]
d)
print new_var(upper)
23.
How would you output new_var = 123 as a text string?
a)
print str(new_var)
b)
print new_var.str
c)
print str[new_var]
d)
print (new_var).str()
24.
What is the name for a variable that can hold more than one value?
a)
Array
b)
Condition
c)
Loop
d)
Object
25.
To use features built into the language such as datetime we need to import a..?
a)
Library
b)
Element
c)
Object
d)
Class