Machine-translated by Google. Questions are authored in English.
Top

Discussion

What will be output for the following code?

  • A.Error
  • B.5
  • C.6
  • D.2

Answer: A

Correct answer: Error, though the code this depends on is missing

The program listing this question asks about is absent from the record - only the words “What will be output for the following code?” survive, with nothing following them. The four options are “Error”, 5, 6 and 2, and the item is keyed to “Error”, so the original code presumably contained a mistake the compiler would reject. Which mistake cannot be recovered from what remains. The topic is structures, unions and enumerations, where the commonest sources of a compile error are using the dot operator on a pointer to a structure instead of ->, omitting the tag or the semicolon that must follow a struct definition, assigning to an enumeration constant, or taking sizeof an incomplete type. The item needs its listing restored before it can be worked.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.