Worksheetspython
Total questions: 40
Worksheet time: 20mins
Which kind of loop would be used?
I need a program that will keep letting me add money to a piggy bank until I get to £100.
FOR Loop
WHILE Loop
print("3+4")
Which data type stores whole numbers?
Float
String
Integer
Char
Choose the correct code
print("Hello World")
PRINT(Hello World)
Print("Hello World")
Print"Hello world"
name = 'Dave'
print (name)
Which is the Python logo?
What is an input?
A command that allows us to ask the user to enter some data.
To plug in something.
Data displayed on a screen.
A function
What is an output?
A piece of data that is shown on the screen.
Data that the user enters
An output
A orange
To display the following on screen
Hello World!
the following command should be used:
print(Hello World!)
print("Hello World!")
print("Hello World" + !)
print"(Hello World!)"
x = 5
y = 6
print("x*y")
The code above displays the following:
11
x*y
Syntax Error
30
Which operator checks if a value is not equal to another value?
==
+=
!=
=
name = "Bob"
if name == "Bob":
print ("Hello " + name)
else:
print ("I dont know you")
What is the white space used to enter code called?
Whitespace
IDOL
Shell
IDLE
REPEAT loops can only be used when:
The integers in a calculation aren't decimal
The data to be repeated is in hexadecimal
They don't exist in python
Dealing with named variables
What is a programming language?
Written English
An artificial language used to program a computer
A language used in pseudocode
Machine code
What is a program?
A series of a step-by-step instructions that tell a computer how to solve a task
A video that is watched on a computer
A flowchart written on a computer
The make and model of a computer
You assign a value to a variable with which symbol
@
==
=
*
A string
carries out an action
the elements of a command
a collection of characters
how elements in a commad are arranged
________ is a container for storing data.
Comment
Variable
Casting
None
Is variable name case sensitive?
Yes
No
What is the syntax error with this code:
print”Hello World”
No brackets around "Hello World"
Speech marks are not needed
Colon is not needed
print is spelt incorrectly
Print has a capital P
What is the syntax error with this code:
print(“Hello World”);
No brackets around "Hello World"
Speech marks are not needed
Colon is not needed
print is spelt incorrectly
Print has a capital P
What is the syntax error with this code:
Print(“Hello World”)
No brackets around "Hello World"
Speech marks are not needed
Colon is not needed
print is spelt incorrectly
Print has a capital P
What is the syntax error with this code:
prin(Hello World)
No brackets around "Hello World"
Speech marks are not needed
Colon is not needed
print is spelt incorrectly
Print has a capital P
When you run this program what will this line of code do?
name = input("Enter your name: ")
Ask you to Enter your name and save your answer to Google Drive
Ask you to Enter your name and save your answer to My Documents
Ask you to Enter your name
Ask you to Enter your name and save your answer as a variable
The word 'Tuesday' is which data type?
String
Real/Decimal/Float
Integer
Boolean
Char
The number 45 is what data type?
String
Real/Decimal/Float
Integer
Boolean
Char
number1 = 15
number2 = 10
total = number1 + number2
What is total?
15
10
25
1510
What if the colour entered is red?
colour = input(“Enter the trafficlight colour”)
if colour == “Red”:
print “Stop”
else:
print “Go”
Stop appears on screen
Go appears on screen
Get Ready appears on screen
What if the colour entered is NOT red?
colour = input(“Enter the trafficlight colour”)
if colour == “Red”:
print “Stop”
else:
print “Go”
Stop appears on screen
Go appears on screen
Get Ready appears on screen
All keyword in python are in
lower case
upper case
lower case and uppercase
None of the above
print(Hello world!)
What is used for a repetitive task in python?
Loop
List
Data Structure
Boomerang
Do you think indentation in your code is important?
Yes
No
How do we print a statement in python?
print_(x)
print.x
print.(x)
print(x)
What would the output of this calculation be?
print(5*3)
SyntaxError
5*3
(5*3)
15
What will the following code print?
firstName = "John"
surname = "Smith"
print("Hello, my name is " + firstName + surname)
SyntaxError
"Hello, my name is John Smith"
Hello, my name is John Smith
Hello my name is + firstName + surname
What will happen if the following code is run?
name = input("Please enter your name: ")
It will put a name in the code
It will not display anything as there is no print line
It will display an input box so the user can enter their name
It will store a value in the name variable
