wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

VIVA

Total questions: 16

Worksheet time: 11mins

Name
Class
Date
1.

1. What is the purpose of a function in C?

a)

a) To define a variable

b)

b) To divide code into reusable blocks

c)

c) To store data

d)

d) To print output

2.

2. What is the correct syntax to declare a function in C?

a)

a) function int add();

b)

b) int add();

c)

c) add() int;

d)

d) int = add();

3.

3. Which of the following is a valid function definition?

a)

a) int sum(a, b) {

return a + b;

}

b)

b) int sum(int a, int b) { return a + b;

}

c)

c) sum(int a, int b) return a + b;

d)

d) function sum(int a, int b) { return a + b; }

4.

4. What is the return type of a function that does not return any value?

a)

a) void

b)

b) empty

c)

c) null

d)

d) int

5.

10. What keyword is used to exit a function and optionally return a value?

a)

a) exit

b)

b) return

c)

c) break

d)

d) stop

6.

What will print?

a)

s

b)

m

c)

d

d)

e

7.
a)

0

b)

1

c)

5

d)

10

8.

What will print?

a)

0

b)

1

c)

100

d)

101

9.

The __________, also known as the address operator, returns the memory address of a variable.

a)

asterisk (* )

b)

ampersand ( & )

c)

percent sign ( % )

d)

exclamation point ( ! )

10.

In a C program,

int a = 20;

*ptr = &a;

**dptr = &ptr;

printf ("%d", **dptr);


prints

a)

address of a

b)

address of ptr

c)

value of a

d)

address of dptr

11.

What is a structure in C programming?

a)

A special character in C programming

b)

A built-in function in C programming

c)

A user-defined data type that allows you to combine data items of different types.

d)

A type of loop in C programming

12.

What is the syntax for inputting data into a structure in C?

a)

structName->memberName = value;

b)

structName.memberName = value

c)

structName.memberName = value;

d)

structName.memberName : value;

13.

How do you access the member variables of a structure in C?

a)

Using the asterisk (*) operator

b)

Using the dot (.) operator

c)

Using the hash (#) operator

d)

Using the plus (+) operator

14.

Write a C program to input data for a student using the 'Student' structure.

a)

Define a structure named 'Student' with the required fields and use the scanf function to input the data for the student.

b)

Define a structure named 'Person' instead of 'Student' to input the data

c)

Use the 'printf' function to input the data for the student

d)

Create a function named 'Student' to input the data

15.

How do you declare a structure variable of type 'Student' in C?

a)

struct Student student1;

b)

Student = student1;

c)

int student1;

d)

Student student1;

16.

What is required to declare a structure variable in C?

a)

The variable name only

b)

The keyword 'struct' followed by the structure tag

c)

Only the structure tag

d)

The keyword 'class'