TCS C MCQ Questions Misc – 2

1. The function ____ obtains block of memory dynamically.
a) calloc
b) malloc
c) Both calloc & malloc 
d) free

2. For a typical program, the input is taken using
a) scanf
b) Files
c) Command-line
d) All of the mentioned

3. What is the default return-type of getchar()?
a) char
b) int 
C. char *
D. reading character doesn’t require a return-type

4. Memory allocation using malloc() is done in?
a) Static area
b) Stack area
c) Heap area
d) Both Stack & Heap area

5. What is the sizeof(char) in a 32-bit C compiler?
a) 1 bit
b) 2 bits
c) 1 Byte
d) 2 Bytes

6. What type of value does sizeof return?
a) char
b) short
c) unsigned int
d) long

7. Which one is used during memory deallocation in C?
a) remove(p);
b) delete(p);
c) free(p);
d) terminate(p);

8. What is the output of this C code?

#include <stdio.h>
void main()
{
int x = 97;
int y = sizeof(x++);
printf(“x is %d”, x);
}
a) x is 97 
b) x is 98
c) x is 99
d) Run time error