Smart Future Point

Python MCQ

1. What is the output of the following code: print(type(5))?



2. Which of the following is a valid way to declare a list in Python?



3. What is the output of the following code: print(2 ** 3)?



4. Which of the following is used to define a function in Python?



5. What is the output of the following code: print("Hello" + " World")?



6. Which of the following is the correct way to create a dictionary in Python?



7. What is the output of the following code: print(10 // 3)?



8. Which of the following is used to handle exceptions in Python?



9. What is the output of the following code: print(len("Hello"))?



10. Which of the following is the correct way to import a module in Python?



11. What is the output of the following code: print(3 * 'A')?



12. Which of the following is used to read input from the user in Python?



13. What is the output of the following code: print(2 + 3 * 4)?



14. Which of the following is a mutable data type in Python?



15. What is the output of the following code: print("Python"[0])?



16. Which of the following is the correct way to create a class in Python?



17. What is the output of the following code: print(1, 2, 3, sep='-')?



18. Which of the following is used to create a virtual environment in Python?



19. What is the output of the following code: print([1, 2, 3] + [4, 5, 6])?



20. Which of the following is the correct way to handle exceptions in Python?



21. What is the output of: len("Python")?



22. Which of the following is a mutable data type in Python?



23. What is the output of: type({})?



24. What does the range(5) function return?



25. What is the keyword used to define a function in Python?



26. Which method is used to convert a string into lowercase in Python?



27. What is the output of: bool(0)?



28. Which of the following is not a keyword in Python?



29. Which of the following is used to comment a single line in Python?



30. What does the strip() method do in Python?



31. What will be the result of 3 ** 2 in Python?



32. Which of the following data types is not ordered?



33. What does the pop() method do in a list?



34. What keyword is used to create a class in Python?



35. Which method adds an element at the end of a list?



36. What is the default return value of a function that does not return anything?



37. Which function converts a string to an integer in Python?



38. What symbol is used for floor division in Python?



39. Which keyword is used to begin a loop in Python?



40. What is the output of 10 % 3?



41. Which of these is not a core data type in Python?



42. What does the len() function do?



43. Which function is used to get input from the user?



44. What is the output of bool(0)?



45. Which of the following is used to define a function in Python?



46. What will be the output of type([])?



47. Which loop is guaranteed to run at least once?



48. What will be the result of 'a' + 'b'?



49. Which method is used to convert a string to lowercase?



50. Which keyword is used to import a module in Python?



Python Short Questions

1. What is Python?

2. What are the main features of Python?

3. What is a variable in Python?

4. What are the different data types in Python?

5. What is a list in Python?

6. What are the different types of loops in Python?

7. What is a function in Python?

8. What is a lambda function in Python?

9. What is the difference between a list and a tuple in Python?

10. What is the difference between ‘is’ and ‘==’ in Python?

11. What are Python’s key features?

12. What is PEP 8?

13. What are Python decorators?

14. What is the purpose of the “with” statement?

15. What are *args and **kwargs in Python?

16. Explain Python’s memory management.

17. What is the difference between deep copy and shallow copy?

18. What are Python modules and packages?

19. What is the difference between Python 2 and Python 3?

20. Explain the use of the Python pass statement.

21. What is the difference between range() and xrange()?

22. What are Python iterators?

23. What are Python generators?

24. What is the use of the yield keyword in Python?

25. What is the purpose of the Python __init__.py file?

26. What are Python comprehensions?

27. What is monkey patching in Python?

28. What is the difference between staticmethod and classmethod?

29. Explain how Python handles memory leaks.

30. What are Python exceptions? How do you handle them?

31. What are Python magic methods?

32. What is duck typing in Python?

33. Explain the difference between mutable and immutable objects.

34. How do you manage packages in Python?

35. What is the Python Global Interpreter Lock (GIL)?

36. What is the difference between local and global variables?

37. How do you handle file operations in Python?

38. What are Python’s built-in data structures?

39. What are Python's built-in functions?

40. What is list comprehension with an example?

41. How do you manage memory in Python?

42. What is a Python virtual environment and why is it used?

43. What are the uses of the zip() function in Python?

44. What are docstrings in Python?

45. What is a Python namespace?

46. What is the use of hasattr() function?

47. What are Python’s logical operators?

48. What are * and ** used for in Python function definitions?

49. What is the use of enumerate() function in Python?

50. Explain the difference between 'del', 'remove()', and 'pop()' in lists.

Coumputer Course

Popular Courses

(123)
Web Development
(123)
FULL STACK JAVA
PROGRAMING
(123)
PYTHON PROGRAMING
smartfuturepoint