WorksheetsGeneral Python year 10
Total questions: 20
Worksheet time: 10mins
Choose the correct output of the following code.
for i in range(10,15):
print(i)
10
11
12
13
14
15
10
11
12
13
14
11
12
13
14
15
11
12
13
14
Which of these is the correct code for creating a list of names?
nameList = John, Harry, Jesse, John, Harry, Harry
nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList = [John, Harry, Jesse, John, Harry, Harry]
List items have an index number. In the following list, which item has the index number of 3?
["John", "Harry", "Jesse", "John", "Harry", "Harry"]
"John"
"Harry"
"Jesse"
How many different variables are in this program?
2
5
3
4
The output of the program
x = 4
x = "Sally"
print(x)
four
Saly
Sally
4
print("Hello" + 2 + "world")
What is the data type of this variable?
student = "Maria"
List
Integer
String
Dictionary
Consider this list, what will be the highest index the list can have:
li=[1,2,3,4,5]
2
3
4
5
What is the output of this code?
X
Y
Error
Which of the following function is used to count the number of elements in a list ?
count( )
find( )
len( )
index( )
What is the output of program below?
bicycles = ['trek', 'cannondale', 'redline', 'specialized']
print(bicycles[-1])
trek
cannondale
redline
specialized
What is a Boolean?
True or False statement
Numerical Operator
A cube that is used for a soup base.
A Ghost on a tree
print("Hello world!\nHello world!")
Hello world!
What are the three basic programming constructs?
Sequence, selection and iteration
Sequence, selection and looping
Sequence, iteration and looping
Sequence, execution and selection
What is the name given to the joining of strings?
Manipulation
Declaration
addition
Concatenation
Which logical operator represents greater than?
<
>
>=
==
What is a function?
A type of subroutine that calculates a value
A type of subroutine that returns a value
A type of subroutine that processes a value, but does not return it
A type of subroutine that only runs when called
