Python Quiz: multiple choice questions
Time: 25 minutes
Created by Vivax Solutions
Test Your Python Skills Beginners, GCSE, IGCSE & A Level Students!
Master Python fundamentals with this engaging multiple-choice quiz! Whether you're a complete beginner or preparing for your GCSE or A-Level exams, this quiz will assess your understanding of core Python concepts.
Key Learning Areas:
- Variables & Data Types (integers, strings, booleans)
- Operators (arithmetic, comparison, logical)
- Control Flow (if statements, loops)
- Functions & Modules
- Basic Syntax & Best Practices
Benefits:
- Self-Assessment: Gauge your Python knowledge and identify areas for improvement.
- Interactive Learning: Reinforce key concepts in a fun and engaging way.
- GCSE & A-Level Prep: Test your understanding relevant to your curriculum.
Ready to take the challenge? Sharpen your Python skills and become a confident programmer!
1
Which of the following is NOT a valid data type in Python??
2
How do you define a single-line comment in Python?
3
What keyword is used to define a function in Python?
4
a = [4,5,6,7,8]
How do you print the fourth number of the array?
How do you print the fourth number of the array?
5
How do you access the value of a key in a dictionary called, 'Collection'?
6
In Q5), how do you get all the values of 'Collection'?
7
The strings, 'Carbon' and ' Dioxide' are stored in the variables, a and b respectively. Which of the following will produce 'Carbon Dioxide'?:
8
What is the output of the following code?
x = 3 ; x*=2 ; print(x)
x = 3 ; x*=2 ; print(x)
9
How do you import the math and time modules in Python?
10
half_week = ['Sunday' , 'Monday' , 'Tuesday' , 'Wednesday']
a=' '
for day in half_week:
a+=day
print(a)
What will be the output?
a=' '
for day in half_week:
a+=day
print(a)
What will be the output?
11
language='MALAYALAM'
This is a language spoken in the southern India. How do you reverse the order of the letters in Python?
This is a language spoken in the southern India. How do you reverse the order of the letters in Python?
12
x = ('Football','Cricket','Tennis')
If x[1]='Rugby' is inserted into the code just below the above line, it will produce
If x[1]='Rugby' is inserted into the code just below the above line, it will produce
13
What will the append() method do in Python?
14
def maths(a,b):
print a*b
maths(3,4)
The code is,
print a*b
maths(3,4)
The code is,
15
Twinkle twinkle little star,
How I wonder what you are!
In order to print the above lines, you need to use,
How I wonder what you are!
In order to print the above lines, you need to use,
16
A man invests £2000 at 4% pa compound interest for five years. To calculate his future value after 6 years, which Python code line is the right one?
17
The above code will produce,
18
Vishal wants to find the falue of the following using Python:
12 x (2 + 3)² :- 4
The correct Python code for it will be:
12 x (2 + 3)² :- 4
The correct Python code for it will be:
19
What will be the output of the following code?
print(3*'*')
print(3*'*')
20
a='Terminator'
n=0
for i in range(len(a)):
n+=1
print(n)
The output shows,
n=0
for i in range(len(a)):
n+=1
print(n)
The output shows,
21
The proper way to check whether a number is odd in Python is:
22
x=30
def function():
x=300
return x
print(function(), x)
The output will be:
def function():
x=300
return x
print(function(), x)
The output will be:
23
x=30
def function():
global x
x=300
return x
print(function(), x)
The output will be:
def function():
global x
x=300
return x
print(function(), x)
The output will be:
24
i = -3
while i < n:
print(i)
i += 1
If the difference between the highest and lowest of the output is 8, n is:
while i < n:
print(i)
i += 1
If the difference between the highest and lowest of the output is 8, n is:
25
print(float(3)) and print(float('3')) will produce,
0 comments:
Post a Comment