wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Quiz Pratispardha

Total questions: 20

Worksheet time: 15mins

Name
Class
Date
1.

Find the output of following code :

 main()

{

static int var = 5; printf("%d ",var--); if(var)

main();

}

a)

54321

b)

5555

c)

Compilation Error

d)

No Output

2.

Find the output of Following Code :

main()

{

char *p;

printf("%d %d ",sizeof(*p),sizeof(p));

}

a)

1 1

b)

1 2

c)

2 2

d)

Garbage Value

3.

void main()

{

printf(“%d”, 11 ^ 5);

}

 What does the operation shown above produce? 

a)

1

b)

6

c)

8

d)

14

4.

int x = 0;

for (x=1; x<3; x++);

printf("x=%d\n", x);

What will be printed when the sample code above is executed? 

a)

x=0

b)

x=1

c)

x=3

d)

x=4

5.

#define j 5+3

int main()

printf("j=%d",j*j*j); 

return 0;

}    

What will be printed when the sample code above is executed? 

a)

j=512

b)

j=38

c)

j=133

d)

Compilation error

6.

#define clrscr() 100

int main() {

  clrscr();

   printf("%d",clrscr());

return 0; }                                                                                                                                                                                                                                   

What will be printed when the sample code above is executed?

a)

100

b)

null

c)

Compiler Error

d)

200 

7.

int main(){

 int i=0;

 do{

   --i;

   printf("%d",i);

   i++;

 }while(i>=0);

  return 0; }                                                                                                                                                                                                                                 

How many times the above loop will run? 

a)

1

b)

0

c)

Compiler Error

d)

Infinite 

8.

#include<stdio.h>

int main()

{

    int i=-3, j=2, k=0, m;

    m = ++i && ++j && ++k;

    printf("%d, %d, %d, %d\n", i, j, k, m);

    return 0;

}

a)

-2, 3, 1, 1

b)

2, 3, 1, 2

           

c)

1, 2, 3, 1

          

d)

  3, 3, 1, 2

9.

What would be the equivalent pointer expression for referring to the array element a[i][j][k][l]?

a)

(((*(a+i)+j)+k)+l)

b)

*(*(*(*(a+i)+j)+k)+l)

c)

(*(*(a+i)+j)+k+l)

d)

*((a+i)+j+k+l)

10.

Left shifting a number by 1 is always equivalent to multiplying it by 2.

a)

True

b)

False

11.

Bitwise & and | are not  unary operators

a)

True

b)

False

12.
a)

h e

b)

e l

c)

h h

d)

e e

13.
a)

23, 11

b)

23, 23

c)

11, 17

d)

17, 17

14.
a)

15, 10

b)

15, 15

c)

10, 15

d)

10, 10

15.
a)

Variable ‘a’ should be replaced by ‘si’

b)

Nothing will print

c)

Error: Multiple declaration of si

d)

No error

16.
a)

5, 4

b)

5, 5

c)

4, 4

d)

3, 4

17.
a)

70

b)

Garbage value

c)

Compilation error

d)

None

18.
a)

Infinite times

b)

32767

c)

65535

d)

Till stack overflows

19.
a)

Compile time error

b)

4

c)

1

d)

2

20.

An integer array of size 10 is declared in a C program. The memory location of the first byte of the array is 1000. What will be the location of the 8th element of the array? (Assume integer takes 4 bytes of memory and the element stored at 1000 is identified as 1st element).

a)

1028

b)

1032

c)

1024

d)

1036