Explore topic-wise MCQs in C.

This section includes 8 Mcqs, each offering curated multiple-choice questions to sharpen your C knowledge and support exam preparation. Choose a topic below to get started.

1.

PRAGMA_GCC_POISON_SHOULD_BE_FOLLOWED_BY_A_LIST_OF_IDENTIFIERS_THAT_ARE__________?$

A. even in number
B. odd in number
C. valid
D. invalid
Answer» B. odd in number
2.

The function of __attribute__((packed)); can also be performed using ________?

A. pragma pack(1);
B. pragma pack(2);
C. pragma pack(4);
D. pragma pack(8);
Answer» E.
3.

The pragma ___________________ is used to remove an identifier completely from a program.

A. GNU piston
B. GCC poison
C. GNU poison
D. GCC piston
Answer» B. GCC poison
4.

The correct syntax of the attribute packed is _________

A. __attribute__((packed));
B. _attribute(packed);
C. _attribute_((packed));
D. __attribute__(packed);
Answer» C. _attribute_((packed));
5.

In the directive #pragma pack(n), if the value of ‘n’ is given to be 5, then what happens?$

A. Error
B. Warning but no error
C. Executes the pragma statement
D. Ignores the pragma statement and executes the program
Answer» B. Warning but no error
6.

Which of the following attributes is used to specify that the minimum required memory to be used to represent the types?

A. packed
B. aligned
C. unused
D. deprecated
Answer» E.
7.

In the directive, #pragma pack(n), which of the following is not a valid value of n?

A. 1
B. 2
C. 3
D. 4
Answer» B. 2
8.

The preprocessor directive used to give additional information to the compiler, beyond which is conveyed in the language _____________

A. include
B. define
C. pragma
D. elif
Answer» D. elif