ASSIGNMENT -02
1. Which of the following cannot be used as a variable in C programming?
a) Var123 b) Var_123 c) 123Var d) X_123_Var
2. Which of the following is not a correct variable type in C?
a) int b) double c) char d) All of above are correct variable type
3. The execution of any C program is
a) Sequential b) Parallel c) Multi-threading d) None of these
4. Which of the following statements is correct?
I. Keywords are those words whose meaning is already defined by Compiler.
II. Keywords cannot be used as variable names.
III. There are 32 keywords in C.
IV. C keywords are also called as reserved words.
a) I and II b) II and III c) I, II and IV d) All of the above
5. A function is
a) Block of statements to perform some specific task
b) It is a fundamental modular unit to perform some task
c) It has a name and can be used multiple times
d) All of the above
6. What will be the output? [N.B: - .2f is used to print up to 2 decimal places of a
floating point number]
#include <stdio.h>
int main s()
{
float a = 5.0;
printf ("The output is %.2f", (9/5)*a + 7);
return 0;
}
a) 28.2 b) 21.00 c) 16.00 d) 12.00
7. What is the output of the following C code?
#include <stdio.h>
int main ()
{
int var = 0110;
var =var+7;
print f ("%d", var);
return 0;
}
a) 106 b) 70 c) 79 d) Compiler error
8. If integer needs two bytes of storage, then the minimum value of a signed integer in C
would
Be: a) −(216 − 1) b) 0 c) −(215 − 1) d) −215
9. What will be the output of the program given below?
#include <stdio.h>
int main ()
{
a=9;
print f ("%d", a);
return 0;
}
a) 9 b) 0 c) 1001 d) Compilation Error
10. What is the output?
#include <stdio.h>
#define fun(x) (x*x-x)
int main ()
{
float i;
i = 37.0/fun (2);
print f ("%.2f", i);
return 0;
}