Improve Your Python Skills with Mixed MCQs part four

Python Skills with Mixed MCQs

1. What does the 'def' keyword do in Python?

2. What is the purpose of the __init__() method in a class?

3. Which of the following is used to create a list in Python?

4. How do you access the value associated with the key 'name' in a dictionary?

5. What is the output of `print(2 ** 3)` in Python?

6. What will be the result of `len("Hello World")`?

7. What is the purpose of the 'pass' statement in Python?

8. What will be the output of the following code? `print(type([]))`

9. How do you check if a key 'age' exists in a dictionary?

10. What will be the output of `sorted([3, 1, 2])`?

11. What is the purpose of a for loop in Python?

12. What does the 'continue' statement do in a loop?

13. What is the purpose of the 'elif' statement in Python?

14. How do you include a module in Python?

15. What is the purpose of a while loop in Python?

16. What does the 'break' statement do in a loop?

17. What does the 'map()' function do in Python?

18. What does the 'filter()' function do in Python?

19. What does the 'join()' method do in Python?

20. What does the 'len()' function do in Python?

1 2 3 4

Post a Comment

Your comment will be visible after approval.
© TechTestLog. All rights reserved. Premium By Raushan Design
//My script