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

Functions Questions and Answers

121.

What is the format identifier for “static a = 20.5;”?

Answer: B

Correct answer: %d

With no type given, static a = 20.5; falls back on the old implicit int, so the value is truncated to 20 and the correct specifier is %d. The declaration is legal only under the pre-C99 rules; a modern compiler will warn or reject it.

Please log in or register to report this question.

123.

Is initialization mandatory for local static variables?

Answer: B

Correct answer: NO

Initialisation is optional. A static variable with no initialiser is zero-initialised automatically, since it has static storage duration - unlike an automatic variable, which would hold junk. (If an initialiser is given, it must be a constant expression.)

Please log in or register to report this question.

Loading…

Other Subjects

Tags: Functions Questions and Answers || Functions MCQ Questions and Answers || Functions GK Questions and Answers || Functions GK MCQ Questions || Functions Multiple Choice Questions and Answers || Functions GK || GK on Functions || C Programming Questions and Answers || C Programming MCQ Questions and Answers || C Programming GK Questions and Answers || GK on C Programming