Python MCQ Test: Python MCQs - Practice Questions
1. What is the purpose of the 'lambda' function in Python?
2. How do you define a constant in Python?
3. Which of the following is used to remove an item from a list in Python?
4. Which of the following is a correct way to define a function in Python?
5. What is the purpose of the 'enumerate()' function in Python?
6. What is the purpose of the '__init__' method in Python?
7. Which of the following is used to represent a comment in Python?
8. In Python, how do you check the type of a variable?
9. Which of the following is a correct way to comment in Python?
10. In Python, how do you check if a key exists in a dictionary?
11. In Python, how do you check the type of a variable?
12. What is the result of the expression '3 < 5' in Python?
13. In Python, what is the 'split()' method used for?
14. What is the purpose of 'pip' in Python?
15. What is the purpose of the 'sorted()' function in Python?
16. Which method is used to convert a string to lowercase in Python?
17. What does the 'import' statement do in Python?
18. What is the result of the expression '5 + 3 * 2' in Python?
19. In Python, how do you create a function?
20. What is the result of the expression '2 + '2'' in Python?
21. What is the purpose of the '__str__' method in Python?
22. What is the correct way to open and read the contents of a file in Python?
23. Which of the following is an example of a Python built-in function?
24. What is the purpose of the 'lambda' function in Python?
25. In Python, how do you concatenate two lists?
26. What is the result of the expression 'not True' in Python?
27. In Python, how do you concatenate two lists?
28. Which statement is used for exiting a loop prematurely in Python?
29. What is the purpose of the 'global' keyword in Python?
30. What is the purpose of the 'is' keyword in Python?