This Comp150 Python Exam 2009 tests knowledge of Python programming. It covers syntax, basic types, and function calls, assessing the ability to interpret code outputs and understand Python's structural rules. Suitable for learners seeking to evaluate their Python skills.
Bool
Float
List
Variable
They are all basic types
Rate this question:
X, y and z
W, x and y
W, y and z
W, y and z
All of w, x, y and z
Rate this question:
W and x
W and y
W and z
X and y
X and z
A module.
A special Python file where all the keywords are defined.
A type, like a list, that is used to store names.
A syntactic container which permits the same name to be used in different modules or functions.
None of the above.
Rate this question:
X
X and y
X and z
Y and z
X and y and z
Rate this question:
X
X and y
X and z
Y and z
X and y and z
X
X and y
X and z
Y and z
X and y and z
Rate this question:
Traceback (most recent call last): File "", line1, in IndexError: string index out of range
A
B
Bana
None of the above
Rate this question:
Banana
Orange
Traceback (most recent call last): File "", line 2, in TypeError: 'str' object does not support item assignment
Traceback (most recent call last): File "", line 2, in TypeError: 'str' variables are immutable
None of the above
Rate this question:
I am Alice and I am 10 years old.
I am %s and I am %d years old. % (Alice, 10)
I am %s and I am %d years old. % (name, age)
I am name and I am age years old.
None of the above
Rate this question:
Create a string which is at most 5 characters wide, is left justified, and contains the number n.
Create a string which is exactly 5 characters wide, is right justified, and contains the number n.
Create a string which is at least 5 characters wide, is left justified, and contains the number n.
Create a string which is at least 5 characters wide, is right justified, and contains the string n.
None of the above
Rate this question:
[1, 2, 3, 4, 5]
[2, 4, 6, 8, 10]
[0, 1, 4, 9, 16]
[1, 4, 9, 16, 25]
None of the above
Rate this question:
[1, 2, 3, 4, 5]
['H', 'e', 'l', 'l', 'o']
['Hello', 2, 3, 4, 5]
Traceback (most recent call last): File "", line 2, in TypeError: 'list' object does not support multiple component types
None of the above
Rate this question:
15
12
3
9
None of the above
Rate this question:
5 4 3
4 5 3
3 4 5
3 5 4
None of the above
Rate this question:
W and x
X
Y and z
Z
None of the above
Rate this question:
'Hello there'
Hello there
Hellothere
Traceback (most recent call last): File "", line 1, in TypeError: unsupported operand type(s) for +: 'str' and 'str'
None of the above.
Rate this question:
Hello Hello
Hello Goodbye
Goodbye Goodbye
Goodbye Hello
None of the above
Rate this question:
W and x
W and y
X and y
X and z
All of w,x,y and z
Rate this question:
X and y
W
Y and z
Y
None of w, x, y and z
Rate this question:
16-10
10
7
1
None of the above
Rate this question:
'there'
'therethere'
'therethere therethere'
'there there there there'
None of the above
Rate this question:
W and x
X and y
W and z
Y and z
W and y
Rate this question:
This code always returns False.
This code always returns True
The code has a syntax error.
The code has a semantic error.
The variable x is incremented by 1.
Rate this question:
1 2 3 4 5
5 4 3 2 1
5 4 3 2 1 0 -1
5 4 3 2 1 0
0 1 2 3 4 5
Rate this question:
5 16 8 4 2
5 16 8 4 2 1
5 2 7 3
16 8 4 2
None Of the above
Rate this question:
The ball appears on the gameCanvas at the position (109, 109).
The ball initially appears on gameCanvas at the position (10, 10) and slowly moves across and down the canvas until it comes to rest at (109, 109).
The ball initially appears on gameCanvas at the position (11, 11) and slowly moves across and down the canvas until it comes to rest at (109, 109).
The ball initially appears on gameCanvas at the position (11, 11) and slowly moves across and down the canvas until it comes to rest at (110, 110).
None of the above.
Rate this question:
X
X and y
X and z
Y and z
X and y and z
Rate this question:
Converting a number into a product of prime factors.
The process of reorganising code to make it easier to understand, read and maintain.
Splitting a large section of source code into multiple smaller functions.
Combining multiple smaller functions into a single large section of source code.
None of the above.
B
A
N
Bananabanana
None of the above
Rate this question:
-1
0
1
2
None of the above
Rate this question:
Zebra equals aardvark
Aardvark comes before Zebra
Zebra comes before aardvark
Traceback (most recent call last): File "", line 1, in TypeError: can't compare type str and type str
None of the above
Rate this question:
Banana
Traceback (most recent call last): File "", line 2, in IndexError: string index out of range
Traceback (most recent call last): File "", line 2, in TypeError: 'str' object does not support item assignment
B
None of the above
Rate this question:
[1, 2, 3, 4]
[5, 2, 3, 4]
[5, 1, 2, 3, 4]
Traceback (most recent call last): File "", line 2, in TypeError: 'list' object does not support item assignment
None of the above
Rate this question:
['B', 'a', 'n', 'a', 'n', 'a']
Traceback (most recent call last): File "", line 2, in TypeError: 'list' object does not support items assignment
B_a_n_a_n_a
Banana
None of the above
Rate this question:
1
2
4
[1, 2, 3]
None of the above
Rate this question:
1
-1
Traceback (most recent call object): File "tuples.py", line 2, in items[0] = -1 TypeError: 'tuple' object does not support item assignment
9
None of the above
Rate this question:
X and y
X and z
Y and z
X and y and z
None of the above
Rate this question:
Bananaapple
Banana & apple
Set 9['s', 'p', 'b', 'e', 'l', 'n'])
Set('bananaapple')
None of the above
Rate this question:
Traceback (most recent call object): File "argv.py", line 7, in print sum(strings) TypeError: unsupported operand type(s) for +: 'int' and 'str
12.0
3.0
9.0
None of the above
Rate this question:
A list of names of all files ending in '.py' in the current working directory.
A list of names of all files ending in '.py' on the whole computer.
A reference to the file *. py.
The string' glob. glob ( "*. py") '.
None of the above
Rate this question:
X and y
X and z
Y and z
X and y and z
None of the above
Rate this question:
False False
True False
True True
False True
None of the above
Rate this question:
20 50 0 0
0 0 20 50
20 50 20 50
50 20 0 0
None of the above
Rate this question:
X
X and y
X and z
Y and z
X and y and z
Rate this question:
X and y
X and z
Y and z
X, y and z
They all produce different Output
Rate this question:
W, x and z
W, y and z
X, y and z
All of w, x, y and z
None of w, x, y and z
Rate this question:
3 5
3 3
5 3
5 5
None of the above
Rate this question:
Quiz Review Timeline (Updated): Apr 7, 2024 +
Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.
Wait!
Here's an interesting quiz for you.