Python MCQs Test 1

python

Python MCQS Test 1

1 / 20

What is the output of the following code? \nprint(7 // 3)

2 / 20

How do you create a function in Python?

3 / 20

What does the sorted() function return in Python?

4 / 20

What is the output of the following code? \nprint("hello".capitalize())

5 / 20

Which of the following is NOT a valid comparison operator in Python?

6 / 20

What is the result of the expression True and False in Python?

7 / 20

What is the purpose of the pass statement in Python?

8 / 20

How do you open a file named example.txt in Python for reading?

9 / 20

What is the output of the following code? \nprint("Python"[::-1])

10 / 20

What does the len() function do in Python?

11 / 20

What is the output of the following code? \nprint(10 % 3)

12 / 20

How do you import a module named mymodule in Python?

13 / 20

What does the strip() method do in Python?

14 / 20

Which of the following is NOT a valid way to comment in Python?

15 / 20

What is the output of the following code? \nprint("Hello" + "World")

16 / 20

What does the break statement do in a loop?

17 / 20

Which of the following data types is mutable in Python?

18 / 20

What is the result of the expression 3 ** 2 in Python?

19 / 20

Which of the following is NOT a valid variable name in Python?

20 / 20

What is the output of the following code? \nprint(2 + 2 * 3 - 2 / 2)

Your score is

The average score is 0%

0%

Scroll to Top