Assignment-5
Assignment-5
Assignment – V
Assume that there are not more than 100 students in the college.
a. Write a function to print the names of all students who joined in a particular year.
b. Write a function to print the data of a student whose roll number is given.
3. Write a program which accepts names, rolls and marks of 10 students in 6 subjects stores it
in an array of structures. Write a separate function which prints in ascending order the rank
list (roll, name, average) based on the average of 6 subjects.
4. Write a program to copy one file to another where files names are passed as command line
arguments.
5. Write a program which read a C source file having comments (between /* and */) and
copies it another file leaving the comments.
6. Write a C program which reads a C source file and determines percentage of characters
which are part of comments.
7. Write a program to sort some numbers in ascending order. The numbers are to be input from
a file named ‘input.txt’. The output should be written in a file named ‘output.txt’. Use
bubble sort algorithm and dynamic memory allocation for implementation.
8. An 8 bit unsigned character is used to store the gender (bit no. 7), year of study (bit nos. 6
and 5) and age of a student (bit nos. 4 to 0), where bit no. 7 is the MSB. Write a C function
which accepts an 8 bit unsigned character value and prints the gender, year of study and age
of a student.
9. In Binary Coded Decimal (BCD) encoding, each decimal digit is stored in a 4-bit nibble.
Suppose, 8 bit unsigned characters are used to store positive two digit decimal numbers. For
example, decimal 39 is stored as 00111001. Write a C function which accepts such a
positive two digit decimal number as an 8 bit unsigned character and returns the decimal
number as an integer.
10. Write a program which accepts a floating point number (can be single or double precision)
and prints the different parts of its storage representation (sign of number, mantissa,
exponent, and sign of exponent) in binary.
11. Write a C program which reads a C source file and determines number of variables defined
of each built in data types. [OPTIONAL]
12. Write a program to build a linked list of integers. Write functions to add a new node at the
beginning, at the end, or in the middle. Also write functions to delete a node and to traverse
the list. [OPTIONAL]
13. Write a program to implement a stack using linked list. Write functions to push and pop
elements. [OPTIONAL]
14. Write a C program which reverses a given link list (pointer to head node is given). Assume
suitable definition of link list nodes. [OPTIONAL]
15. Write a program to create a Telephone Directory application, which will have options for
b. Delete Contact
d. Browse
Contact Information should be stored in a text file in a readable format. Allow multiple
telephone numbers against a single contact name. [OPTIONAL]