Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C-Basic

Total questions: 10

Worksheet time: 4mins

Name
Class
Date
1.

C programs are converted into machine language with the help of

a)

IDE

b)

VScode

c)

An operating system

d)

A compiler

2.

What will be the output of the following C code?

a)

Run time error

b)

h e

c)

h h

d)

h l

3.

a)

1

b)

2

c)

Compile error

d)

Runtime error

4.

Which keyword is used to come out of a loop only for that iteration?

a)

break

b)

return

c)

continue

d)

exit

5.

How would you round off a value from 1.66 to 2.0?

a)

ceil(1.66)

b)

roundup(1.66)

c)

floor(1.66)

d)

roundto(1.66)

6.

A Variable name in C includes which special symbols?

a)

* (asterisk)

b)

# (Hash)

c)

+ (Addition)

d)

_ (underscore)

7.

Which header file supports the functions - malloc() and calloc()?

a)

stdlib.h

b)

memory.h

c)

math.h

d)

stdio.h

8.

Which of the following is the correct usage of conditional operators used in C?

a)

return (a>b)?(a:b)

b)

a>b ? c=30;

c)

max = a>b ? a>c?a:c:b>c?b:c

d)

a>b ? c=30 : c=40;

9.

What will be the output of the program?

int x=4, y, z;

y = --x;

z = x--;

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

a)

3,3,2

b)

4,3,3

c)

4,3,2

d)

2,3,3

10.

Which of the following are unary operators in C?

1. !

2. sizeof

3. ~

4. &&

a)

1,2

b)

2,4

c)

1,3

d)

1,2,3