Skip to content
Official PYQ · 1994

GATE CS 1994 Q1.5 — Programming in C

Explain with AI

An unrestricted use of the "gotogoto" statement is harmful because

Choose one option
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 goto statements 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 goto statement 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.

Published
Report a correction
Keep exploringMore Programming in C questions