Font size
WorksheetsOperators
Total questions: 20
Worksheet time: 10mins
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
What is the output of C Program.?
int main()
{
int a=32;
do
{
printf("%d ", a);
a++;
if(a > 35)
break;
}
while(1);
return 0;
}
No Output
32 33 34
32 33 34 35
Compiler error
Choose a correct C Statement.
a++ is (a=a+1) POST INCREMENT Operator
a-- is (a=a-1) POST DECREMENT Operator
--a is (a=a-1) PRE DECREMENT Operator
++a is (a=a+1) PRE INCREMENT Operator
All the above.
Loops in C Language are implemented using.?
While Block
For Block
Do While Block
All the above
Choose a correct C do while syntax.
dowhile(condition) { //statements }
do while(condition) { //statements }
do { //statements }while(condition)
do { //statements }while(condition);
int main ()
{
int x = 24, y = 39, z = 45;
z = x + y;
y = z - y;
x = z - y;
printf ("%d %d %d", x, y, z);
}
24 39 63
39 24 63
24 39 45
39 24 45
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
int main ()
{
int x = 24, y = 39, z = 45;
z = x + y;
y = z - y;
x = z - y;
printf ("n%d %d %d", x, y, z);
}
24 39 63
39 24 63
24 39 45
39 24 45
All keywords in C are in ____________
Lowercase
Uppercase
Camelcase
None of these
int y = 15, b;
b = y++;
cout << "\nb = " << b;
cout << "\ny = " << y;
What will be the value of b and y?
16,16
15,15
15,16
16,15
What is the output of C Program.?
int main()
{
int a=25;
while(a <= 27)
{
printf("%d ", a);
a++;
}
return 0;
}
25 25 25
Compiler error
25 26 27
27 27 27
'x--' is which type of operator?
post decrement
pre increment
post increment
pre decrement
What is the output of C Program with switch statement.?
int main()
{
int a=3;
switch(a)
{
case 1: printf("Hello"); break;
case 2: printf("Zero "); break;
case 3: printf("You are right");break;
case default: printf("Rabbit ");
}
}
Rabbit
Zero
Hello
You are right
What is output of the program?
int main()
{
int i,j,count;
count=0;
for(i=0; i<5; i++)
{
for(j=0;j<5;j++)
{
count++;
}
}
printf("%d",count);
return 0;
}
5
20
25
10
Find The Output
int a = 3;
printf("%d %d %d %d", a , a++ ,a, a);
(a)
int main() {
int m = -10, n = 20;
n = (m < 0) ? 0 : 1;
printf("%d %d", m, n);
}
-10 0
10 20
20 -10
0 1
int x;
int y;
int z;
x=3;
y=4;
z = ++x * y++;
printf("%d",z);
12
16
20
0
#include <stdio.h>
int main()
{
int i = 95;
char c = 97;
printf("%d, %d\n", sizeof(i), sizeof(c));
return 0;
}
2,1
4,2
2,4
2,8
int x;
int y;
int z;
x=3;
y=4;
z = ++x * y++;
printf("%d",z);
12
16
20
0
