Python Mastery: 10 Multiple-Choice Questions to Test Your Knowledge.

Introduction

Top 10 M.C.Q:- Questions and Answers for improving and understanding Python Programming. Learn and Understand Python Programming like Pro.

1. Question: What type of programming language is Python?

A. Procedural

B. Object-Oriented

C. Functional

D. All of the above

Correct Answer: D

2. Question: Which symbol is used to indicate comments in Python?

A. //

B. #

C. / /

D. --

Correct Answer: B

3. Question: What is the output of the following Python code?

python
print(3 * 'Hello, ')

A. 3

B. Hello, Hello, Hello,

C. 9

D. Hello, Hello, Hello,

Correct Answer: D

4. Question: Which of the following data types is mutable (modifiable) in Python?

A. int

B. float

C. tuple

D. list

Correct Answer: D

5. Question: In Python, how do you define a function?

A. using the method keyword

B. using the func keyword

C. using the define keyword

D. using the def keyword

Correct Answer: D

6. Question: Which operator is used for exponentiation in Python?

A. ^

**B. **

C. ^

D. ^^

Correct Answer: B

7. Question: What does the len() function in Python do?

A. Returns the current date and time

B. Returns the length of a string or list

C. Returns the square root of a number

D. Returns the absolute value of a number

Correct Answer: B

8. Question: How do you open a file for reading in Python?

A. file.open('filename', 'r')

B. open('filename', 'read')

C. open('filename', 'r')

D. file.open('filename', 'read')

Correct Answer: C

9. Question: In Python, which module is used for working with regular expressions?

A. re

B. regex

C. regexp

D. regular

Correct Answer: A

10. Question: What is the output of the following Python code?

markdown
```python 
numbers = [1, 2, 3, 4, 5] 
print(numbers[-2]) 
``` 
**A. 1** 
**B. 4** 
**C. 3** 
**D. 5** 
**Correct Answer: C**

Post a Comment

Post a Comment (0)

Previous Post Next Post