NEW
Font size
WorksheetsTECHNOWIZ'S QUIDDITCH
Total questions: 25
Worksheet time: 25mins
1) void main()
{
int a, b, c;
a = 100;
b = 28;
c = 61;
b = -c;
-a = c;
printf("%d %d %d\n", a, b, c);
}
100, -6, -100
100, -6, 6
Compilation Error
100, -6, Garbage Value
void main()
{
int a;
a = 100;
a *= a + 2;
printf("%d", a);
}
10200
10002
10020
12000
void main()
{
printf("%s ", "ASCII");
printf("%d ", 'ASCII');
printf("%c ", 'ASCII');
char string1 = 'ASCII';
printf("%d ", string1);
}
[Warning] character constant too long for its type
Compilation Error
ASCII GarbageValue I 73
both a) and c)
void main()
{
int a;
a = 8 * 5 / 2 + 8 / 2 * 8 - 19;
printf("%d", a);
}
93
33
-1
18
void main()
{
if(1)
if(0)
printf("HELLO");
else
printf("WORLD");
}
HELLO
WORLD
HELLOWORLD
HELLO WORLD
void main()
{
int a;
a = 100 ? 10 ? 0 ? 100 : 10 : 40 : 50;
printf("%d", a);
}
50
40
10
100
void main()
{
int a;
scanf("%d", &a);
if(a >> sizeof(int) * 8 - 1)
printf("a < 0");
else
printf("a > 0");
}
This program is to ____________
check if a number is powers of 2 or not
check if a number is odd or even
check maximum of two numbers
check if a number is positive or negative
void main()
{
int a;
for(a = 1; a <= 5; a = a + 1);
printf("%d", a);
}
6
5
infinite loop
Garbage Value
void main()
{
printf("HELLO");
if(3 > 1)
{
printf("WORLD");
break;
printf("END");
}
}
HELLO WORLD
HELLO
WORLD
Compilation Error
void main()
{
int a;
a == --6;
printf("%d", a);
}
Compilation Error
5
6
-6
for(a = 1; a++ <= 1; a++)
{
for(a++; a++ <= 6; a++)
{
++a;
}
}
printf("%d", a);
12
10
13
11
void main()
{
int i = 0100;
printf("%d", i);
}
4
0100
64
Error
void main()
{
char ch;
ch = 256;
printf("%d", ch);
}
255
-1
-128
0
void main()
{
int a;
a = 6 << 1 + 3 >> 2 + 1 << 2;
printf("%d", a);
}
HINT :
a << b = a * 2^b
a >> b = { a / 2^b if a > 0
~(~a / 2^b) if a < 0 }
48
38
57
28
int test(int a)
{
return ++a;
}
void main()
{
int x = 10;
test(test(++x));
printf("%d", x);
}
10
11
12
13
void main()
{
unsigned u;
for( u = 5; u != 0; u = u - 2)
{
printf("%u ", u);
}
}
5 3 1
5 3 2 1 0
Error
Infinite loop
int a = 10;
void main()
{
int a;
{
int a;
printf("%d ", a);
}
printf("%d ", a);
}
10 10
10 GarbageValue
GarbageValue GarbageValue
GarbageValue 10
void main()
{
int a = 100, b = 200;
int *p1 = &a, *p2 = &b;
*p1 = 300;
p1 = p2;
*p2 = 400;
printf("%d %d %d %d", a, b, *p1, *p2);
}
300 400 GarbageValue GarbageValue
300 400 400 400
100 200 100 200
300 400 300 400
What will be the value of j at the end of the execution of the following C program?
int increment(int i)
{
static int count = 0;
count = count + i;
return count;
}
void main()
{
int i, j;
for(i = 0; i <= 4; i++)
j = increment(i);
}
10
4
6
7
Consider the following
struct {
short s [5]
union {
float y;
long z;
}u;
} t;
Assume that objects of the type short, float and long occupy 2 bytes, 4 bytes and 8 bytes respectively,
The memory requirement for variable t is
22
14
10
18
The number of tokens in the following C statement
printf("i = %d, &i = %x", i, &i);
HINT: There are 6 types of tokens namely identifiers, keywords, constants, operators, string literals and
separators
3
10
21
26
void main()
{
char ch[] = "TECHNOWIZ'S QUIDDITCH 2k21";
char *p = c;
printf("%s", p + p[10] - p[10]);
}
QUIDDITCH 2k21
NOWIZ'S QUIDDITCH 2k21
TECHNOWIZ'S QUIDDITCH 2k21
QUIDDITCH 2k21
int main()
{
static int num = 20;
printf("%d ", num = num - 2;
if(num != 0)
main();
}
20 18 16 14 12 10 8 6 4 2 0
Infinite output
Invalid because main function can't call itself
18 16 14 12 10 8 6 4 2 0
How many times "Technowiz's Quidditch 2k21" will be printed?
int main()
{
int a;
for(a = -1; a <= 10; a++)
{
if(a < 5)
{
continue;
}
else
{
break;
}
printf("Technowiz's Quidditch 2k21");
}
return 0;
}
Infinite times
10 times
0 time
9 times
void main()
{
printf("%d", printf("Be the greatest keeper, chaser, beater and seeker by yourself to win the Technical Wizard's QUidditch 2k21 "));
}
Be the greatest keeper, chaser, beater and seeker by yourself to win the Technical Wizard's QUidditch 2k21
Be the greatest keeper, chaser, beater and seeker by yourself to win the Technical Wizard's QUidditch 2k21 107
107
107 Be the greatest keeper, chaser, beater and seeker by yourself to win the Technical Wizard's QUidditch 2k21
