wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Assignment 5 Problem Solving and C programming

Total questions: 20

Worksheet time: 3mins

Name
Class
Date
1.

What is a structure in C?

a)

Collection of same data types

b)

Collection of different data types

c)

Only integer values

d)

Only character values

2.

Which keyword is used to define a structure?

a)

structure

b)

struct

c)

define

d)

typedef

3.

Which operator is used to access structure members?

a)

*

b)

->

c)

.

d)

&

4.

Structure is a _____ data type.

a)

Built-in

b)

Primary

c)

User-defined

d)

Void

5.

Which operator is used with pointer to structure?

a)

.

b)

*

c)

->

d)

%

6.

An array of structures is used to store:

a)

One object

b)

Same data types

c)

Multiple objects

d)

Only integers

7.

What is a nested structure?

a)

Structure with array

b)

Structure inside another structure

c)

Structure with pointer

d)

Structure with union

8.

Dynamic memory allocation is done using:

a)

scanf()

b)

printf()

c)

malloc()

d)

sizeof()

9.

Which function allocates memory and initializes it to zero?

a)

malloc()

b)

calloc()

c)

realloc()

d)

free()

10.

Which function is used to release allocated memory?

a)

delete()

b)

clear()

c)

free()

d)

remove()

11.

malloc() returns _____ if memory allocation fails.

a)

0

b)

Garbage value

c)

NULL

d)

Error

12.

A singly linked list node contains:

a)

One pointer

b)

Two pointers

c)

Three pointers

d)

No pointer

13.

The last node of a linked list points to:

a)

First node

b)

Previous node

c)

Itself

d)

NULL

14.

A self-referential structure contains:

a)

Array

b)

Union

c)

Pointer to itself

d)

Function

15.

Which keyword is used to create alias names?

a)

struct

b)

union

c)

typedef

d)

define

16.

A union allows:

a)

All members at same time

b)

Only integer data

c)

One member at a time

d)

No data storage

17.

Memory occupied by a union depends on:

a)

First member

b)

Last member

c)

Largest member

d)

Smallest member

18.

Which function is used to open a file?

a)

open()

b)

file()

c)

fopen()

d)

read()

19.

Which function is used to close a file?

a)

close()

b)

fclose()

c)

end()

d)

exit()

20.

Which file mode is used to read a file?

a)

w

b)

a

c)

r

d)

b