Select chapter



functions (3.papers)
loops (1.papers)
arrays (2.papers)
structures (3.papers)
unions (1.papers)
pointers (7.papers)
null pointers (1.papers)
strings (2.papers)
misc c concepts (1.papers)
Data structures (5.papers)
linked lists (3.papers)
trees (1.papers)
basics (5.papers)
Hide

Sponsored Links


  

c enums and typedefs interview questions and answers

1
What is the difference between #include <stdio.h> and #include "stdio.h"?
  1. <> used for standard pre defined header files, " " used for programmer's defined header files." " header files will be searched first in current directory, and if not found then searched in standard places where predefined header files are searched.
  2. " " used for standard pre defined header files, < > used for programmer's defined header files." " header files will be searched first in current directory, and if not found then searched in standard places where predefined header files are searched.
  3. option 1 is true, but only with one difference < > header files will be searched first in current directory and then searched in default header place.
  4. None of the above are true.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
5
Is it  possible to use sizeof operator with #if directive, in c?
  1. yes
  2. no because #if accepts only constants.
  3. no because sizeof will not be calculated at pre processing time.
  4. none of the above are true.
Show Answer
Share Facebook gmail Twitter
6
Example for __file__  and __line__ in c:

What is the output of below c program?

int main(void)
{
    printf("%d %s",__LINE__, __FILE__);
    return 0;
}
  1. compile time error.
  2. 5 and name of the file with path.
  3. 3 and name of the file with path.
  4. none of the above are true.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
11
multiple inclusion of header files in c:
How to avoid the problem of multiple inclusion of same header file?
  1. it can't be resolved in C. It is the problem.
  2. Use #ifndef macro technique as the first line in the header file..
  3. Use reverse engineering technique by opening all the files and manually check if any duplicated header files are included.
  4. C pre processor will automatically put a check to see if any header files are repeatedly included in any header or c source files. if there are any c pre processor will automatically remove.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
13
In the below program which all the lines will not be compiled?
#ifndef MY_C_FILE
#define MY_C_FILE

#include  <stdio.h>

int main(void)
{
    #ifdef MY_C_FILE
    printf("skill gun technologies");
    #else
    printf("virus");
    #endif
    return 0;
}

#endif
  1. printf("virus"); will not be compiled.
  2. all the lines will be compiled but output will be only skill gun technologies.
  3. printf("skill gun technologies"); will not be compiled.
  4. whole program will be compiled and output is it prints both.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
18
What is the output of below c program?

#include  <stdio.h>

#define INFINITE() for(int i=0; i<100; i++)\
                  {\
                      printf("%d ",i);\
                  }

int main(void)
{
    int i;
    INFINITE();
    return 0;
}
  1. compile time error, undefined function INFINITE()
  2. Pre processing error, illegal use of function INFINITE().
  3. Compile time e error, misplaced semicolon ;
  4. prints 0 to 99.
Show Answer
Share Facebook gmail Twitter
19
What is the output of below c program?

#include  <stdio.h>
#define HACKING

#define VAL \
        #ifdef HACKING 0 \
        #else 1
        #endif

int main(void)
{
    printf("%d",VAL);
    return 0;
}
  1. prints 0
  2. prints 1
  3. pre processing time error, pre processing directives can't be applied to other pre processing directives.
  4. compile time error, invalid expression.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Read more papers :