Algorithms & Flow Control MCQs

Topic-wise practice questions for Problem Solving & Analytical Skills. Test your knowledge, check solutions on demand, and pace your preparation.

Zero-leak answer engine • Rate-limited explanations
Practice in Timed Mode
Q11hard
(Code Output) What will this pseudocode print?

x = 10
while (x > 5):
    x = x - 2
print(x)
Q12easy
What is the primary difference between a WHILE loop and a DO-WHILE loop?
Q13medium
A program must read a file line by line until it reaches the end of the file (EOF). The file length is unknown beforehand. Which control structure is the most appropriate?
Q14hard
What is the main purpose of "Pseudocode" in algorithmic design?
Q15medium
An ATM machine asks a user for their PIN. If they get it wrong, it asks again, up to a maximum of 3 attempts. Which structure best models this?
Q16medium
In a standard flowchart, which shape is used to represent a decision point (e.g., an IF statement)?
Q17easy
In programming, what is a "Base Case"?
Q18hard
(Code Output) Look at this code containing a continue statement:

for i from 1 to 4:
    if (i == 2):
        continue
    print(i)
What is printed?
Q19hard
(Code Output)

flag = False
while (NOT flag):
    print("Running")
    flag = True
print("Done")
How many times will "Running" be printed?
Q20hard
(Code Output) What does this algorithm do to an array arr of size N?

for i from 0 to N-1:
    if (arr[i] < 0):
        arr[i] = 0