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.
-
Question1:
Running the C code snippet:main() { printf("Hello\n"); }a)prints Hello b)compilation error c)run time error
Answer: a) prints Hello
-
Question2:
In C, ‘double’ is a data type. True or False?Answer: True.
C has the following basic data types: char, int, double, float. -
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. -
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 -
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
-
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
-
Question7:
In C, the size of an array, once declared is constant, True or False?Answer: True
-
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++. -
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 -
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′};