NEW
Font size
S
M
L
XL
Worksheetspython basics
Total questions: 15
Worksheet time: 8mins
Name
Class
Date
1.
Which of the following is a correctly-formatted comment?
a)
#Comment
b)
&Comment
c)
""Comment""
d)
!Comment
2.
stores a piece of data, and gives it a specific name
a)
variable
b)
whitespace
c)
interpreter
d)
modulo
3.
a line of text that Python won't try to run as code
a)
comment
b)
modulo
c)
variable
d)
boolean
4.
a data type than can have one of two values: True or False
a)
boolean
b)
variable
c)
modulo
d)
interpreter
5.
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
6.
A data type consisting of numbers, letters and symbols.
a)
String
b)
Integer
c)
Float
d)
Boolean
7.
Data type for a whole number
a)
String
b)
Integer
c)
Boolean
d)
Float
8.
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
9.
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
10.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
11.
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
12.
What will be the output?
name = 'Dave'
print (name)
name = 'Dave'
print (name)
a)
Dave
b)
'Dave'
c)
name
d)
(name)
13.
What would print (10 + 16) produce?
a)
20
b)
22
c)
24
d)
26
14.
.
What will be the datatype of the var in the below code snippet?
var = 10 print(type(var))
var = "Hello" print(type(var))
a)
str and int
b)
int and int
c)
str and str
d)
int and str
15.
What is the correct extension for python files ?
a)
.py
b)
.pyth
c)
.python
Reset
