In C, how do you use the #ifndef directive to conditionally include code if a macro is not defined?
A. #ifndef MACRO
B. #ifndef(MACRO)
C. #ifndef:MACRO
D. #ifndef: MACRO
Select an option to see the answer and solution.
What does the #pragma once directive do in C preprocessing?
A. Prevents multiple inclusion of header files
B. Defines a macro
C. Checks for syntax errors
D. Excludes code
Select an option to see the answer and solution.
In C, what is the purpose of the #ifdef directive?
A. Checks if a macro is defined
B. Checks if a macro is not defined
C. Defines a macro
D. Includes a header file
Select an option to see the answer and solution.
What is the purpose of the #pragma warning directive in C preprocessing?
A. Generates a warning message
B. Defines a macro
C. Checks for syntax errors
D. Excludes code
Select an option to see the answer and solution.
In C preprocessing, what is the purpose of the #elifdef directive?
A. Checks if a macro is defined
B. Checks if a macro is not defined
C. Provides an alternative condition
D. Defines a macro
Select an option to see the answer and solution.
What is the result of the #pragma message directive in C preprocessing?
A. Includes a message in the code
B. Defines a macro
C. Checks for syntax errors
D. Excludes code
Select an option to see the answer and solution.
What is the purpose of the #undef directive in C preprocessing?
A. Undefines a macro
B. Defines a macro
C. Checks for syntax errors
D. Excludes code
Select an option to see the answer and solution.
In C preprocessing, what is the purpose of the #elifndef directive?
A. Checks if a macro is defined
B. Checks if a macro is not defined
C. Provides an alternative condition
D. Defines a macro
Select an option to see the answer and solution.
What is the result of the #pragma warning directive in C preprocessing?
A. Generates a warning message
B. Defines a macro
C. Checks for syntax errors
D. Excludes code
Select an option to see the answer and solution.
In C, what is the purpose of the #line directive?
A. Specifies the line number and filename in the source file
B. Defines a macro
C. Checks for syntax errors
D. Excludes code
Select an option to see the answer and solution.
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
Select an option to see the answer and solution.
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
Select an option to see the answer and solution.
What will be the output of the program?
#include<stdio.h>
#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
Select an option to see the answer and solution.
What will be the output of the following program?
#include<stdio.h>
#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
Select an option to see the answer and solution.
What will be the output of the program code?
#include<stdio.h>
#define a 10
void main()
{
#define a 50
printf("%d", a);
}A. 50
B. 10
C. Compiler Error
D. None of These
Select an option to see the answer and solution.
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
Select an option to see the answer and solution.
Determine output:
#include<stdio.h>
#define clrscr() 100
void main()
{
clrscr();
printf("%dn", clrscr());
}Select an option to see the answer and solution.
What will be the output of the following program?
#include<stdio.h>
#define prod(a,b) a*b
void 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
Select an option to see the answer and solution.
In which stage the following code
#include<stdio.h>
gets 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
Select an option to see the answer and solution.
What will be output if you will compile and execute the following c code?
#include<stdio.h>
#define max 5
void main(){
int i = 0;
i = max++;
printf("%d", i++);
}A. 5
B. 6
C. 7
D. 0
E. Compiler Error
Select an option to see the answer and solution.