Take FREE!! Online Mettl Mock Test to Crack TechM and Other Companies Written Exams.
Get Off-Campus Placement Jobs Info !!!
TCS NQT Technical and Managerial Round Interview Questions

# C Preprocessor Questions

NA
SHSTTON
59
Solv. Corr.
25
Solv. In. Corr.
84
Attempted
0 M:0 S
Avg. Time

1 / 34

What will be output of the following "c" code?
#include<stdio.h>
#define  max(a,b)  (a>b)? a:b
int  main()
{
int a,b; a=3; b=4;
printf("%d",max(a,b));
return 0;
}

A3

B4

C12

D0

ECompilation Error

Explanation:

Since, using directive statement the valus of a is less than b which is false condition in the ternery statement results to B value.

Workspace

NA
SHSTTON
19
Solv. Corr.
13
Solv. In. Corr.
32
Attempted
0 M:0 S
Avg. Time

2 / 34

What will be output of the following "c" code?
#include<stdio.h>
#define clrscr() 100
main()
{
clrscr();
printf("%d\n",clrscr());
}

AGarbage Value

BBlank

C100

DCompilation error

ENone of these

Explanation:

Preprocessor executes as a seperate pass before the execution of the
compiler. So textual replacement of clrscr() to 100 occurs.

Workspace

NA
SHSTTON
4
Solv. Corr.
28
Solv. In. Corr.
32
Attempted
0 M:0 S
Avg. Time

3 / 34

What will be output of the following "c" code?
#include<stdio.h>
#define int char
void main()
{
int i=65;
printf("sizeof(i)=%d",sizeof(i));
}

Asizeof(i)=2

Bsizeof(i)=1

Csizeof(i)=4

DCompilation error

ENone of these

Explanation:

The #define replaces the string int by the macro char

Workspace

NA
SHSTTON
16
Solv. Corr.
17
Solv. In. Corr.
33
Attempted
0 M:0 S
Avg. Time

4 / 34

What will be output of the following "c" code?
#include<stdio.h>
#define a 10
void main()
{
#define a 50
printf("%d",a);
}

AGarbage Value

BCompilation error

C50

DNone of these

Explanation:

The preprocessor directives can be redefined anywhere in the program. So the most recently assigned value will be taken.

Workspace

NA
SHSTTON
7
Solv. Corr.
26
Solv. In. Corr.
33
Attempted
0 M:0 S
Avg. Time

5 / 34

What will be output of the following "c" code?
#include<stdio.h>
#define square(x) x*x
void main()
{
int i;
i = 64/square(4);
printf("%d",i);
}

A64

B4

CCompilation error

DNone of these

Explanation:

Pre-processor will substitute square(4) by 4*4
so the expression becomes I = 64/4*4 .
Since / and * has equal priority the expression will be evaluated as (64/4)*4 => 16*4 = 64

Workspace

NA
SHSTTON
11
Solv. Corr.
19
Solv. In. Corr.
30
Attempted
0 M:0 S
Avg. Time

6 / 34

What will be output of the following "c" code?
#include<stdio.h>
#define FALSE -1
#define TRUE  1
#define NULL  0
int main() {
if(NULL)
puts("NULL");
else if(FALSE)
puts("TRUE");
else
puts("FALSE");
}

AFALSE

BTRUE

CCompilation error

DNone of these

Explanation:

Preprocessor doesn't replace the values given inside the double quotes. The check by if condition is boolean value false so it goes to else. In second if -1 is boolean value true hence "TRUE" is printed.

Workspace

NA
SHSTTON
17
Solv. Corr.
9
Solv. In. Corr.
26
Attempted
0 M:0 S
Avg. Time

7 / 34

What will be output of the following "c" code?
#include<stdio.h>
#define f(g,g2) g##g2
int main()
{
int var12=100;
printf("%d",f(var,12));
return 0;
}

A10

B100

CGarbage Value

DCompilation error

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
10
Solv. Corr.
15
Solv. In. Corr.
25
Attempted
0 M:0 S
Avg. Time

8 / 34

What will be output of the following "c" code?
#include<stdio.h>
#define prod(a,b) a*b
void main()
{
int x=3,y=4;
printf("%d",prod(x+2,y-1));
}

A10

B12

C19

D9

ENone of these

Explanation:

The macro expands and evaluates to as:
x+2*y-1
=> x+(2*y)-1
=> 3+(2*4)-1 => 10

Workspace

NA
SHSTTON
7
Solv. Corr.
14
Solv. In. Corr.
21
Attempted
0 M:0 S
Avg. Time

9 / 34

What will be output of the following "c" code?
#include<stdio.h>
#ifdef something
int some=0;
#endif
void main()
{
int thing = 0;
printf("%d %d\n", some ,thing);
}

A0

BGarbage Value

CCompiler error : undefined symbol some

DNone of these

Explanation:

This is a very simple example for conditional compilation.
The name something is not already known to the compiler making the declaration int some = 0; effectively removed from the source code.

Workspace

NA
SHSTTON
7
Solv. Corr.
12
Solv. In. Corr.
19
Attempted
2 M:28 S
Avg. Time

10 / 34

What will be output of the following "c" code?
#include<stdio.h>
#if something == 0
int some=0;
#endif

void main()
{
int thing = 0;
printf("%d %d\n", some ,thing);
}

ACompiler error : undefined symbol some

B0 0

CGarbage Value

DNone of these

Explanation:

This code is to show that preprocessor expressions are not the same as the ordinary expressions. If a name is not known the preprocessor treats it to be equal to zero.

Workspace

