NEW
Font size
WorksheetsSseamless Sseventy
Total questions: 70
Worksheet time: 35mins
What is syntax?
the word used to describe an error
the rules of the programming language
used to read information
used to output information
people = ["John", "Rob", "Bob"]
print (people[-1])
what would the output be?
John
Rob
Bob
What syntax can you use to insert a line break between strings so that they appear over multiple lines?
/
\n
\1
n
Joining elements together to make a string is called what?
Combining
Connecting
Concatenation
Stringing
Tells the interpreter that the code which follows is a function
const
int
def
while
people = ["John", "Rob", "Bob"]
print (people[1])
What would the output be?
John
Rob
Bob
What does the term 'debug' mean?
Make a calculation
Identify errors and fix them
A set of instructions
Looking at code
Python is an example of a:
text-based programming language
object orientated programming language (OOP)
language written in java script
visual-based programming language
What is the function to decide if a string only contains numbers?
isalpha()
isnumeric()
int()
string()
If you want more than one option for your code, what do you use after IF?
elif
else
ifif
Python identifies blocks of code by BEGIN and END keywords and...
guessing
aligning up the starts of lines (indentation)
capitals
Code repeated or looped until a condition has been met is called:
Sequence
Selection
Iteration
Variable
What will the output be from the following code?
print("Hello world!"*2)
TypeError
Hello world world!
Hello world!Hello world!
Hello world!*2
What is python named after
the python snake
the Monty Python TV show
the creator's pet
Code executed based on a condition being true is called:
Sequence
Selection
Iteration
Variable
What will the output be from the following code?
print("Hello" + str(2) + "world!")
Hello world! Hello world!
Hello2world!
Hello Hello world! world!
SyntaxError
What will the output be from the following code:
print("Hello world!\nHello world!")
Hello world! Hello world!
Hello world!
Hello world!
SyntaxError
Hello world!
what does the following code do?
myAge = int(myAge)
Converts the variable myAge to a string
Converts the variable myAge to an integer
Converts the variable myAge from an integer to a string
Converts the variable myAge to a statement
What is the output for:
people = ["John", "Rob", "Bob"]
print(people[4])
John
Rob
Bob
Error
What is the output from the following:
print(Hello world!)
Hello world!
SyntaxError
Hello world
print(Hello world!)
What data type would be used for storing someone's telephone numbers?
Float (using a decimal point)
Integer (just whole numbers)
String (alphanumerical data)
IF you are 70 or older, say "You are aged to perfection!" ELIF you are exactly 50, say "Wow, you are half a century old!" ELSE say "you are a spring chicken!"
What will the output be if I am 18 years old!
You are aged to perfection
You are a spring chicken
Wow, you are half a century old!
What best defines an IF statement?
It is an embedded string with a variable
it checks to see if a statement is true or false and then does one of two things depending on the result
If we needed to store a POSTCODE, what data type would we use?
string (alphanumerical)
float (decimal point)
Boolean (true or false)
The INTEGER data type can be defined as..
holds whole numbers
holds numbers with a decimal pint
holds either 'true' or 'false'
Pseudocode is:
a notation resembling a complex programming language, used in program design.
a notation resembling a simplified programming language, used in program design.
What is the definition for a VARIABLE?
a changeable value, such as a score in a computer game.
a value that cannot be changed
What is the code for a STRING?
str
stri
stg
the FLOAT data type is defined as:
holds alphanumerical data
holds whole numbers
holds a decimal point in a number
holds either true or false
the BOOLEAN data type is defined as...
holds alphanumerical data
holds whole numbers
holds a number with a decimal point
holds either true or false
the STRING data type is defined as...
holds alphanumeric text
holds whole numbers
holds numbers with a decimal point
holds either a true or false value
What is the correct code for INTEGER?
in
ing
int
IF you are 70 or older, say "You are aged to perfection!" ELIF you are exactly 50, say "Wow, you are half a century old!" ELSE say "you are a spring chicken!"
What will the output be if I am 77 years old!
You are a spring chicken!
You are aged to perfection
Wow, you are half a century old
You are very very old!
What symbol surround multi-lined comments
" " "
**
#
%
What symbol is used to create exponents (to the power of)
**
" " "
%
#
What runs code line by line and checks for errors?
interpreter
variable
modulo
boolean
What symbol is used for modulo (remainder after division)?
%
&
#
**
the correct way to write a variable is..
my_variable=10
my variable = 10
my_variable is 10
my_variable: 10
Changing the value of a variable is called:
reassigning
commenting
modulo
boolean
102 = 100 is written in code as..
10*2
10%2
10**2
10**10
A line of text that won't run in Python is called:
variable
modulo
comment
boolean
What returns the remainder from a division?
exponent
boolean
variable
modulo
This thing includes numbers and booleans:
white space
modulo
data types
comments
What stores a piece of data and gives it a specific name
white space
interpreter
modulo
variable
What name is a data type that can be only true or false:
modulo
boolean
variable
interpreter
What is used to structure code in Python?
comments
booleans
variables
white space
print("Hello world!"*2*"Hello world!")
What is the output?
Hello world! Hello world! Hello world! Hello world!
Hello Hello World! World!
Hello world! Hello world!
TypeError
print("3+4")
What is the output?
3+4
7
34
SyntaxError
print("Hello" + "world!")
what is the output?
Helloworld!
"Hello" "world!"
Hello world!
Hello+world!
print(9/3*2+4-5)
19
5.0
0.5
5
Which command is used to output information to the screen?
read
output
display
print("Hello" + str(2) + "world!")
Hello world! Hello world!
Hello2world
Hello Hello world! world!
SyntaxError
print(3*4)
What is the output?
34
7
12
3*4
print("Hello" + "world" + "today")
Hello world today
"Hello" "world" "today"
Helloworldtoday
SnytaxError
print("Hello" + 2 + "world")
Hello2world
Hello2world
TypeError
HelloHelloworld
print("Hello world!\nHello world!")
Hello world! Hello world!
Hello world!
Hello world!
SyntaxError
Hello world!
print(Hello world!)
What is the output?
Hello world!
SyntaxError
Hello world
print(Hello world!)
print(9/3)
3
3.0
9/3
SyntaxError
Which one of these would work as a piece of code?
IF answer=="Yes"
if answer=="Yes"
if answer=="Yes":
if answer="yes"
To solve a problem that requires the user to enter 10 numbers would use what type of iteration?
While loop
For loop
Variable
Selection
The second part of if (that is executed when the condition is false) is:
if
else
for
input
The character that must be at the end of the line for if, while, for etc is:
;
.
,
:
A data type consisting of numbers, letters and symbols is:
Integer
String
Float
Boolean
What is code that is executed based on a condition being true called?
Sequence
Selection
Iteration
Variable
What is the name for repeating until a particular condition is true called:
for loop
if loop
while loop
indentation
In Python, blocks of code are identified by:
BEGIN and END
{and}
aligning up the starts of lines
guessing
Converts a number to a string:
int()
parseInt()
convert
str()
How do you correctly format a comment?
!Comment
&Comment
""Comment""
#Comment
Which data type is for whole numbers?
string
Integer
boolean
float
Which do you need for repeating until a particular condition is true:
while loop
for loop
if loop
indentation
