NEW
Font size
WorksheetsC PROGRAMMING
Total questions: 25
Worksheet time: 50mins
1.Relational
2.Arithmetic
3.Logical
4.Assignment
What is the output of C Program.?
int main()
{
int a=5;
while(a >= 3);
{
printf("RABBIT\n");
break;
}
printf("GREEN");
return 0;
}
GREEN
RABBIT GREEN
RABBIT is printed infinite times
None of the above
What is the output of C Program.?
int main()
{
int a=25;
while(a <= 27)
{
printf("%d ", a);
a++;
}
return 0;
}
25 25 25
25 26 27
27 27 27
Compiler error
What is the output of C Program.?
int main()
{
int a=32;
do
{
printf("%d ", a);
a++;
}
while(a <= 30);
return 0;
}
32
33
30
No Output
#include<stdio.h>
int main()
{
int a=2,b=7,c=10;
c=a==b;
printf("%d",c);
}
0
7
2
Compilation error
What will be the output of given program ?
#include<stdio.h>
main()
{
int y=10;
int z=y+(y==10);
printf(“%d”,z);
}
10
11
20
Compiler error
In the following loop construct, which one is executed only once always.
for(exp1; exp2; exp3)
exp1
exp3
exp1 and exp3
exp1,exp2 and exp3
int main()
{
int a = 10, b = 25;
a = b++ + a++;
b = ++b + ++a;
printf("%d %d n", a, b);
}
36 64
35 62
36 63
30 28
What does the following code fragment write to the monitor?
Under
Over
Under the limit
Over the limit
An opertor used to check a condition and select a value depending on the value of the condition is called
Logical operator
Decrement operator
Conditional or Ternary operator
Bitwise operator
What value will be stored in z if the following code is executed?
x = 5 , y = -10, a = 4, b = 2;
z = x+++++y * b/a;
-2
0
1
2
What value will be stored in z if the following code is executed?
x = 5 , y = -10, a = 4, b = 2;
z = x+++++y * b/a;
-2
0
1
2
#include <stdio.h>
void main()
{
int k = 8;
int x = 0 == 1 && k++;
printf(“%d%d\n”, x, k);
}
a) 0 9
b) 0 8
c) 1 9
d) 1 8
#include<stdio.h>
int main()
{
char j=1;
while(j < 5)
{
printf("%d, ", j);
j = j+1;
}
printf("\n");
return 0;
}
1 2 3 ... 127
1 2 3 ... 255
1 2 3 ... 127 128 0 1 2 3 ... infinite times
1, 2, 3, 4
What is the output of C Program.?
int main()
{
int k;
for(printf("FLOWER "); printf("YELLOW "); printf("FRUITS "))
{
break;
} return 0;
}
Compiler error
FLOWER FRUITS
FLOWER YELLOW
FLOWER YELLOW FRUITS
What would be the size of the following union declaration? (Assuming size of double = 8, size of int = 4, size of char = 1)
4
8
40
80
What will be the output of the following C code
6 -6 0 0
6 -5 0 1
-6 -6 0 1
6 -6 0 1
(A272)16 = (?)8
122272
221172
121162
None of the above
float arr[100];
printf("%d", sizeof(arr));
printf statement will print the sizeof value for the array, what will be the output?
100
400
800
Compiler Dependent
