C MCQ Questions and Answers on Preprocessor Directives 2

Image

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

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



1) What does #include stdio.h does in c language.?
A) It includes stdio.h into existing C program.
B) #include increases the size of C program by including the specified file contents like functions, constants etc.
C) #include includes specified file before compilation.
D) All the above
Answer [=]
Answer[=]
2) What is the abbreviation of C STDIO in stdio.h.?
A) Standard Input Output
B) String Terminating Operations Input Output
C) Store Input Output
D) None of the above
Answer [=]
Answer[=]
3) Choose a correct statement about #include<stdio.h>.?
A) A file named stdio.h will be searched in all directories and included if found
B) A file named stdio.h will be searched in current directory and included if found
C) A file named stdio.h will be searched in current directory and pre configured list of directories in search path and included if found
D) None of the above
Answer [=]
Answer[=]
4) Choose a correct C statement about #include"
A) A file named stdio.h will be searched in all directories and included if found
B) A file named stdio.h will be searched in current directory and included if found
C) A file named stdio.h will be searched in current directory and pre configured list of directories in search path and included if found
D) None of the above
Answer [=]
Answer[=]
5) In Turbo C, Search Path of Directories for #Include is mentioned under the option.?
A) Include Directories
B) Exclude Directories
C) Add Directories
D) Extra Directories
Answer [=]
Answer[=]
6) Choose a correct form of using C Conditional Compilation commands IF ELSE .?
A)
#IF macroname
    statement1;
    statement2;
#ELSE
    statement3;
    statement4;
#END
B)
#IF macroname
    statement1;
    statement2;
#ELSE
    statement3;
    statement4;
#ENDIF
C)
#IFDEF macroname
    statement1;
    statement2;
#ELSE
    statement3;
    statement4;
#ENDIF
D)
#ifdef macroname
    statement1;
    statement2;
#else
    statement3;
    statement4;
#endif
Answer [=]
Answer[=]
7) What is the output of C program with conditional compilation commands.?
#define CVV 156
int main()
{
    #ifdef CVV
        printf("CVV YES");
    #else
        printf("CVV NO");
    #endif
    return 0;
}
A) 156
B) printf("CVV YES");
C) CVV YES
D) CVV NO
Answer [=]
Answer[=]


 

8) What is the output of C program with conditional compilation commands.?
#define CVV 156
int main()
{
    #ifdef cvv
        printf("CVV YES");
    #else
        printf("CVV NO");
    #endif
    return 0;
}
A) printf("CVV YES");
B) CVV YES
C) CVV NO
D) Compiler error
Answer [=]
Answer[=]
9) What is the output of C program with preprocessor directives.?
int main()
{
    #ifdef CVV
        printf("CVV YES");
    #else
        #define CVV 199
    #endif
    printf("NEW CVV=%d",CVV);
    return 0;
}
A) CVV 199
B) printf("CVV YES");
C) CVV YES
D) NEW CVV=199
Answer [=]
Answer[=]
10) What is the output of C program.?
int main()
{
    #ifndef CVV
        #define CVV 199
        printf("CVV=%d", CVV);
    #else
        printf("CVV=%d", 188);
    #endif
    return 0;
}
A) CVV=188
B) CVV=0
C) CVV=199
D) Compiler error
Answer [=]
Answer[=]
11) What is the output of C program with Preprocessor directives.?
void show();
int main()
{
    #ifndef CVV
        #define CVV 199
    #endif
    show();
    return 0;
}
void show()
{
    printf("CVV=%d",CVV);
}
A) No output
B) CVV=0
C) CVV=199
D) Compiler error
Answer [=]
Answer[=]
12) What is the output of C program with preprocessor directives.?
int main()
{
    #ifdef CVV
        #define CVV 199
    #elif PVV
        printf("Inside ELIF");
    #else
        printf("Inside ELSE");
    #endif
    return 0;
}
A) Inside ELIF
B) Inside ELSE
C) No output
D) Compiler error
Answer [=]
Answer[=]
13) What is the output of C program with #undef.?
#define BIRD 5
int main()
{
    #ifdef BIRD
        printf("BIRD=5.");
    #else
        printf("UNKNOWN.");
    #endif
    #undef BIRD
    #define BIRD 10
    printf("BIRD=%d",BIRD);
    return 0;
}
A) BIRD=5.BIRD=5
B) BIRD=10.BIRD=10
C) BIRD=5.BIRD=10
D) Compiler error
Answer [=]
Answer[=]
14) What is the output of C program with #undef.?
int main()
{
    #undef BIRD
    printf("OKAY");
    return 0;
}
A) OKAY
B) Compiler error
C) BIRDOKAY
D) None of the above
Answer [=]
Answer[=]


 

15) What is a Pragma in C language.?
A) A Pragma may be an instruction to build tool to process or generate comments
B) A Pragma may be an instruction to compiler to execute specific functions at specific times say startup or exit of program.
C) A pragma may be an instruction to tell compiler to ignore certain warnings.
D) All the above
Answer [=]
Answer[=]
16) What is the C Pragma directive or command to execute a particular function at startup of program.?
A) #pragma start function1
B) #pragma statup function1
C) #pragma startnow function1
D) #prama startup function1
Answer [=]
Answer[=]
17) What is the output of C program with Pragma.?
void show1();
void show2();
#pragma startup show1
#pragma exit show2
int main()
{
    printf("MAIN.");
}
void show1()
{
    printf("START.");
}
void show2()
{
    printf("END.");
}
A) MAIN.START.END.
B) START.MAIN.END
C) START.END.MAIN
D) END.START.MAIN
Answer [=]
Answer[=]
18) At what stage of building a C program does Pragma work.?
A) Before Compilation
B) After compilation
C) After Linking
D) None of the above
Answer [=]
Answer[=]
19) Choose a correct implementation of C Pragma Warning.?
A) #pragma warn -par
B) #pragma warn -rch
C) #pragma warn -rvl
D) All the above
Answer [=]
Answer[=]
20) Choose a correct statement about C Macro.?
A) A Macro name can be in lower or upper case.
B) A Macro can be nested. It can use another macro as part of its implementation. #define CVV 2*OLDCVV. Here OLDCVV is another macro defined prior to Macro CVV.
C) Control is not passed to Macro as it is like just a dummy String(eg. CVV) Replacement technique with implementation (Macro Expansion part)
D) All the above
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.