Online Test for C

  1. Which is an invalid name of identifier?
    world
    addition23
    test-name
    factorial

  1. Find Error/Output in follwing code:
  2.                                 
    int main() {
    
      char c = 'f';
      switch (c) {
        default: printf("unknown colour ");
        case 'r': case 'R': printf("Red ");
        case 'g': case 'G': printf("Green "); break;
        case 'b': case 'B': printf("Blue");
      }
    }
    Red Green Blue
    Error
    Green unknown colour Red
    unknown colour Red Green


  1. Who is father of C Language?
    Bjarne Stroustrup
    Dennis Ritchie
    James A. Gosling
    Dr. E.F. Codd

  1. Which of these assignments is invalid?
    short s = 48;
    float f = 4.3;
    double d = 4.3;
    int I = `1`;

  1. Switch statement can have any number of case instances
    True
    False

  1. The statement printf("%c", 100); will print?
    prints 100
    print garbage
    prints ASCII equivalent of 100
    None of the above


  1. = is used for comparison, whereas, == is used for assignment of two quantities.
    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. A full binary tree with n leaves contains
    n nodes
    2n - 1 nodes
    log2 n nodes
    2n nodes

  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

Post Your Question
Social Sharing
Search