Explore topic-wise MCQs in C Program.

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

1.

Find the output of the following program.#define INC(X) X++void main(){ int x=4; printf("%d", INC(x++));}%!

A. 4
B. 5
C. 6
D. Error
Answer» E.
2.

The output of the following program is:#define f(g,g2) g##g2void main(){ int var12=100; printf("%d", f(var,12));}%!

A. Syntax error
B. Runtime error
C. g##g2
D. 100
E. 10012
Answer» E. 10012
3.

What will be output after executing following code?#include# define a 10void main(){ printf("%d..", a); foo(); printf("%d", a);}void foo(){ #undef a #define a 50}%!

A. 10..50
B. 10..10
C. 0
D. Error
Answer» C. 0
4.

What will be the output of the program code?#include#define a 10void main(){ #define a 50 printf("%d", a);}

A. 50
B. 10
C. Compiler Error
D. None of These
Answer» B. 10
5.

What will be the output of the following program?#include#define square(x) x*x void main(){ int i; i = 64/square(4); printf("%d", i); }

A. 4
B. 64
C. 16
D. None of These
Answer» C. 16
6.

What will be the output of the program?#include#define int char void main(){ int i = 65; printf("sizeof(i)=%d", sizeof(i));}

A. sizeof(i)=2
B. sizeof(i)=1
C. Compiler Error
D. None of These
Answer» C. Compiler Error
7.

A preprocessor command

A. need not start on a new line
B. need not start on the first column
C. has # as the first character
D. comes before the first executable statement
Answer» D. comes before the first executable statement
8.

C preprocessor

A. Takes care of conditional compilation
B. Takes care of macros
C. Takes care of include files
D. Acts before compilation
E. All of the above
Answer» F.
9.

What will be output if you will compile and execute the following c code?#include#define max 5void main(){ int i = 0; i = max++; printf("%d", i++);}

A. 5
B. 6
C. 7
D. 0
E. Compiler Error
Answer» F.
10.

In which stage the following code#includegets replaced by the contents of the file stdio.h

A. During Preprocessing
B. During Execution
C. During linking
D. During Editing
E. None of these
Answer» B. During Execution
11.

What will be the output of the following program?#include#define prod(a,b) a*bvoid main(){ int x=3,y=4; printf("%d", prod(x+2,y-1));}

A. 15
B. 12
C. 10
D. 11
E. None of these
Answer» D. 11
12.

Determine output:#include#define clrscr() 100void main(){ clrscr(); printf("%dn", clrscr());}

A. 0
B. 1
C. 100
D. Error
Answer» D. Error
13.

Choose the correct statement.I.¬¨‚Ä ¬¨‚Ä ¬¨‚Ä The scope of a macro definition need not be the entire program.II.¬¨‚Ä ¬¨‚Ä The scope of a macro definition extends from the point of definition to the end of the file.III.¬¨‚Ä New line is a macro definition delimiter.IV.¬¨‚Ä ¬¨‚Ä A macro definition may go beyond a line.$

A. I and II
B. II and III
C. I, II and III
D. II, III and IV
E. I, II, III and IV
Answer» F.