< Back to Tests


C (Basic Test 2)

1. Which of the following function reads a character only one at a time from terminal and return it as an integer?

gets()
getchar()
scanf()
getc()

2. Which of the following statement is true according to C syntax rule

All C instruction must be written in Upper case character
C is not a case sensitive language.
All C statement must end with a semicolon.
All of the above.

3. Which of the following is not a valid keyword in C language

case
register
native
typedef

4. The first character of an identifier in C langauge can contain ?

only alphabet( a-z , A-Z ) or underscore ( _ )
only numeric character(0-9)
only special character($, #, @)
all of the above

5. Which operator in C is used to return the size of a variable ?

size operator
sizeof operator
& operator
ternary operator

6. What will happen after compiling and running following code?
void main()
{ 
     printf("%p", main); 
}

Compiler Error
Will make an infinite loop
Some address will be printed
Runtime Error

7. ________ variable is initialized only once and remains into existence till the end of program ?

external variable
static variable
automatic variable
register variable

8.
#include <stdio.h>
int main()
{
    //Assume sizeof character is 1 byte and sizeof integer is 4 bytes
    printf("%d", sizeof(printf("BreakInterview")));
    return 0;
}

BreakInterview4
4BreakInterview
BreakInterview14
4

9. Predict the output of the following code.
#include <stdio.h>
int main() 
{ 
  printf("\"BREAK %% INTERVIEW %% QUIZ\""); 
  return 0; 
}

“BREAK % INTERVIEW % QUIZ”
BREAK % INTERVIEW % QUIZ
\” BREAK %% INTERVIEW %% QUIZ\”
BREAK %% INTERVIEW %% QUIZ

10. Predict the output of the following code.
#include <stdio.h>
// Assume base address of "BreakInterview" to be 1000
int main()
{
   printf(5 + "BreakInterview");
   return 0;
}

BreakInterview
Interview
1005
Compiler Error