wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Functions in C - Worksheet

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

What is a function in C?

a)

A variable that stores data

b)

A block of code that performs a specific task

c)

A loop that repeats code

d)

A comment in the program

2.

Which keyword is used to define a function in C?

a)

define

b)

function

c)

void

d)

No special keyword is needed

3.

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

a)

To print output

b)

To exit the program

c)

To send a value back to the caller

d)

To define a variable

4.

Which of the following is a correct function declaration in C?

a)

function add(int a, int b)

b)

int add(int a, int b)

c)

add(int a, int b)

d)

int add(a, b)

5.

What is the default return type of a function in C if not specified?

a)

void

b)

float

c)

int

d)

char

6.

Which of the following is used to pass arguments to a function in C?

a)

return

b)

main()

c)

Function parameters

7.

What does the void keyword indicate in a function declaration?

a)

The function returns a value

b)

The function has no name

c)

The function does not return any value

d)

The function has no parameters

8.

Which of the following is true about the main() function in C?

a)

It is optional

b)

It must be the last function in the file

c)

It is the entry point of a C program

d)

It cannot call other functions

9.

What is the correct way to call a function named sum that takes two integers?

a)

sum a, b;

b)

call sum(a, b);

c)

sum(a, b);

d)

int sum(a, b);

10.

Which of the following is NOT a valid return type for a function in C?

a)

int

b)

float

c)

array

d)

char

11.

Which of the following is a valid reason to use functions in C?

a)

To make code longer

b)

To avoid using variables

c)

To improve code reusability and readability

d)

To reduce memory usage

12.

What is the scope of a variable declared inside a function?

a)

Local

b)

Global

c)

Block-level

d)

Module-level

13.

Which of the following is true about recursive functions?

a)

They cannot call themselves

b)

They must have a base condition to avoid infinite calls

c)

They are faster than loops in all cases

d)

They always return void

14.

What is the output type of a function declared as void?

a)

Integer

b)

Character

c)

No output

d)

Boolean

15.

Which of the following allows a function to modify the original variable passed to it?

a)

Passing by value

b)

Passing by reference using pointers

c)

Using global variables only

d)

Declaring variables as const