Q: Which of the following languages does NOT support the do-while loop?
-
A
C++
-
B
Java
-
C
Python
-
D
C#
C
Answer:
C
Explanation:
Python does not natively support the do-while loop construct. While C++, Java, and C# all include do-while loops as part of their syntax, Python relies solely on the while loop for its looping structures. In Python, you can simulate a do-while loop by using a while True loop with a break condition inside, but there is no formal syntax for it. This is because Python tends to favor simpler control structures, and the designers opted not to include a separate do-while loop.
Related Topic:
Share Above MCQ