Worksheets4.18 - 5.4
Total questions: 7
Worksheet time: 4mins
Name
Class
Date
1.
What is the value of the following?
[i*i for i in range(5)][2::-1]
a)
[0, 1, 4, 9, 16]
b)
[4, 1, 0]
c)
[16, 9, 4]
d)
[16, 9, 4, 1, 0]
2.
What is the output of the program?
a)
7
b)
[1, 2, 3]
c)
[1, 2, 3, None, None, None, 7]
d)
[1, 2, 3, 7]
3.
What is the expected output of the program?
a)
None
b)
a
c)
C
d)
None of the above
e)
2
4.
Python language was developed in what year?
a)
1985
b)
1920
c)
1991
d)
2001
5.
What is a statement in programming?
a)
Expresses an action to be carried out
b)
Always returns results like expressions
c)
Rules controlling how components in a program are combined
d)
An instruction to perform a task, usually one word
e)
None of the above
6.
What is the output of the following code?
a)
James
b)
JamesJamesJamesJamesJamesJames
c)
JamesJamesJamesJamesJames
d)
Error: invalid syntax
7.
What is the output of the following code
a)
py
b)
yn
c)
pyn
d)
yna
e)
pn
100 %
