1) What are the types of C Preprocessor Directives.?
B) Conditional Compilation
2) Processor Directive in C language starts with.?
A) $ symbol (DOLLAR)
B) @ symbol (At The Rate)
3) Preprocessor in C language works on.?
A) DOTC file (.c)
.C file is also called Source Code file.
4) What is the another name for .C file.?
A) Executable code
5) What is the keyword used to define a C macro.?
#define PI 3.1428
6) What is the output of C program with #define.?
#define CVV 156
a = a*CVV;
During expansion of source code, a=a*CVV is replaced with a=a*156. #define is used to declare global constants.
7) What is the C keyword used to create global Constants.?
#define KM 1.6
8) Choose a correct C statement about #define statement.?
#define CVV 156
A) CVV is called Macro Expansion. 156 is called Macro Template.
B) CVV is called Macro Expansion. 156 is also called Macro Expansion.
C) CVV is called Macro Template. 156 is called Macro Expansion.
9) What is the output file generated after processing a .C file.?
A) .h file
Yes. C program is converted to an executable file for distribution to outside world instead of sharing your original source code which may be copy righted logic.
10) How do you safeguard your .C file code from copying by outside developers or world.?
A) Encrypt a C file and share
B) Obfuscate a C file and share
C) Scramble a C file and share
D) Convert to Exe and share.
11) What is the output of C program with macros.?
#define ERRMSG printf("Some error.");
In place of ERRMSG corresponding macro expansion is substituted blindly.
12) What is the output of C program with macros.?
#define ERRMSG(a) printf("Error=%d",a);
Inside main the statment printf("Error=%d",10) is substituted.
13) What is the output of C program.?
#define LOGIC(a,b) (a==b)
LOGIC(5,5) is replaced by (5==5) with outer paranthesis.
14) How do you separate a multiline macro in C language.?
A) Using * operator
#define LOOP(a) while(a>0) \
15) What is the output of C program.?
#define LOOP(a) for(int i=1;i<=a;i++) \
5 in LOOP(5) will be a condition for the FOR loop starting from i=1.
16) What is the output of C program.?
#define TANK(a) a*10+2
int a = TANK(2)*2;
TANK(2)*2 is replaced by 2*20+2*2. It gives only 24. Remember, you should have put (a*10+2) paranthesis TANK definition to get expected results.
17) What is the file extension of expanded source code of .C file after preprocessing.?
A) .e file
def.c is converted into def.l file.
18) What is the command to preprocess a C file manually.?
A) pp abc.c
cpp refers to C Pre Processor.
19) Choose a correct statement about C Macro.?
A) Macro template(eg. PI or function) will be replaced by Macro Expansion(3.1428) as many number of times as it appears in the C program increasing Source Code size in bytes.
B) Macros increase program speed when compared to functions.
C) Functions use less memory as the program code is written and placed only one place in source code. Macros put function code everywhere it is called again and again.
20) What is the C Preprocessor directive to be used to add a header file or any file to existing C program.?