Python MCQ Quiz Hub

Python Mcq Set 1

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

1. Is Python case sensitive when dealing with identifiers?




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




3. Which of the following is invalid?




4. Which of the following is an invalid variable?




5. Why are local variable names beginning with an underscore discouraged?




6. Which of the following is not a keyword?




7. Which is the correct operator for power(xy)?




8. Which one of these is floor division?




9. What is the answer to this expression, 22 % 3 is?




10. Operators with the same precedence are evaluated in which manner?




11. What is the output of this expression, 3*1**3?




12. Which of these in not a core data type?




13. Given a function that does not return any value, What value is thrown by default when executed in shell.




14. Which of the following will run without errors?




15. What is the return type of function id?




16. In python we do not specify types, it is directly interpreted by the compiler, so consider the following operation to be performed. >>>x = 13 ? 2 objective is to make sure x has a integer value, select all that apply (python 3.xx)




17. What error occurs when you execute the following Python code snippet? apple = mango




18. What data type is the object below? L = [1, 23, 'hello', 1]




19. In order to store values in terms of key and value we use what core data type.




20. Which of the following results in a SyntaxError?




21. Select all options that print. hello-how-are-you




22. What is the return value of trunc()?




23. What is the output of print 0.1 + 0.2 == 0.3?




24. Which of the following is not a complex number?




25. What is the type of inf?




26. What does ~4 evaluate to?




27. What does ~~~~~~5 evaluate to?




28. Which of the following is incorrect?




29. What is the result of cmp(3, 1)?




30. Which of the following is incorrect?




31. What is the result of round(0.5) – round(-0.5)?




32. What does 3 ^ 4 evaluate to?




33. What will be the value of the following Python expression? 4 + 3 % 5




34. Evaluate the expression given below if A = 16 and B = 15. A % B // A




35. Which of the following operators has its associativity from right to left?




36. What will be the value of x in the following Python expression? x = int(43.55+2/2)




37. What is the value of the following expression? 2+4.00, 2**4.0




38. Which of the following is the truncation division operator?




39. What are the values of the following Python expressions? 2**(3**2) (2**3)**2 2**3**2




40. What is the value of the following expression? 8/4/2, 8/(4/2)




41. What is the value of the following expression? float(22//3+3/3)




42. What will be the output of the following Python expression? print(4.00/(2.0+2.0))




43. What will be the value of X in the following Python expression? X = 2+9*((3*12)-8)/10




44. Which of the following expressions involves coercion when evaluated in Python?




45. What will be the output of the following Python expression? 24//6%3, 24//4//2




46. Which among the following list of operators has the highest precedence? +, -, **, %, /, <<, >>, |




47. What will be the value of the following Python expression? float(4+int(2.39)%2)




48. Which of the following expressions is an example of type conversion?




49. Which of the following expressions results in an error?




50. What will be the value of the following Python expression? 4+2**5//10