LakshyaEducation.in

VEDIC MATHS Video Series
  • Home
  • Video Series
    • Vedic Maths Videos
    • Quantitative Aptitude Videos
    • Class 8 Maths Videos
    • Class 9 Maths Videos
    • Class 10 Maths Videos
  • Quiz & Solutions
  • Blog
  • Store
  • Login
  • Contact Us
  • Home
  • Topic
  • C Programming
  • C Preprocessor

C Programming

C PREPROCESSOR MCQs

Total Questions : 43

Page 1 of 5 pages
Question 1.

Will it result in to an error if a header file is included twice?


  1.    Yes
  2.    No
  3.    It is compiler dependent.
 Discuss Question
Answer is Option C. -> It is compiler dependent.

Unless the header file has taken care to ensure that if already included it doesn't 

get included again.

Turbo C, GCC compilers would take care of these problems, generate no error.

Question 2.

Will the program compile successfully?
#include<stdio.h>

int main()

{

      #ifdef  NOTE

            int     a;

            a = 10;

      #else

           int a;

           a=20;

       #endif

        printf("%d`setminus`n" , a)'

        return 0;

}



  1.    Yes
  2.    No
 Discuss Question
Answer is Option A. -> Yes

Yes, this program will compile and run successfully and prints 20.

The macro #ifdef NOTE evaluates the given expression to 1. If satisfied it executes the 

#ifdefblock statements. Here #ifdef condition fails because the Macro NOTE is nowhere declared.

Hence the #else block gets executed, the variable a is declared and assigned a value of 20.

printf("%dn", a); It prints the value of variable a 20.

Question 3.

It is necessary that a header files should have a .h extension?


  1.    Yes
  2.    No
 Discuss Question
Answer is Option B. -> No

No, the header files have any kind of extension.

Question 4.

Would the following typedef work?
typedef #include l;


  1.    Yes
  2.    No
 Discuss Question
Answer is Option B. -> No

Because typedef goes to work after preprocessing.

Question 5.


Will the program compile successfully?



#include<stdio.h>
#define X (4+Y)
#define Y (X+3)

int main()
{
printf("%d\n", 4*X+2);
return 0;
}


  1.    Yes
  2.    No
 Discuss Question
Answer is Option B. -> No

Reports an error: Undefined symbol 'X'

Question 6.

Once preprocessing is over and the program is sent for the compilation the macros are removed

 from the expanded source code.


  1.    True
  2.    False
 Discuss Question
Answer is Option A. -> True

True, After preprocessing all the macro in the program are removed.

Question 7.

A preprocessor directive is a message from compiler to a linker.


  1.    True
  2.    False
 Discuss Question
Answer is Option B. -> False

FALSE

Example: #define symbol replacement

When the preprocessor encounters #define directive, it replaces any occurrence of symbol in 

the rest of the code by replacement. This replacement can be an statement or expression or a

 block or simple text.

Question 8.

The preprocessor can trap simple errors like missing declarations, nested comments or mismatch of braces.


  1.    True
  2.    False
 Discuss Question
Answer is Option B. -> False

False, the preprocessor cannot trap the errors, it only replaces the macro with the given 

expression. But the compiler will detect errors.

Question 9.

A header file contains macros, structure declaration and function prototypes.


  1.    True
  2.    False
 Discuss Question
Answer is Option A. -> True

True, the header file contains classes, function prototypes, structure declaration, macros.

Question 10.

In a macro call the control is passed to the macro.


  1.    True
  2.    False
 Discuss Question
Answer is Option B. -> False

False, Always the macro is substituted by the given text/expression.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Next →
  • Share on Facebook!
  • Share on Pinterest!

Sub Topics

  • Arrays
  • Bitwise Operators
  • C Preprocessor
  • Command Line Arguments
  • Complicated Declarations
  • Const
  • Control Instructions
  • Declarations And Initializations
  • Expressions
  • Floating Point Issues
  • Functions
  • Input / Output
  • Library Functions
  • Memory Allocation
  • Pointers
  • Strings
  • Structures
  • Subleties Of Typedef
  • Variable Number Of Arguments

