C Language Test
C Language Test
C Test
NAME - MM – 25
CLASS - OBT –
#include <stdio.h>
int main()
{
int y = 10000;
int y = 34;
printf("Hello World! %d\n", y);
return 0;
}
a) Compile time error
b) Hello World! 34
c) Hello World! 1000
d) Hello World! followed by a junk value
10. Will the following C code compile without any error?
#include <stdio.h>
int main()
{
for (int k = 0; k < 10; k++);
return 0;
}
a) Yes
b) No
c) Depends on the C standard implemented by compilers
d) Error
a. Syntax error
b. 5, 2
c. 7, 2
d. 7, 4
17.In C, which operator is used to access the value stored in a pointer variable?
a) *
b) &
c) ->
d) #
29) Which C header file should be included to use the 'sqrt' function?
a) math.h
b) stdio.h
c) conio.h
d) cmath.h
33)What does the 'static' keyword do when used with a global variable in C?
a) Makes the variable constant
b) Limits the variable's scope to the current function
c) Retains the variable's value between function calls
d) Changes the data type of the variable
38)Which library function is used to read a character from the standard input in
C?
a) scanf
b) gets
c) getchar
d) readchar
45)Which header file should be included to work with dynamic memory allocation
functions like 'malloc' and 'free'?
a) stdlib.h
b) malloc.h
c) memory.h
d) alloc.h