Online Test for C

  1. C programs are converted into machine language with the help of a program called Editor.
    True
    False

  1. Which is the right way to declare constant in C?
    int constant var =10;
    int const var = 10;
    const int var = 10;
    B & C Both


  1. #define is known as preprocessor compiler directive.
    True
    False

  1. What will be the output of 5.0 / 2?
    2
    3
    0
    2.5

  1. Find Error/Output in follwing code:
  2.                                 
    int main ()
    
    {
      int check = 2;
      switch (check)
        {
        case 1:
          printf ("D.W.Steyn");
        case 2:
          printf (" M.G.Johnson");
        case 3:
          printf (" Mohammad Asif");
        default:
          printf (" M.Muralidaran");
        }
      return 0;
    }
    D.W.Steyn
    D.W.Steyn M.G.Johnson
    M.G.Johnson
    M.G.Johnson Mohammad Asif M.Muralidaran

  1. Find Error/Output in follwing code:
  2.                                 
    void main ( )
    
    {
      char *P = "ayqm" ;
      char c;
      c = ++*p ;
      printf ("%c", c);
    }
    a
    0x56FA
    m
    y


  1. Find Error/Output in follwing code:
  2.                                 
    void main()
    
    {
      int a = 1, b=2, c=3;
      char d = 0;
      if(a,b,c,d)
      {
        printf("EXAM");
      }
    }
    No Output and No Error
    EXAM
    Run time error
    Compile time error

  1. A do-while loop is used to ensure that the statements within the loop are executed at least twice.
    True
    False

  1. For 16-bit compiler allowable range for integer constants is ______ ?
    -3.4e38 to 3.4e38
    -32767 to 32768
    -32768 to 32767
    -32668 to 32667

  1. The do...while looping statement
    is executed only once if the condition is true.
    is also known as entry-controlled loop.
    is executed at least once if the condition is false.
    is unconditional looping statement..

Post Your Question
Social Sharing
Search