wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

first round quiz

Total questions: 20

Worksheet time: 20mins

Name
Class
Date
1.
  • 1.What is the output of this C code?

     #include void main()

    { int x=1,y=0,z=5;

    int a=x&&y||z++;

    printf("%d",z);

    }

a)

6

b)

5

c)

0

d)

varies

2.

  • 2.What is the output of this C code?

    #include void main()

    { int x=1,z=3;

    int y=x<<3;

    printf("%d\n",y);

    }  

a)


-2147483648

b)

Runtime Error

c)

8

d)

-1

3.

  • 3.What will be the output?

    void main() {

    i=0x10+010+10;

    printf("\nx=%x",i);

    }  

a)


I=34

b)

x=22

c)

x=34

d)

error

4.
  •  

    4.Int i=20;

    Printf(“%X”,i);

    What is the output?

a)

20

b)

15

c)

14

d)

error

5.
  •  

    What will be the size of the following union declaration?

    Union test { 

    int x; 

     char y; 

    float z; 

     };       

a)

5

b)

4

c)

6

d)

7

6.

What will be the size of the following union declaration?

struct test{

  int x;

char y;

 float z;

 };

a)

4

b)

5

c)

6

d)

7

7.

7.What will be the output of the following C code?

#include int main()

{ int x = 1, y = 2;

int z = x & y == 2;

printf("%d\n", z);

}

a)

0

b)

1

c)

error

d)

depends on complier

8.

8.int main()

{ int a=89;

printf("%c",a);

return 0;

}

a)


89

b)

 

y

c)

Y

d)


error

9.

  • 9.What will be the output of the following C code?  

    #include void main() {

    int x=0;

    int ptr=&x;

    printf("%d\n",ptr);

    }

a)

Address of x

b)

Zero

c)

Junk value

d)


Runtime Error

10.

10.What will be the output of the C code?

#include int main() {

int a=1;

if(a--)  

 printf("True");

if(a++)    

     printf("False");

}

a)

true

b)

false

c)

true false

d)

no output

11.
  1. 11.what is the output of this

  2. int main(void)

  3. { int cog;

  4. cog=printf("Hey,Welcome")+printf(" to world");

  5. printf("\n%d characters were printed",cog);

  6. return 0; }

a)

20 characters were printed

b)

 

Hey,Welcometo world
20 characters were printed

c)

Hey,Welcome to world
20 characters were printed

d)

RunTime Error : Cannot assign string values to integer type.

12.
  1. #include

  2. int a=30;

  3. main(void)

  4. { a=43;

  5. printf("%d", a);

  6. }

a)

30

b)

43

c)


a

d)

error

13.

13.types of error

a)

syntax

b)

logic

c)

compile

d)

all the above

14.

14.#include  

int main() {

int i = 1;

if (i++ && (i == 1))

printf("No\n");

else printf("Yes\n"); }

a)

yes

b)

no

c)

Depends on the  compiler

d)

Depends on the standard

15.

15.What will be  the final value of J in the following C code?

#include<stdio>

int main() {

int i=10,j=0;

if(I||(J=I+10))  

 //DO SOMETING ; }

a)

zero

b)

complier error

c)

20

d)

depends on language standard

16.

16.What will be the output of the following C code?

#include <stdio.h>

int main() {

int a=2,b=0;

int y=(b==0)?a:(a>b)?(b=1):a;

printf("%d",y); }

a)

Compile time error

b)

one

c)

two

d)

undefined behavior

17.

17.What will be the output of the following C code? #include <stdio.h>

int main() {    

if(7&8) printf("Honest");

    if((~7&0*000f)==8)

printf("is the best policy");

}

a)

 

Honest is the best policy

b)

honest

c)

Is the best policy

d)


No output

18.

18.What  will be the output of following C code?

#include int main()

{ int k=8;

int m=7; k

a)


Runtime error

b)


Compiletime error

c)

7

d)

8

19.

19.What will be the output of this?

#include int main() {

int a[]={2,3};

int b[]={4,6};

if(a) { int a=7;

int b=8; printf("%d",a);

} }

a)

7

b)

3

c)

8

d)

6

e)

error

20.

20.What will be the output of the following c code?

int main() {  

int x=-2;

  x=x>>1;

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

a)

1

b)

-1

c)


231-1 considering int to be 4 bytes

d)

2