## C Programming C Preprocessor Questions and Answers pdf

At C Programming topic C Preprocessor, you will get multiple online quiz difficulty wise, which will have a total of 6 quizzes, categorized as easy, medium, and moderate level. While preparing for any C Preprocessor, take all the list quiz and check your preparation level for that topic. Each quiz have 10 different question, which needs to be answered in 20 min., all the listed quiz here is free, however, you will get only one chance for each quiz to attempt(Take Quiz seriously), so it is always recommended to take one quiz in each section before you start solving C Preprocessor MCQs practice question, and one after solving all the question of the respective level, you can refer back your C Preprocessor quiz result any time or you can download it as pdf for reference.

## C Programming C Preprocessor Customize Online Mock Test

This is own type of mock test, where At this C Programming C Preprocessor MCQs mock test section, you will able to attempt only the questions related to C Preprocessor, in that question will be a different level, important, and all the questions will be part of some of the mock tests across Q4interview FREE Mock test. You need to choose the topic as C Preprocessor, and click on Double click to generate your customize mock test. While attempting the mock test you need to choose any of the one options out of given option. It is recommended to go through the direction given along with each question, as these questions will be randomly and so that same direction will not be applicable across the entire test. Once you submit your mock test, the result will be generated for C Preprocessor Customize mock test, where your performance point points will be highlighted. Q4interview analysis every single point which helps you to improve your topic understanding and help you to know your type of mistakes and way to improve C Preprocessor questions, by providing the same type of practice questions from practice exercise. The best part of this C Preprocessor, all these mock tests listed here are free and you can take as Many time, as many you want. When you continue to give C Preprocessor Customize Online Mock Test here regularly, then you will understand how much you have developed your accuracy on a topic, after that you will be able to decide how much attention you need to focus on. Your continued practice will increase your confidence, speed and thinking ability intensely, the C Preprocessor Customize topic on which you will practice more will beneficial for you in future during campus placement.

## C Programming C Preprocessor Quiz Online Test

The details of the C Programming C Preprocessor quiz are as follows. There are 10 questions for you. You have to answer them in 20 minutes. Within 20 minutes you have to see the errors in the sentences given as a question. Four options are also given to you, and you have to choose your opinion. You must be confident in your answer that the choices are difficult. Therefore, below we provide you with some information about C Programming C Preprocessor that you see and keep them in mind while answering questions.

## C Programming C Preprocessor MCQs Practice Questions with Answer

On this C Preprocessor section of page you will find the easiest quickest ways to solve a question, formulas, shortcuts and tips and tricks to solve various easiest methods to solve C Preprocessor Question Quickly. It contains all the C Programming topic C Preprocessor questions which are common in any of the preliminary exams of any company. The solution is provided along with the questions. The practice of these questions is a must as they are easy as well as scoring and asked in all the exams They will confirm the selection if all the questions attempted wisely with little practice. It is recommanded to Take Mock test based on C Programming topic and C Preprocessor topic based quiz.

## C Programming C Preprocessor solved examples question

Clarity of concepts is a must if you want to master the skill of solving C Programming problems. This page contains sample C Programming C Preprocessor questions and answers for freshers and competitive exams. C Preprocessor Questions with the detailed description, the explanation will help you to master the topic. Here solved examples with detailed answer description, explanations are given and it would be easy to understand. How to solve qC PreprocessorC Programming? Here are some examples solved with the Common Rules/tricks/tips of C Programming. Enhance your chance to score maximum marks in C Programming sections through. Error Spotting Grammar Questions Online Test for Free. Fully solved Sentence Formation MCQs questions with detailed answer description. C Programming is an important topic for any exams but most aspirants find it difficult. You need to learn various tricks tips, rules, etc to solve quickly. At this page, you will find frequently asked C Preprocessor questions or problems with solutions, shortcuts, formulas for all-important competitive exams like IT companies exams, interviews. It is always a best practice to go through the example and understand the types of question and way to solve it, so let's do some examples to calculate efficiency, read through all the given here solved examples. You can post your solution, tips, trick and shortcut if you have any in respect to questions.

You can get here fully solved C Preprocessor examples with a detailed answer and description. You can solve C Preprocessor problems with solutions, the questions by companies wise by filtering the questions, additionally, you can check what type of questions are being asked in IT companies Written Round from C Preprocessor. C Preprocessor became one of the most important sections in the entire competitive exams, Companies Campus, and entrance online test. Go through C Preprocessor Examples, C Preprocessor sample questions. You can Evaluate your level of preparation in C Preprocessor by Taking the Q4Interivew C Preprocessor Online Mock Test based on most important questions. All the C Preprocessor practice questions given here along with answers and explanations are absolutely free, you can take any number of time any mock Test.

## Why C Programming C Preprocessor?

In this practice section, you can practice C Programming Questions based on "C Preprocessor" and improve your skills in order to face the interview, competitive examination, IT companies Written exam, and various other entrance tests (CAT, GATE, GRE, MAT, Bank Exam, Railway Exam etc.) with full confidence.

## Where can I get C Programming C Preprocessor questions and answers with explanation?

Q4Interview provides you lots of fully solved C Programming (C Preprocessor) questions and answers with Explanation. Solved examples with detailed answer description, explanation are given and it would be easy to understand. You can download C Programming C Preprocessor quiz questions with answers as PDF files and eBooks.

## Where can I get C Programming C Preprocessor Interview Questions and Answers (objective type, multiple-choice, quiz, solved examples)?

Here you can find objective type C Programming C Preprocessor questions and answers for interview and entrance examination. Multiple choice and true or false type questions are also provided.