Online Test for C

  1. What is the purpose of getc()?
    read a character from STDIN
    read a character from a file
    read all file
    read file randomly

  1. Which of the following is NOT a valid Character Constant?
    ’P’
    ’2’
    ’PQ’
    ’#’


  1. How to make an infinity loop in C?
    loop: ..... goto loop;
    for(;;) { }
    while(1) { }
    All 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. What is constant?
    Constants have fixed values that do not change during the execution of a program
    Constants have fixed values that change during the execution of a program
    Constants have unknown values that may be change during the execution of a program
    None of the above

  1. Find Error/Output in follwing code:
  2.                                 
    void fn()
    
    {
      static int i = 10;
      printf("%d ", ++i);
    }
    int main()
    {
      fn();
      fn();
    }
    10 10
    11 11
    11 12
    12 12


  1. Find Error/Output in follwing code:
  2.                                 
    int main() {
    
      int i=0;
      for(;;) 
        printf("%d",i); 
      return 0;

    0 times
    Infinite times
    10 times
    1 times

  1. Which of the following storage classes have global visibility in C?
    Auto
    Static
    Extern
    Register

  1. What is function?
    Function is a block of statements that perform some specific task.
    Function is the fundamental modular unit. A function is usually designed to perform a specific task.
    Function is a block of code that performs a specific task. It has a name and it is reusable
    All the above

  1. Find Error/Output in follwing code:
  2.                                 
    int main ()
    
    {
      int a[4] = { 25, 16 };
      printf ("%d %d", a[0] & a[1], a[1] | a[2]);
    }
    Syntax error because of invalid operator symbol
    25 16
    16 16
    Syntax error because of invalid array initialization

Post Your Question
Social Sharing
Search