Python Basics Quiz

Python Basics Quiz 20-Question

Python Basics Quiz

Focuses on fundamental Python concepts such as syntax, variables, data types, basic operators, and control flow statements (if-else, loops).

1 / 20

What is the correct way to create a variable named age and assign it the value 25 in Python?

2 / 20

Which method can be used to remove the last item from a list in Python?

 

 

3 / 20

What is the purpose of the pass statement in Python?

 

4 / 20

How do you convert the string "123" to an integer in Python?

 

5 / 20

Which of the following methods can be used to add an element to the end of a list?

 

6 / 20

What is the output of the following code?

print("Hello" * 3)

 

7 / 20

How do you access the first element of a list named fruits?

 

8 / 20

What does the len() function do in Python?

 

9 / 20

Which of the following is a mutable data type in Python?

 

10 / 20

What is the correct way to import the math module in Python?

 

11 / 20

How do you create a tuple in Python?

 

12 / 20

Which keyword is used to create a loop that iterates over a sequence in Python?

 

13 / 20

What will be the output of the following code?

print(5 // 2)

 

14 / 20

Which of the following operators is used to concatenate strings in Python?

 

15 / 20

What is the correct way to write an if statement in Python?

 

16 / 20

How do you create a list in Python?

 

17 / 20

Which of the following is the correct syntax to create a function in Python?

 

18 / 20

What is the output of the following code?

print(type(3.14))

19 / 20

How do you add a comment in Python?

 

20 / 20

Which of the following data types is used to store text in Python?

 

Your score is

The average score is 76%

0%

Start Learning Python from Hello World!

20-Question quiz on Data Structures in Python