C MCQ Questions and Answers on Preprocessor Directives 1

Image

Study C MCQ Questions and Answers on Preprocessor Directives. Easily attend technical job interviews with these Mulitple Choice Questions.

Go through C Theory Notes on Preprocessor Directives before studying questions.



1) What are the types of C Preprocessor Directives.?
A) Macros
B) Conditional Compilation
C) File Inclusion
D) All the above
Answer [=]
Answer[=]
2) Processor Directive in C language starts with.?
A) $ symbol (DOLLAR)
B) @ symbol (At The Rate)
C) & symbol (Ampersand)
D) # symbol (HASH)
Answer [=]
Answer[=]
3) Preprocessor in C language works on.?
A) DOTC file (.c)
B) DOTEXE file (.exe)
C) DOTH file (.h)
D) DOTCP file (.cp)
Answer [=]
Answer[=]
4) What is the another name for .C file.?
A) Executable code
B) Source Code
C) Distributable Code
D) Macro code
Answer [=]
Answer[=]
5) What is the keyword used to define a C macro.?
A) def
B) definition
C) define
D) defy
Answer [=]
Answer[=]
6) What is the output of C program with #define.?
#define CVV 156
int main()
{
    int a=10;
    a = a*CVV;
    printf("CVV=%d",a);
    return 0;
}
A) 0
B) 1560
C) 1560
D) Compiler error
Answer [=]
Answer[=]
7) What is the C keyword used to create global Constants.?
A) constant
B) definition
C) def
D) define
Answer [=]
Answer[=]


 

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.
D) None of the above
Answer [=]
Answer[=]
9) What is the output file generated after processing a .C file.?
A) .h file
B) .exe file
C) .cp file
D) .bak file
Answer [=]
Answer[=]
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.
Answer [=]
Answer[=]
11) What is the output of C program with macros.?
#define ERRMSG printf("Some error.");
int main()
{
    printf("JAR.");
    ERRMSG;
    return 0;
}
A) JAR.
B) JAR.ERRMSG
C) JAR.Some error.
D) Compiler error
Answer [=]
Answer[=]
12) What is the output of C program with macros.?
#define ERRMSG(a) printf("Error=%d",a);
int main()
{
    ERRMSG(10);
    return 0;
}
A) ERRMSG(10)
B) Error=
C) Error=10
D) Compiler error
Answer [=]
Answer[=]
13) What is the output of C program.?
#define LOGIC(a,b) (a==b)
int main()
{
    if(LOGIC(5,5))
    {
        printf("SAME ");
    }
    return 0;
}
A) SAME
B) LOGIC(5,5)
C) 5==5
D) Compiler error
Answer [=]
Answer[=]
14) How do you separate a multiline macro in C language.?
A) Using * operator
B) Using % operator
C) Using \ operator
D) Using + operator
Answer [=]
Answer[=]


 

15) What is the output of C program.?
#define LOOP(a) for(int i=1;i<=a;i++) \
{printf("%d ",i);}
int main()
{
    LOOP(5);
    return 0;
}
A) 5
B) 5 5 5 5 5
C) 1 2 3 4 5
D) Compiler error
Answer [=]
Answer[=]
16) What is the output of C program.?
#define TANK(a) a*10+2
int main()
{
    int a = TANK(2)*2;
    printf("%d",a);
    return 0;
}
A) 44
B) 22
C) 24
D) Compiler error
Answer [=]
Answer[=]
17) What is the file extension of expanded source code of .C file after preprocessing.?
A) .e file
B) .h file
C) .l file
D) .p file
Answer [=]
Answer[=]
18) What is the command to preprocess a C file manually.?
A) pp abc.c
B) cpp abc.c
C) exp abc.c
D) op abc.c
Answer [=]
Answer[=]
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.
D) All the above
Answer [=]
Answer[=]
20) What is the C Preprocessor directive to be used to add a header file or any file to existing C program.?
A) #add
B) #present
C) #include
D) $include
Answer [=]
Answer[=]


Like or Share

Show some care. Like or Subscribe. [FB]...[Youtube]

C MCQ App by ExamTray 

Android APP

Java MCQ App by ExamTray 

Android APP
ALL MCQ App by ExamTray Android APP

Ad

 

Some good C Books

Book Price
1. C: The Complete Reference  Check Price
2. Let Us C Check Price
3. Programming in ANSI C Check Price
4. The C Programming Language Check Price

We may get some affiliate commission for the above purchases.