NEW
Font size
WorksheetsAssignment 5 Problem Solving and C programming
Total questions: 20
Worksheet time: 3mins
What is a structure in C?
Collection of same data types
Collection of different data types
Only integer values
Only character values
Which keyword is used to define a structure?
structure
struct
define
typedef
Which operator is used to access structure members?
*
->
.
&
Structure is a _____ data type.
Built-in
Primary
User-defined
Void
Which operator is used with pointer to structure?
.
*
->
%
An array of structures is used to store:
One object
Same data types
Multiple objects
Only integers
What is a nested structure?
Structure with array
Structure inside another structure
Structure with pointer
Structure with union
Dynamic memory allocation is done using:
scanf()
printf()
malloc()
sizeof()
Which function allocates memory and initializes it to zero?
malloc()
calloc()
realloc()
free()
Which function is used to release allocated memory?
delete()
clear()
free()
remove()
malloc() returns _____ if memory allocation fails.
0
Garbage value
NULL
Error
A singly linked list node contains:
One pointer
Two pointers
Three pointers
No pointer
The last node of a linked list points to:
First node
Previous node
Itself
NULL
A self-referential structure contains:
Array
Union
Pointer to itself
Function
Which keyword is used to create alias names?
struct
union
typedef
define
A union allows:
All members at same time
Only integer data
One member at a time
No data storage
Memory occupied by a union depends on:
First member
Last member
Largest member
Smallest member
Which function is used to open a file?
open()
file()
fopen()
read()
Which function is used to close a file?
close()
fclose()
end()
exit()
Which file mode is used to read a file?
w
a
r
b
