1. What is the correct file extension for Python files?
2. Which function is used to display output in Python?
3. How do you start a comment in Python?
4. What will print(2 ** 3) output?
5. Which keyword is used to define a function in Python?
6. What data type is True in Python?
7. Which of the following is a valid variable name?
8. What will print("5" + "6") output?
9. Which function returns the length of a list?
10. Which keyword is used to create a loop in Python?
11. What is the output of print(10 // 3)?
12. What does input() return?
13. Which one is a tuple?
14. Which operator is used for floor division?
15. What will print(type({})) display?
16. What is the output of bool(0)?
17. Which method adds an element to a list?
18. How do you remove the last element from a list?
19. Which keyword is used to handle exceptions?
20. What is the output of len("Hello World")?
21. What is the result of 3 > 2 and 2 > 4?
22. Which of the following is immutable?
23. How do you define a class in Python?
24. Which keyword is used to create an object?
25. Which function converts a string to lowercase?
26. What is the output of min([5, 2, 8])?
27. How can you open a file for writing?
28. What is the purpose of with open() in Python?
29. What will list("abc") return?
30. What is the output of " ".join(['I', 'love', 'Python'])?
31. Which of these is not a core data type?
32. How can you check the Python version?
33. What does range(5) produce?
34. Which statement is used to stop a loop?
35. How do you define a lambda function?
36. What is the output of list(set([1,2,2,3]))?
37. What is a decorator in Python?
38. What is the output of sorted({3:1, 2:2, 1:3})?
39. What is the purpose of the __init__() method in a class?
40. What is the output of type(lambda x: x*2)?
41. Which module is used for working with regular expressions in Python?
42. How can you create a generator in Python?
43. What is the difference between is and == in Python?
44. Which function can execute a string as Python code?
45. What is list comprehension used for?
46. print([i for i in range(3)])
47. What happens when you divide a number by zero in Python?
48. What will be the output of print(0.1 + 0.2 == 0.3)?
49. What does the @staticmethod decorator in Python indicate?
50. What will print({1, 2, 3} & {2, 3, 4}) output?
?? Back