wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

TECHNOWIZ'S QUIDDITCH

Total questions: 25

Worksheet time: 25mins

Name
Class
Date
1.

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);

}

a)

100, -6, -100

b)

100, -6, 6

c)

Compilation Error

d)

100, -6, Garbage Value

2.

void main()

{

int a;

a = 100;

a *= a + 2;

printf("%d", a);

}

a)

10200

b)

10002

c)

10020

d)

12000

3.

void main()

{

printf("%s ", "ASCII");

printf("%d ", 'ASCII');

printf("%c ", 'ASCII');

char string1 = 'ASCII';

printf("%d ", string1);

}

a)

[Warning] character constant too long for its type

b)

Compilation Error

c)

ASCII GarbageValue I 73

d)

both a) and c)

4.

void main()

{

int a;

a = 8 * 5 / 2 + 8 / 2 * 8 - 19;

printf("%d", a);

}

a)

93

b)

33

c)

-1

d)

18

5.

void main()

{

if(1)

if(0)

printf("HELLO");

else

printf("WORLD");

}

a)

HELLO

b)

WORLD

c)

HELLOWORLD

d)

HELLO WORLD

6.

void main()

{

int a;

a = 100 ? 10 ? 0 ? 100 : 10 : 40 : 50;

printf("%d", a);

}

a)

50

b)

40

c)

10

d)

100

7.

void main()

{

int a;

scanf("%d", &a);

if(a >> sizeof(int) * 8 - 1)

printf("a < 0");

else

printf("a > 0");

}


This program is to ____________

a)

check if a number is powers of 2 or not

b)

check if a number is odd or even

c)

check maximum of two numbers

d)

check if a number is positive or negative

8.

void main()

{

int a;

for(a = 1; a <= 5; a = a + 1);

printf("%d", a);

}

a)

6

b)

5

c)

infinite loop

d)

Garbage Value

9.

void main()

{

printf("HELLO");

if(3 > 1)

{

printf("WORLD");

break;

printf("END");

}

}

a)

HELLO WORLD

b)

HELLO

c)

WORLD

d)

Compilation Error

10.

void main()

{

int a;

a == --6;

printf("%d", a);

}

a)

Compilation Error

b)

5

c)

6

d)

-6

11.

for(a = 1; a++ <= 1; a++)

{

for(a++; a++ <= 6; a++)

{

++a;

}

}

printf("%d", a);

a)

12

b)

10

c)

13

d)

11

12.

void main()

{

int i = 0100;

printf("%d", i);

}

a)

4

b)

0100

c)

64

d)

Error

13.

void main()

{

char ch;

ch = 256;

printf("%d", ch);

}

a)

255

b)

-1

c)

-128

d)

0

14.

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 }

a)

48

b)

38

c)

57

d)

28

15.

int test(int a)

{

return ++a;

}

void main()

{

int x = 10;

test(test(++x));

printf("%d", x);

}

a)

10

b)

11

c)

12

d)

13

16.

void main()

{

unsigned u;

for( u = 5; u != 0; u = u - 2)

{

printf("%u ", u);

}

}

a)

5 3 1

b)

5 3 2 1 0

c)

Error

d)

Infinite loop

17.

int a = 10;

void main()

{

int a;

{

int a;

printf("%d ", a);

}

printf("%d ", a);

}

a)

10 10

b)

10 GarbageValue

c)

GarbageValue GarbageValue

d)

GarbageValue 10

18.

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);

}

a)

300 400 GarbageValue GarbageValue

b)

300 400 400 400

c)

100 200 100 200

d)

300 400 300 400

19.

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);

}

a)

10

b)

4

c)

6

d)

7

20.

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

a)

22

b)

14

c)

10

d)

18

21.

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

a)

3

b)

10

c)

21

d)

26

22.

void main()

{

char ch[] = "TECHNOWIZ'S QUIDDITCH 2k21";

char *p = c;

printf("%s", p + p[10] - p[10]);

}

a)

QUIDDITCH 2k21

b)

NOWIZ'S QUIDDITCH 2k21

c)

TECHNOWIZ'S QUIDDITCH 2k21

d)

QUIDDITCH 2k21

23.

int main()

{

static int num = 20;

printf("%d ", num = num - 2;

if(num != 0)

main();

}

a)

20 18 16 14 12 10 8 6 4 2 0

b)

Infinite output

c)

Invalid because main function can't call itself

d)

18 16 14 12 10 8 6 4 2 0

24.

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;

}

a)

Infinite times

b)

10 times

c)

0 time

d)

9 times

25.

void main()

{

printf("%d", printf("Be the greatest keeper, chaser, beater and seeker by yourself to win the Technical Wizard's QUidditch 2k21 "));

}

a)

Be the greatest keeper, chaser, beater and seeker by yourself to win the Technical Wizard's QUidditch 2k21

b)

Be the greatest keeper, chaser, beater and seeker by yourself to win the Technical Wizard's QUidditch 2k21 107

c)

107

d)

107 Be the greatest keeper, chaser, beater and seeker by yourself to win the Technical Wizard's QUidditch 2k21