PRACTICE • LEARN • GROW
Module 3: Input and Output - Final Quiz MCQs
Solve topic-wise placement questions and improve your skills.
Module 3: Input and Output - Final Quiz Progress
0 of 11 completed
0%
Topic Track
You are viewing MCQs in preview mode. Log in to select options, submit answers, and track your progress.
Log In to Answer
1
What are the default values for the
sep and end parameters in the print() function?
A.
sep='' (empty) and end=' ' (space)
B.
sep=' ' (space) and end='\n' (newline)
C.
sep=',' (comma) and end='\n' (newline)
D.
sep='\t' (tab) and end='' (empty)
Explanation & Key
Correct Answer:
2
What is the output of the following print call?
print("A", "B", sep="-", end="*")
print("C")
A.
A-B*C
B.
A B*\nC
C.
A-B\n*C
D.
A-B C
Explanation & Key
Correct Answer:
3
What will be printed by the following f-string containing an expression?
age = 20
print(f"In 5 years: {age + 5}")
A.
In 5 years: {age + 5}
B.
In 5 years: 25
C.
In 5 years: age + 5
D.
SyntaxError
Explanation & Key
Correct Answer:
4
What data type does the built-in
input() function ALWAYS return?
A.
int if digits are entered, float if decimal, otherwise str
B.
str (string) always
C.
None
D.
bytes
Explanation & Key
Correct Answer:
5
What will happen when executing this input summation code if the user enters 10 and 20?
a = input() # User types 10
b = input() # User types 20
print(a + b)
A.
30
B.
1020
C.
TypeError
D.
10 20
Explanation & Key
Correct Answer:
6
What is printed by this formatted f-string with precision specifier?
pi = 3.14159265
print(f"{pi:.2f}")
A.
3.14
B.
3.141
C.
3.1
D.
3.1415
Explanation & Key
Correct Answer:
7
Which code snippet correctly reads two space-separated integers from a single line of input (e.g. '15 25')?
A.
a, b = int(input())
B.
a, b = map(int, input().split())
C.
a, b = input().split(int)
D.
a, b = (int)input().split()
Explanation & Key
Correct Answer:
8
What is the output of the Python 3.8+ debug f-string syntax f"{x=}" when x = 42?
A.
42
B.
x=42
C.
{x=42}
D.
SyntaxError
Explanation & Key
Correct Answer:
9
Why is
sys.stdin.readline significantly faster than input() for processing millions of lines in competitive programming?
A.
sys.stdin.readline runs in C while input() runs in Python bytecode
B.
input() strips trailing newlines and handles prompt formatting, adding overhead, whereas sys.stdin.readline reads the raw buffer directly
C.
sys.stdin.readline automatically converts text to integers
D.
input() bypasses the operating system kernel
Explanation & Key
Correct Answer:
10
How can you immediately force the output buffer to flush in a
print() call without waiting for the buffer to fill?
A.
print('text', flush=True)
B.
print('text', buffer=False)
C.
sys.flush()
D.
print('text', sync=True)
Explanation & Key
Correct Answer:
11
How do you direct output from
print() to the standard error stream instead of standard output?
A.
print('error', stream='stderr')
B.
print('error', file=sys.stderr)
C.
sys.err.print('error')
D.
print('error', to='err')
Explanation & Key
Correct Answer:
Question Palette
Answered
Current
Not Attempted
Wrong