wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Demo C programming

Total questions: 10

Worksheet time: 3mins

Name
Class
Date
1.

What will the following code snippet display?

int x = 10;

printf("%d", x);

a)

10.0

b)

"10"

c)

10

d)

Error

2.

Which data type is used to store whole numbers in C?

a)

char

b)

double

c)

int

d)

float

3.

What is the purpose of the printf function in C?

a)

To read user input

b)

To print text on the screen

c)

To declare variables

d)

To create loops

4.

What is the main advantage of using functions in C?

a)
Increased code readability
b)
Simpler syntax
c)
Code reusability and modularity
d)
Improved performance
5.

What is the purpose of the return statement in a function in C?

a)
To pause the execution of the function and resume it later.
b)
To skip the execution of the function and move to the next line of code.
c)
To print a message to the console and continue executing the function.
d)
To terminate the execution of the function and return a value to the calling function.
6.

Which of the following is not a valid C keyword?

a)
print
b)
for
c)
output
d)
int
7.

Which header file should you include in a C program to use the printf and scanf functions?

a)

string.h

b)

conio.h

c)

math.h

d)

stdio.h

8.

Who is often referred to as the creator of the C programming language?

a)
Bill Gates
b)
Linus Torvalds
c)
Dennis Ritchie
d)
Alan Turing
9.

In C, what symbol is used for a single-line comment?

a)
//
b)
--
c)
#
d)
/*
10.

When was the C programming language first created?

a)
1972
b)
1995
c)
1980
d)
1965