C Language
C Language
C Language
a) for b) while
c) switch d) do while
2. Which of the following is not a valid C variable name?
a) int number; b) float rate;
c) int variable_count; d) int $main;
3. Which of the following is a User-defined data type?
a) typedef int Boolean;
b) typedef enum {Mon, Tue, Wed, Thu, Fri} Workdays;
c) struct {char name[10], int age};
d) all of the mentioned
#include <stdio.h>
int main()
{ int i = 1;
if (i++ && (i == 1))
printf("Yes\n");
else
printf("No\n");
}
a) Yes
b) No
c) Depends on the compiler
d) Depends on the standard
7. What will be the output of the following C code?
#include <stdio.h>
void main()
{ int x = 4, y, z;
y = --x;
z = x--;
printf("%d%d%d", x, y, z);
}
a) 3 2 3 b) 2 3 3
c) 3 2 2 d) 2 3 4
8. What is the type of the following assignment expression if x is of type float and y is of type int?
y = x + y;
a) int
b) float
c) there is no type for an assignment expression
d) double
10. The C code ‘for(;;)’ represents an infinite loop. It can be terminated by ___________
a) break b) exit(0)
c) abort() d) terminate