Identify the macro(s) defined in stdarg.h.
Answer: D
The macro(s) defined in stdarg.h is all.
Enter details here
What will be the output of the following C code?
#include
#define sf 10
main()
{
if(sf==100)
printf("good");
else
{
printf("bad");
sf=100;
}
printf("%d",sf);
}
Answer: D
The above code will result in an error because a macro cannot be defined using a simple assignment operator. In the code shown above, the value of sf is changed to 100 using the assignment operator. This causes an error.
Enter details here
Undefined function calls in a C program.
Answer: C
No answer description available for this question.
Enter details here
There exists a way to prevent the same file from getting #included twice in the same program.
Answer: A
No answer description available for this question.
Enter details here
Macros have a local scope.
Answer: B
False, The scope of macros is globals and functions. Also the scope of macros is only from the point of definition to the end of the file.
Enter details here
What will the SWAP macro in the following program be expanded to on preprocessing? will the code compile?
#include
#define SWAP(a, b, c)(c t; t=a, a=b, b=t)
int main()
{
int x=10, y=20;
SWAP(x, y, int);
printf("%d %d\n", x, y);
return 0;
}
Answer: C
The code won't compile since declaration of t cannot occur within parenthesis.
Enter details here
#include
#define ISEQUAL(X, Y) X == Y
int main()
{
#if ISEQUAL(X, 0)
printf("Geeks");
#else
printf("Quiz");
#endif
return 0;
}
Output of the above program?
Answer: A
No answer description available for this question.
Enter details here
#include statement must be written __________
Answer: B
Using these directives before main() improves readability.
Enter details here
Preprocessor directive #undef can be used only on a macro that has been #define earlier
Answer: A
No answer description available for this question.
Enter details here
Point out the error in the program
#include
#define SI(p, n, r) float si; si=p*n*r/100;
int main()
{
float p=2500, r=3.5;
int n=3;
SI(p, n, r);
SI(1500, 2, 2.5);
return 0;
}
Answer: C
No answer description available for this question.
Enter details here