What is the output of this program?
#include
#include
#define square(x) x*x
int main()
{
int i;
i = 27/square(3);
printf("%d",i);
return 0;
}
Answer: D
Operators enjoys priority / is given more priority over *. In this program the execution takes place in this format. 27 / square(3) 27 / 3*3 27 / 3*3 9 * 3 27
Enter details here
What will be the output of the following C code?
#include
#define INDIA 1
#define US 2
#define CC US
main()
{
#if CC==INDIA
printf("Rupee");
#elif CC==US
printf("Dollar");
#else
printf("Euro");
#endif
}
Answer: C
The output of the code shown above is Dollar. Since the macro CC is defined as US at the beginning of the code, it satisfies the condition #elif(CC==US). Hence “Dollar” is printed.
Enter details here
Tn a macro call the control is passed to the macro.
Answer: B
No answer description available for this question.
Enter details here
What is the use of "#pragma once"?
Answer: A
No answer description available for this question.
Enter details here
What will be the output of the program?
#include
#define MAX(a, b) (a > b ? a : b)
int main()
{
int x;
x = MAX(3+2, 2+7);
printf("%d\n", x);
return 0;
}
Answer: B
No answer description available for this question.
Enter details here
#pragma exit is primarily used for?
Answer: C
It is primarily used for running a function upon exiting the program.
Enter details here
#include
#if X == 3
#define Y 3
#else
#define Y 5
#endif
int main()
{
printf("%d", Y);
return 0;
}
What is the output of the above program?
Answer: B
No answer description available for this question.
Enter details here
What will be the output of the following C code?
#include
#define hello 10
main()
{
#ifdef hello
#undef hello
#define hello 100
#else
#define hello 200
#endif
printf("%d",hello);
}
Answer: C
No answer description available for this question.
Enter details here
A header file contains macros, structure declaration and function prototypes.
Answer: A
True, the header file contains classes, function prototypes, structure declaration, macros.
Enter details here
What will be the output of the program?
#include
#define MESS junk
int main()
{
printf("MESS\n");
return 0;
}
Answer: B
No answer description available for this question.
Enter details here