Python Print Function MCQS
Q. What data type does input() return?
Solution:
Input() always returns a string in Python 3.
Q. Which statement reads an integer from the user?
Solution:
Wrap input() in int() to convert the string.
Q. What is the purpose of the argument in input("Name: ")?
Solution:
The argument is the prompt displayed before reading input.
Q. The user enters 5 and 5. What does print(input() + input()) show?
Solution:
 Both inputs are strings, so + concatenates them.
Q. Which code converts the input "1 2 3" into [1, 2, 3]?
Solution:
split() creates a list of strings; map(int, …) converts each
Q. What happens when int(input()) receives "abc"?
Solution:
Non-numeric text cannot be converted to int.
Q. What does input().split(",") return for "a,b"?
Solution:
split(“,”) breaks the string at commas into a list.
Q. Which module reads a password without displaying it?
Solution:
getpass.getpass() disables echo while typing.
Get Question Bank
Strengthen Your Practice with our comprehensive question bank.