NEW
Font size
WorksheetsPython All
Total questions: 53
Worksheet time: 37mins
Which of the following defined variables is a string?
cool_variable_1
cool_variable_2
cool_variable_3
cool_variable_4
Which function outputs text to the terminal?
print()
write()
type()
output()
Which of the following will produce a SyntaxError?
What is the output of the following code?
210
42
cool_number
What happens when you call report?
Two Strings are printed: "The current time is " and "The mood is "
One String is printed: "The current time is 3pm"
Two Strings are printed: "The current time is 3pm" and "The mood is good"
Three Strings are printed: "The current time is 3pm", "The mood is good", and "End of report"
How do you call a function called setup with no arguments?
setup()
setup(None)
def setup():
setup
How do you call update with a new_value of 20?
def update(20)
update(20)
update
update()
Which of the following variables contains a Boolean value?
Determine the truth value of the following expressions:
A: False
B: True
A: False
B: False
A: True
B: True
A: True
B: False
Guess the output:
i = 4
while i < 9:
print(i)
i = i+2
5, 7, 9
4, 6, 8
4, 7, 9
Error
Improper tab placement will prevent a block of code from running properly.
True
False
Improper tab placement will prevent a block of code from running properly.
True
False
name = 'Dave'
print (name)
What is a input?
A function that allows us to ask the user to enter some data.
To plug in something.
Data displayed on a screen.
A function
What is a output?
A piece of data that is shown on the screen.
Data that the user enters
An output
A orange
What syntax would you use to create a name variable?
name=input()
input=name
name=input{}
name=INPUT
What is the proper syntax for Python comments?
<!-- Python comment -->
<comment> Python comment <comment>
# Python Comment
/* Python Comment */
If Python were to get into a fight with JavaScript, who would win?
Python
JavaScript
A foreign language
Which operator checks if a value is equal to another value?
+
=
==
!=
Which of these is true?
A syntax error will stop a program running
A logic error will stop a program running
A syntax error will let the program run but may have unexpected outcomes
The program will always show an error message for a logic error
name = 'Dave'
print (name)
Which of these is true?
A syntax error will stop a program running
A logic error will stop a program running
A syntax error will let the program run but may have unexpected outcomes
The program will always show an error message for a logic error
age = input()
Fill in the blank to correctly output the sentence:
print("You are " + ________ + " years old")
age
str(age)
int(age)
"age"
What is the syntax error?
No parentheses around age <=18
else should say elif
else is missing a colon :
else should be indented
What symbol is used to join strings together?
%
+
*
What function do you use to to find the length of the string?
len()
float()
.upper()
.lower()
What is a Count-Controlled loop?
for loop
while loop
How many lines will this code print?
x = 10
while x > 0:
print(x)
x = x - 3
5
2
3
4
integers are...
algebra
your age
whole numbers including negatives
imaginary
in Python the subtraction sign is...
-
:
/
>
In Python the multiplication sign is...
*
%
.
'
Syntax is...
an error
a coding language that explains Python what to do
rules we follow in building sentences
ways to express yourself
How do you define(assign) variables?
var="String"
func==Hello
var : 123
word= Hello
Division by zero is an example of what type of error?
Syntax Error
Run-time Error
Semantic Error
Improper indentation is an example of what type of error?
Syntax Error
Run-time Error
Semantic Error
The following is an example of what type of error?
print("Here is some text")
print(1/0)
Syntax Error
Run-time Error
Semantic Error
What does print("hello) display?
hello
gives you an error
"hello"
"hello
A string does not have to be enclosed with quotation marks.
True
False
