Python basic multiple choice questions, suitable for high school

1. Which of the following is a Python comment symbol?
A. //
B. #
C. /*
D. ;

Answer: B

2. Which of the following is an assignment operator in Python?
A. =
B. ==
C. !=
D. >

Answer: A

3. Which of the following is a logical operator in Python?
A. &&
B. ||
C. !
D. &

Answer: C

4. Which of the following is a Python loop statement?
A. for
B. while
C. do-while
D. switch

Answer: A, B

5. Which of the following is a conditional statement in Python?
A. if-else
B. switch-case
C. try-catch
D. do-while

Answer: A

6. Which of the following is a Python data type?
A. int
B. float
C. string
D. all of the above

Answer: D

7. Which of the following is a function definition keyword in Python?
A. def
B. function
C. define
D. func

Answer: A

8. Which of the following is a Python module import statement?
A. import
B. include
C. require
D. use

Answer: A

9. Which of the following is an object-oriented programming keyword in Python?
A. class
B. object
C. struct
D. interface

Answer: A

10. Which of the following is an exception handling keyword in Python?
A. try
B. catch
C. throw
D. except

Answer: A, D

Guess you like

Origin blog.csdn.net/babyai996/article/details/131140032