Assignment 1
Assignment 1
Q3. Write code snippets for any two of the following: [2x4]
i. Input and display data in a union token composed of mutually exclusive members operator (data
type float) and operand (data type char).
ii. Write a function to search for a data value in a linked list. The function must return a pointer to
the matching node on success and NULL on failure.
iii. Write a code snippet to copy all the records contained in a binary file into a dynamically created
array. The array should be allocated memory large enough to hold all the records in the file.
iv. Demonstrate the usage of function pointers in calling the library function bsort to sort an array of
struct Student on basis of rollno.
Q4. Write programs / functions for any two of the following: [6.5x2]
i. Records of employees of an organization are stored in a binary file. Write a function to modify
the phone number of an employee, given his employee ID. Also give the function call statement.
ii. Write functions to perform following operations on a linked list:
a. Delete the head node.
b. Add a node at end.
iii. Write a program to combine contents of multiple text files in a target file. The names of the files
must be accepted as command line parameters. Remember to include appropriate checks.
iv. Members of a society are to elect members of a coordination committee. The committee has five
posts. A member may choose not to vote at all. But if present, the member gives choices for all
the posts. You are required to:
a. Create a storage area dynamically large enough to hold all five choices of the members
who choose to vote.
b. Get users choices.
c. Display all the choices.
d. Free the memory.
Assignment 2