Online Test for C

  1. Find Error/Output in follwing code:
  2.                                 
    main() {
    
     int i = 2, *j;
     j = &i;
     printf("%d", i**j*i+*j); 
    Syntax error due to Invalid expression in printf
    Print junk value
    16
    10

  1. Find Error/Output in follwing code:
  2.                                 
    main() {
    
        int a = 10;      
        if ((fork ( ) == 0))      
        a++;      
        printf ("%dn", a ); 
    }
    10 and 11
    10
    11
    11 and 11


  1. Which of the following is valid commenting style in C?
    /* comment */
    // comment
    /* Comment line 1 <br> Comment line 2 */
    All of the above

  1. Select best option to consturct Character Constant
    A Character constant is a single alphabet, a single digit or a single special symbol
    Must be enclosed within single inverted commas.
    Both option (A) and (B)
    None of the above

  1. Recursive functions are executed in a?
    First In First Out Order
    Load Balancing
    Parallel Fashion
    Last In First Out Order

  1. Spaces and commas are allowed in a variable name.
    True
    False


  1. Find Error/Output in follwing code:
  2.                                 
    int main ()
    
    {
      int x = 20, y = 35;
      x = y++ + x++;
      y = ++y + ++x;
      printf ("%d %d n", x, y);
    }
    55 92
    56 93
    57 94
    None of the above

  1. How many keywords in C?
    30
    32
    38
    33

  1. Which is the correct syntax to declare constant pointer?
    int *const constPtr;
    *int constant constPtr;
    const int *constPtr;
    A and C both

Post Your Question
Social Sharing
Search