Input / Output Handling MCQs

Topic-wise practice questions for Programming (C++ / Java / Python). Test your knowledge, check solutions on demand, and pace your preparation.

Zero-leak answer engine • Rate-limited explanations
Practice in Timed Mode
Q1medium
A program is stuck in a while loop reading from a network socket because no data is arriving. This state is known as:
Q2easy
What is "Object Serialization"?
Q3medium
Trace the output in a language like Java or Python:

print("Apple", end="-")
print("Orange")
Q4medium
When a program needs to report a critical error that should not be mixed with the regular program output, which standard stream should it use?
Q5medium
You are processing a 10GB log file on a machine with only 4GB of RAM. What is the correct way to handle the I/O?
Q6hard
Trace the file handling logic in this pseudocode:

file = open("data.txt", "w")
file.write("Hello")
# System crashes here
file.close()
What is a likely real-world risk if the close() method is never reached?
Q7medium
A developer opens a log file using the mode "w" (write). The file already contains 100 lines of logs. What happens to those 100 lines after the file is opened?
Q8easy
What is the main difference between reading a file in "Text" mode versus "Binary" mode?
Q9medium
Look at this C-style code: printf(user_input);. Why is this considered a high-severity security vulnerability?
Q10easy
What does the "Flush" operation do in an I/O stream?