Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Programming Round 1

Total questions: 21

Worksheet time: 30mins

Name
Class
Date
1.

#include<stdio.h>

int main(){

int a=45;

a=a<46;

printf("%d",a);

return 0;

}

a)

1

b)

2

c)

3

d)

4

2.

#include<stdio.h>

int main(){

int a=1,b=2;

a+=b=a;

printf("%d%d",a,b);

return 0;

}

a)

12

b)

32

c)

21

d)

16

3.

#include<stdio.h>

int main(){

char a[8]="same";

if(a=="same")

printf("yes");

else

printf("no");

return 0;

}

a)

yes

b)

Yes

c)

no

d)

No

4.

#include<stdio.h>

int main(){

int a=1,b=2;

a+=b=a;

printf("%d%d",a,b);

return 0;

}

a)

04 13 23

b)

05 14 23

c)

05 41 32

d)

50 32 14

5.

#include<stdio.h>

int main{

int i[3] = {1,4,2};

if(i[2]==i[3]){

printf(“loop”);

}

else{

break;

}

}

a)

Runtime Error

b)

Compiletime Error

c)

Reference Error

d)

loop

6.

#include <stdio.h>

void main()

{

int a = 5, b = -7, c = 0, d;

d = ++a && ++b || ++c;

printf("\n%d%d%d%d", a, b, c, d);

}

a)

6-601

b)

6601

c)

6513

d)

6-611

7.

#include <stdio.h>

void main()

{

double b = 3 && 5 & 4 % 3;

printf("%lf", b);

}

a)

1

b)

1.000000

c)

4.00000

d)

4

8.

#include<stdio.h>

int main()

{

char a=97;

char b=a + 0x01;

switch(++a,++b){

case'a':

printf("a");

break;

case'b':

printf("b");

break;

case'c':

printf("c");

break;

case'd':

printf("d");

break;

default:

printf("nothing");

break;

}

return 0;

}

a)

a

b)

b

c)

c

d)

d

9.

#include<stdio.h>

#define square(x) x*x;

int main()

{

int a=6,b;

b=36/square(a);

printf("%d",b);

return 0;

}

a)

18

b)

9

c)

36

d)

Error

10.

#include<stdio.h>

int main()

{

int a=3,b;

b=(3,4,5);

printf("%d,%d",a,b);

return 0;

}

a)

3,5

b)

3,4

c)

3,3

d)

3,3,4,5

11.

#include<stdio.h>

int main()

{

int a=4,b,c;

b = --a;

c = a--;

printf("%d %d %d",a,b,c);

return 0;

}

a)

3 3 3

b)

3 2 2

c)

2 3 3

d)

3 2 1

12.

#include<stdio.h>

int main()

{

int a=1,b=2,c;

c= (a>b) ? (a-b) : (a+b);

printf("%d,%d,%d",a,b,c);

return 0;

}

a)

1,0,1

b)

1,2,3

c)

1,1,1

d)

3,2,1

13.

#include<stdio.h>

#define bar(x,y) ((x)>(y)) ? (x*y) : (y-x);

int main()

{

int p=14,q=2,r=4;

r+=bar(++p,q++);

printf("%d,%d,%d\n",p,q,r);

return 0;

}

a)

16,4,52

b)

14,6,46

c)

18,8,48

d)

14,2,4

14.

What is the 16-bit compiler allowable range for integer constants?

a)

-32767 to 32768

b)

-32668 to 32667

c)

-32768 to 32767

d)

3.4e38 to 3.4e38

15.

A pointer is a memory address. Suppose the pointer variable has p address 1000, and that p is declared to have type int*, and an int is 4 bytes long. What address is represented by expression p + 3?

a)

1004

b)

1012

c)

1008

d)

1002

16.

What does modularity mean?

a)

Hiding part of program

b)

Sub dividing program into smaller parts

c)

Overriding parts of program

d)

Wrapping things into single unit

17.

Which is valid expression in c language?

a)

int pos_num = 100000;

b)

int pos num = 1000;

c)

int pos num == 10000;

d)

int pos_num = 100,000;

18.

Array is a _________ data structure.

a)

Primary

b)

Linear

c)

Data Type

d)

Non-Linear

19.

Output of

printf("%d",5/2); is (a)  

20.

In which of the following modes, the user can read and write the file?

a)

w

b)

r+

c)

b+

d)

r

21.

How was the quiz?

----------Feedback------------

a)

Good

b)

Bad

c)

Satisfactory