Font size
Worksheetspython
Total questions: 30
Worksheet time: 21mins
What is printed by the following statement?
print("P" not in "APCSP")
True
False
Error
What is the correct extension for python files ?
.py
.pyth
.python
Which of the following is True
Python is an interpreted language
Python is a compiled language
Python is a scripting language
Python is an Object oriented language
What is the output of this expression, 3*1**3
27
9
3
1
Which of the following is an invalid variable?
my_string_1
1st_string
foo
-
is Python case sensitive when dealing with identifiers?
yes
no
machine dependent
none of these
Output of this code?
[2,4,6,8,10]
['2','4','6','8','10']
[0,2,4,6,8]
[10,8,6,4,2]
The count() method returns the number of times the specified element appears in the list.
What is the output of this code?
3
2
1
0
Which of these pieces of code would return the name "Harry" from the following list?
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList()
nameList[1]
NameList(4)
nameList["4"]
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]
A dictionary is an example of a sequence ...
True
False
quiz = {"Do you help out at home? ":"yes",
"Do you beleive in Santa? ":"yes"}
The output of the code above is
Key Error
4
Math
The code snippet above outputs
error
None
NaN
-1
How do you create a variable with the numeric value 5?
Both are correct
x=5
x=int(5)
print(Hello world!)
What would be printed by the command
print('12-5')
12-5
'12-5'
7
'7'
If num1 = 3
num2 = 4
then what will be the output of num1 ** num2
3
7
12
81
In Python, 'Hello', is the same as "Hello"
yes
no
Which one is NOT a legal variable name?
my_var
myvar
_myvar
my-var
What is a correct syntax to output "Hello World" in Python?
echo("Hello World")
echo "Hello World"
print("Hello World")
PRINT("Hello World")
The program above prints
Numbers between 1 and 100 that are multiples of 5
Numbers between 1 and 100
Numbers between 1 and 100 divisible by 5
Numbers between 1 and 101 that are multiples of 5
The above program prints
Numbers 1 to 10 in reverse order
Numbers 1 to 11 in reverse order
Numbers 1 to 10
Numbers 1 to 11
The equivalent of the above for loop using the while syntax would be
The program above
prints all the odd numbers between 1 and 20
prints all even numbers between 1 and 20
print all the odd numbers between 1 and 21
prints all the even numbers between 1 and 21
print("3+4")
print(3+4)