Recent Posts

  • Quantitative Aptitude Faqs
  • Ssc Exam Guide Book
  • Best Ssc Exam For Girls
  • Sail E0 Exam Results Cancelled - Exam Will Be Rescheduled
  • Sail E0 Results 2022
  • Is Ssc Difficult Than Upsc?
  • Vedic Maths Faq

Recent Questions

Q.   Reduced Distance Between Last Operating Comb And Drawing Uni....

Q.   Lactic Acid Is Formed In ______.

Q.   A Varactor Diode Is Used For

Q.   Arun Said, "This Girl Is The Wife Of The Grandson Of My Moth....

Q.   A Man Swims Relative To Water With A Velocity Greater Than R....

Q.   A Dealer Allows A Discount Of 15%. A Customer Pays An Amount....

Q.   A Sanguine Outlook Is Associated With The ......

Q.   A URL Specifies The Following : (i) Protocol Used (ii) Domai....

Q.   Q Factor For A Series Resonant Circuit Is?

Q.   Which Of The Following Is Not A Component Of Working Capital....

Q.   Indipaisa Has Signed A Partnership Agreement With Which Paym....

Q.   Cell Membrane Is Virtually Impermeable To All Ions Except

Q.   Media Used For The Production Of Chlorotetracyclin Consists ....

Q.   Euler's Equation Of Motion Is A Statement Expressing

Q.   Which Command Allows You To View Your File 24 Lines At A Tim....

Q.   Which Of The Following Branch Of Physics Deal With Study Of ....

Q.   If Nucleon (mass) And Proton (atomic) Number Is 40 And 20 Re....

Q.    in One Hour, A Boat Goes 11 Km . Along The Steam And 5 Km ....

Q.   In Addition To The RNA Polymerase, There Are Also A Number O....

Q.   Width Of Complete Chain Of Cellulose Fibre Is

Topics

Computer Aptitude
SAIL Junior Officer (E-0)
10th Grade
11th Grade
12th Grade
4th Grade
5th Grade
6th Grade
7th Grade
8th Grade
9th Grade
NCERT
Cat
Commerce
Computer Science
Engineering
English
General Knowledge
Ias
Management
Quantitative Aptitude
Reasoning Aptitude
General Studies (Finance And Economics)
Vedic Maths
Analytical Instrumentation
Biochemistry
Bioinformatics
Biology
Biotechnology
Bitsat
Business Statistics
C Programming
C++ Programming
Cell Biology
Chemistry
Cost Accounting
Drug And Pharmaceutical Biotechnology
Electrical Measurement And Instrumentation
Environment Management
Environmental Biotechnology
Enzyme Technology
Financial Management And Financial Markets
Gate
General Science
Geography
Heat Transfer
History And National Movements
Human Anatomy And Physiology
Human And Cultural Diversity
Human Resource Management
Indian Economy
Indian Geography
Indian History
Indian Polity
Instrumentation Transducers
International Relations
Life Sciences
Marketing And Marketing Management
Mass Transfer
Mechanics Of Materials
Microbiology
Neet
Professional Communication
Renewable Energy
Sociology
Surveying
Total Quality Management
Uidai Aadhaar Supervisor Certification
Virology
LakshyaEducation.in
Lakshya Education
Bhilai,Chattisgarh,India
Email: admin@lakshyaeducation.in Phone: 07893519977 (WhatsApp)

Quick Links

  • Vedic Maths
  • Quantitative Aptitude
  • Class – IX Maths
  • Class – X Maths
  • Blog

Our Services

  • About us
  • Privacy
  • TOS
  • Refund / Cancellation
  • Contact
  • Affiliate Program
  • Copyright © 2022 All Right Reserved | Lakshya Education     ( )
    Login / Register

    Your Account will be created automatically when you click the below Google or Facebook Login Button.
    •   Login With Facebook
    •  Login With Google
     Login With Email/Password