Python MCQ Quiz Hub

MCQ Introduction to Python Section 3

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

1. >>> bool(0) evaluates to __




2. ____ operators are used to check if a value is a member of the given sequence or not.




3. Write the output of following code: >>> n1 = 5 >>> n2 = n1 >>> n2 is n1




4. Which operators can be used to determine whether two variables are referring to the same object or not.




5. Which of the following is valid membership operator?




6. _________ is defined as a combination of constants, variables, and operators.




7. Which of the following is invalid expression?




8. Binary operators are operators with ________ operands




9. >>> 14 + 2 ** 2 evaluates to




10. >>> 15.0 / 4 + (8 + 3.0) evaluates to ________________




11. >>> 15.0 / 4 + (8 + 3.0) evaluates to ________________




12. >>> 15.0 / 4 + (8 + 3.0) evaluates to ________________




13. In Python, we have ____________________ function for taking input from the user.




14. The user may enter a number or a string but the input() function treats them as _




15. Write the output of the following : >>> age = input("Enter your age: ") >>> type(age)




16. Write the output of the following : >>> age = input("Enter your age: ") Enter your age: 3 >>> age * 3




17. What type of error is returned by following statement? >>> age = input("Enter your age: ") Enter your age: 3 >>> age + 3




18. Python uses _________________ function to output data to standard output device.




19. print(“I” + “am” + “in” + “school”) display ___




20. print(“I” , “am” , “in” , “school”) display __




21. Which of the following is parameter of print( ) function?




22. int(123.45) is an example of _




23. ________ happens when data type conversion is done automatically by Python.




24. Write the output of the following : num1 = 100 num2 = 2.0 sum1 = num1 + num2 print(sum1)




25. In given code _____________ conversion takes place. num1 = 100 num2 = 2.0 sum1 = num1 + num2 print(sum1)




26. Which of the following function convert the data type of variable ‘x’ from float to integer?




27. Which of the following is explicit type conversion function in Python?




28. Fill in the blank in given code : print("The total in Rs." + __________(70))




29. In the given code, an integer value stored in variable num1 is added to a float value stored in variable num2, and the result is stored in variable sum1. This is an example of _____ sum1 = num1 + num2




30. The process of removing errors from programs is called _________




31. Which of the following error may encounter in program of python?




32. Ravi is writing a program of printing “Hello World” but he forgot to close the bracket of print( ) function (as shown below). What type of error is this? print("Hello World"




33. ___ produces an undesired output but without termination of the program. a. Syntax error b. Logical error c.




34. Aman wants to find the average of two numbers 10 and 12 and he write the code as 10 + 12/2, it would run successfully but the output is not correct. What type of error is done by Aman?




35. ___ error causes abnormal termination of program while it is executing.




36. Which of the following statement return run time error ?




37. Errors in program is also called ____




38. IDLE stands for __________




39. IDLE stands for __________




40. Which of the following statement is correct to initialize multiple variables?




41. Which of the following statement is correct syntactically ?




42. Write the output of the following : print(true and False)




43. Write the output of the following : print(3 and (5 or 0))




44. Write the output of the following : print(True and (False or True))




45. Write the output of the following code : print((15 // 2 ** 2) * 'A')




46. Write the output of the following : 22 + (7 -2 // 9 ** 2) a. 22 b. 7 c. 29 d. 0




47. Which of the following is mutable data type?