Font size
WorksheetsPython Assessment
Total questions: 31
Worksheet time: 22mins
Code for Hello, World!
print Hello, World!
print("Hello, World!)
print("Hello, World!")
Code for
Five is greater than two!
if 5 > 2:
print("Five is greater than two!")
if 5 = 2:
print("Five is greater than two!")
if 5 > 2: Print("Five is greater than two!")
The output of the program
x = 4
x = "Sally"
print(x)
four
Saly
Sally
people = ["John", "Rob", "Bob"]
print (people[1])
what would this result be?
print("Hello" + str(2) + "world!")
print("Hello world!\nHello world!")
Hello world!
people = ["John", "Rob", "Bob"]
print (people[-1])
what would this result be?
What would be the output of this program if the user entered "yes" then "what"?
Enjoy your day
it is too windy for an umbrella
Take an umbrella
Error
What type of list is being used in this example?
Dictionary
List
Tuple
2d Array
What would be the output of this program if the user input was 10?
22.04
220.4
2204
Error wrong data type
How many variables are there in this program?
2
3
4
5
Which of the following statements is true?
Python is a high level programming language.
Python is an interpreted language.
Python is an object-oriented language.
Python is found in Amazon forest.
What will be the output of the following Python code?
def cube(x):
return x * x * x
x = cube(3)
print (x)
9
3
27
30
What is the correct order of the following?
if
elif
else
if
elif
else
elif
if
else
elif
else
if
Which keyword is used for an infinite loop or ITERATION?
else
if answer == "right":
while True:
elif
There is a mistake on line 1 of this program. Write the instructions with the corrections.
Be careful with spaces when writing your answer or the quiz will not recognise your answer!
(a)
A Python dictionary stores ...
value - key pairs
key - value pairs
You have the following dictionary definition:
d = {'foo': 100, 'bar': 200, 'baz': 300}
What method call will delete the entry whose value is 200?
delete d('bar')
d.pop("bar")
d.remove("bar")
None of the above
What would be the output of the following code snippet?
a_dict = {'color': 'blue', 'fruit': 'apple', 'pet': 'dog'}
d_items = a_dict.items()
print(d_items)
('color', 'blue'), ('fruit', 'apple'), ('pet', 'dog')
dict_items([('color'), ('fruit'), ('pet')])
[('color', 'blue'), ('fruit', 'apple'), ('pet', 'dog')]
dict_items([('color', 'blue'), ('fruit', 'apple'), ('pet', 'dog')])
Select the correct answer:
x = 15
y = 4
print(x // y)
3
3.75
4
5
variable.sort() will do what?
Sort the list into alphabetical order
Sort the list into reverse order
Create a new list
Error
What is the output of program below?
mariana_islands = ['Saipan', 'Tinian', 'Rota']
mariana_islands.remove('Tinian')
print(mariana_islands)
['Saipan', 'Tinian', 'Rota']
['Tinian', 'Rota']
['Saipan', 'Tinian']
['Saipan', 'Rota']
What is the output of program below?
mariana_islands = ['Saipan', 'Tinian', 'Rota', 'Guam']
mariana_islands.sort()
print(mariana_islands)
['Tinian', 'Saipan', 'Rota', 'Guam']
['Guam', 'Tinian', 'Rota', 'Saipan']
['Saipan', 'Rota', 'Guam', 'Tinian']
['Guam', 'Rota', 'Saipan', 'Tinian']
What is the default return value for a function that does not return a value explicitly?
None
int
double
null
Pick one from the following statements to correctly complete the function body to get the output 5 in the given code snippet:
def f(number):
#missing function body
print(f(5))
return "number"
print(number)
print("number")
return number
What will this code do?
Print Numbers 1-11
Print Numbers 1-10
Print Numbers 2-10
Print Error
It has been an honour taking you through the Python programming Journey.
All the best in your path. Continue practicing to even get better.
Have a good one 💫
By Ms Edith.
This is a section for you to write feedback.
