An unrestricted use of the "" statement is harmful because
View worked solution
Answer: A
The unrestricted use of the goto statement is considered harmful because it violates the principles of structured programming. This concept was famously detailed by Edsger Dijkstra in his 1968 paper "Go To Statement Considered Harmful".
Let's analyze the options:
- Option A (Correct): Unrestricted
gotostatements allow arbitrary transfers of control, leading to what is commonly known as "spaghetti code". This unstructured flow makes it extremely difficult to trace execution paths, reason about program states, and perform formal program verification. - Option B (Incorrect): A
gotostatement translates to a low-level jump instruction, which does not inherently increase the execution time of the program. - Option C (Incorrect): It has no direct impact on the memory allocation or memory footprint of the program.
- Option D (Incorrect): It does not force the compiler to generate longer machine code; branch instructions are standard and compact in machine language.
Thus, the primary harm of unrestricted goto usage is that it makes programs significantly harder to understand, maintain, and verify.
Free practice · Your answers on this page are not saved.
