Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Quiz 2

Total questions: 12

Worksheet time: 10mins

Name
Class
Date
1.

Which one is valid variable declaration?

a)

int 1person;

b)

int 1 person;

c)

int person_1;

d)

int person 1;

2.

Fill in the blanks to print the output "65432"

for(int i=6;i_1;i--) {

printf("%d",i); }



(a)  

3.

Predict the output.

a)

Sum is 5.7

b)

Sum is 5

c)

Sum is 0

d)

Compiler error

4.

Choose the correct output.

a)

2

4

6

8

0

b)

2

4

6

8

c)

2

4

6

8

Garbage value

d)

Compiler error

5.

Which of these are possible array declarations?

(choose more than one answer)

a)

int ar[]={1,2,3};

b)

int ar[3]={0,1,2};

c)

int ar[ ];

d)

int ar[50];

6.

Write the dimension of the given array.

Answer format Example:

2,5

(a)  

7.

Predict the output.

a)

56789

b)

5678910

c)

5

d)

error

8.

Guess the output.

a)

Fail

Very good

b)

Very good

c)

Compiler error

d)

Very good

Fail

9.

Guess the correct format specifiers.

a)

%d

%d

%p

b)

%d

%p

%p

c)

%d

%p

%d

d)

%p

%p

%p

10.

Which of the following is the proper declaration of a pointer?

a)

int x*;

b)

int &x;

c)

ptr x;

d)

int*x;

11.

Which of the following gives the memory address of integer variable a?

a)

*a;

b)

**a;

c)

&a;

d)

address(a);

12.

Predict the size of the string.

a)

12

b)

13

c)

14

d)

15