Sail E0 Webinar

MCQs

Total Questions : 13 | Page 1 of 2 pages
Question 1. C preprocessor
  1.    Takes care of conditional compilation
  2.    Takes care of macros
  3.    Takes care of include files
  4.    Acts before compilation
  5.    All of the above
 Discuss Question
Answer: Option E. -> All of the above
Question 2. What will be the output of the program?
#include
#define int char
void main()
{
int i = 65;
printf("sizeof(i)=%d", sizeof(i));
}
  1.    sizeof(i)=2
  2.    sizeof(i)=1
  3.    Compiler Error
  4.    None of These
 Discuss Question
Answer: Option B. -> sizeof(i)=1
Question 3. A preprocessor command
  1.    need not start on a new line
  2.    need not start on the first column
  3.    has # as the first character
  4.    comes before the first executable statement
 Discuss Question
Answer: Option C. -> has # as the first character
Question 4. What will be the output of the following program?
#include
#define square(x) x*x
void main()
{
int i;
i = 64/square(4);
printf("%d", i);
}
  1.    4
  2.    64
  3.    16
  4.    None of These
 Discuss Question
Answer: Option B. -> 64
Question 5. What will be the output of the program code?
#include
#define a 10
void main()
{
#define a 50
printf("%d", a);
}
  1.    50
  2.    10
  3.    Compiler Error
  4.    None of These
 Discuss Question
Answer: Option A. -> 50
Question 6. Choose the correct statement.
I.   The scope of a macro definition need not be the entire program.
II.  The scope of a macro definition extends from the point of definition to the end of the file.
III. New line is a macro definition delimiter.
IV.  A macro definition may go beyond a line.
  1.    I and II
  2.    II and III
  3.    I, II and III
  4.    II, III and IV
  5.    I, II, III and IV
 Discuss Question
Answer: Option E. -> I, II, III and IV
Question 7. Determine output:
#include
#define clrscr() 100
void main()
{
clrscr();
printf("%dn", clrscr());
}
  1.    0
  2.    1
  3.    100
  4.    Error
 Discuss Question
Answer: Option C. -> 100
Question 8. In which stage the following code
#include
gets replaced by the contents of the file stdio.h
  1.    During Preprocessing
  2.    During Execution
  3.    During linking
  4.    During Editing
  5.    None of these
 Discuss Question
Answer: Option A. -> During Preprocessing
Question 9. What will be output if you will compile and execute the following c code?
#include
#define max 5
void main(){
int i = 0;
i = max++;
printf("%d", i++);
}
  1.    5
  2.    6
  3.    7
  4.    0
  5.    Compiler Error
 Discuss Question
Answer: Option E. -> Compiler Error
Question 10. What will be the output of the following program?
#include
#define prod(a,b) a*b
void main()
{
int x=3,y=4;
printf("%d", prod(x+2,y-1));
}
  1.    15
  2.    12
  3.    10
  4.    11
  5.    None of these
 Discuss Question
Answer: Option C. -> 10

Latest Videos

Latest Test Papers