Python MCQ Quiz Hub

Python MCQs

Choose a topic to test your knowledge and improve your Python skills

1. What is the maximum possible length of an identifier?




2. Who developed the Python language?




3. In which year was the Python language developed?




4. In which language is Python written?




5. Which one of the following is the correct extension of the Python file?




6.  In which year was the Python 3.0 version developed?




7. What do we use to define a block of code in Python language?




8. Which character is used in Python to make a single line comment?




9. Which of the following statements is correct regarding the object-oriented programming concept in Python?




10. Which of the following statements is correct in this python code? class Name: def __init__(javatpoint): javajavatpoint = java name1=Name("ABC") name2=name1




11. What is the method inside the class in python language?




12. Which of the following declarations is incorrect?




13. Why does the name of local variables start with an underscore discouraged?




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




15. Which of the following statements is correct for variable names in Python language?




16. Which of the following declarations is incorrect in python language?




17. Which of the following words cannot be a variable in python language?




18. Which of the following operators is the correct option for power(ab)?




19. Which of the following precedence order is correct in Python?




20. Which one of the following has the same precedence level?




21.  Which one of the following has the highest precedence in the expression?




22. Which of the following functions is a built-in function in python language?




23. Study the following function:round(4.576) What will be the output of this function?




24. Which of the following is correctly evaluated for this function? pow(x,y,z)




25. Study the following function: all([2,4,0,6]) What will be the output of this function?




26. Study the following program: x = 1 while True: if x % 5 = = 0: break print(x) x + = 1 What will be the output of this code?




27. Which one of the following syntaxes is the correct syntax to read from a simple text file stored in ''d:java.txt''?




28. Study the following code: x = ['XX', 'YY'] for i in a: i.lower() print(a) What will be the output of this program?




29. Study the following function: import math abs(math.sqrt(36)) What will be the output of this code?




30. Study the following function:any([5>8, 6>3, 3>1]) What will be the output of this code?




31. Study the following statement: >>>"a"+"bc" What will be the output of this statement?




32. Study the following code: >>>"javatpoint"[5:] What will be the output of this code?




33. The output to execute string.ascii_letters can also be obtained from:?




34. Study the following statements: >>> str1 = "javat" >>> str2 = ":" >>> str3 = "point" >>> str1[-1:] What will be the output of this statement?




35. Study the following statements: >>> print(0xA + 0xB + 0xC) What will be the output of this statement?




36. Study the following statements: >>> print(ord('h') - ord('z')) What will be the output of this statement?




37. Study the following program: x = ['xy', 'yz'] for i in a: i.upper() print(a) Which of the following is correct output of this program?




38. Study the following program: i = 1: while True: if i%3 == 0: break print(i) Which of the following is the correct output of this program?




39. Study the following program: a = 1 while True: if a % 7 = = 0: break print(a) a += 1 Which of the following is correct output of this program?




40. Study the following program: i = 0 while i < 5: print(i) i += 1 if i == 3: break else: print(0) What will be the output of this statement?




41. Which keyword is use for function?




42. Which of the following items are present in the function header?




43. What is called when a function is defined inside a class?




44. If return statement is not used inside the function, the function will return:




45. What is a recursive function?




46. Which of the following is the use of id() function in python?




47. Which of the following function headers is correct?




48. In which part of memory does the system stores the parameter and local variables of funtion call?




49. How is a function declared in Python?




50. Which one of the following is the correct way of calling a function?




51. Which operator is used in Python to import modules from packages?




52. Where is function defined?




53. Lambda is a function in python?




54. What is a variable defined outside a function referred to as?




55. What is the output of the following program?z = lambda x : x * x print(z(6))




56. What is the output of the following program? print(chr(ord(chr(97))))




57. Which one of the following is incorrect?