NEW
Font size
WorksheetsPython End of Topic Quiz
Total questions: 15
Worksheet time: 8mins
Which arithmetic operator will you use in the following program to multiply 10 by 5 and print the result?
print(10 _ 5)
×
/
*
**
What will be the output of this program?
210
Syntax error
210 30
None of the above
When a user inputs an answer, it should be stored in a suitably named ...?
file
variable
data type
list
The PIN code is a six-digit code used by the Indian Postal Department.
What is the data type of the variable 'x' if it stores this code as x = "462016"?
int
string
float
number
Given the list color_list = ["Red", "Blue", "Green", "Black"], what will be the output of print(color_list[1], color_list[3])?
Red Green Black
Blue Black
Blue Black Syntax Error
Blue Black IndexError: list index out of range
Which of the following options will output 'HELLO, WORLD!' when the variable a is set to "Hello, World!"?
a.upper()
print(a.upper)
a.upper()
print(a.upper())
What will be the output of this program?
Pass
Enter your score
It will throw a syntax error
Fail
Which of the following options has the correct syntax for defining a list in Python?
mylist = {"apple", "banana", "cherry"}
mylist = [apple, banana, cherry]
mylist = ["apple", "banana", "cherry"]
mylist = ["apple", "banana" ; "cherry"]
What is the purpose of the input() function in Python?
Ask the user a question and receive input
It is a conditional statement
All of the above
Convert user input to uppercase
What will be the output of the following program?
x = 13
print(x)
x = "Jacob"13
Jacob
It will throw an error
First 13 and then "Jacob" will be outputted
What will be the output of the following code snippet?
# Define a list of fruits
fruits = ["apple", "banana", "cherry"]
# Print the first and third elements of the list
print(fruits[0], fruits[2])
apple banana
banana cherry
IndexError: list index out of range
apple cherry
In Python, which function is used to convert a string to all lowercase letters?
downcase()
lower()
lowercase()
toLowerCase()
What is the data type of the variable 'y' in the following code snippet?
y = 3.14
int
string
float
double
What will be the output of the following code snippet?
numbers = [1, 2, 3, 4, 5]
print(numbers[1] + numbers[3])
3
5
7
6
Which function is used to determine the number of elements in a list in Python?
size()
length()
count()
len()
