Answers to Twitter Quiz -2 on C language


This quiz is a past event on Twitter. Twitter Quiz is unique format of quiz conducted by Interview Mantra. It is a short quiz of 10 questions. This quiz was on C Language. Read more about Interview Mantra Twitter Quiz>

The Quiz questions, answers and their explanations have been consolidated as a blog post for your convenience.

  1. Question1:
    Running the C code snippet:

    main()
    {
     printf("Hello\n");
    }

    a)prints Hello b)compilation error c)run time error

    Answer: a) prints Hello

  2. Question2:
    In C, ‘double’ is a data type. True or False?

    Answer: True.
    C has the following basic data types: char, int, double, float.

  3. Question3:
    The size of the basic data type, ‘int’ in C is : a)1 byte, b)4 bytes, c)machine dependent?

    Answer: c) machine dependent
    C compiler is free to choose the size of data types appropriate for its hardware.

  4. Question4:
    The escape sequence ‘\t’ when used in printf statement
    a) prints a new line b) prints a tab c) does nothing ?

    Answer: b) Prints a tab
    Escape sequence ‘\t’ is used for padding a tab space

  5. Question5:
    The default return value of a function in C (when return type not specified) is a)int, b)char, c)void ?

    Answer: a) int

  6. Question6:
    In C statement,

    if((a==5)||(a>7)),

    there are 2 expressions (a==5), (a>7). Which of them is evaluated first? a) a==5 b) a>7

    Answer: a) a==5

  7. Question7:
    In C, the size of an array, once declared is constant, True or False?

    Answer: True

  8. Question8:
    In a C program, there can be multiple functions with same name. True or False ?

    Answer: False
    Having same name for mulitple functions with different parameters (function overloading) is not allowed in C but is allowed in C++.

  9. Question9:
    C functions use: a)Call by value b)Call by reference ?

    Answer: a) Call by value
    Call or Pass by reference does not exist in C, whereas C++ uses call by reference. Read More

  10. Question10:
    A string in C is a char array ending with a special character ‘\0′. True or False?

    Answer: True
    char arr[] = {‘H’, ‘E’, ‘L’, ‘L’, ‘O’}; This character array ‘arr’, when appended with ‘\0′ becomes a string. Example of a string, char str[]= {‘H’, ‘E’, ‘L’, ‘L’, ‘O’,'\0′};


About the Author:  This post was written by Utsav Banerjee. You can reach Utsav on email at fugitiveland@gmail.com



All comments of post - "Answers to Twitter Quiz -2 on C language":

:Haha! I'am the first! Yeh~

Thank you!

Add a Comment / Trackback url

Comment begin from here or jump up!