You are on page 1of 1

University Of Hyderabad

School of Computer & Information Sciences


CA406 – Software Lab I
Major Examination MCA I Semester Max. Marks: 40
Instructions: Duration: 3 hours
 Answer any two questions. Each question carries 20 marks
 All your programs have to be done in the directory <YOUR_ROLL_NO> on the desktop.
1. Write a C program for the following tasks to be performed on an array of n integers:
a) Print all the elements which appear less than or equal to k (1 ≤ k ≤ n) times in the
array.
b) Display the elements of the array in according to the ascending order of the
frequency of the elements.

2. A sparse matrix is a matrix whose most of the elements are zeros. Storing a sparse matrix
using a two-dimensional array is waste of memory; instead, we can store each non-zero cell
value as a triplet <row, column, value> in a linked list.
Define a self referencing structure to store a non-zero element of a sparse matrix. Define
the following functions to perform operations on sparse matrices.
 Read matrix’s non-zero elements from the user and creates a linked lists as
mentioned.
 Addition of two sparse matrices

3. Write a simple application to conduct a computer based quiz. The quiz consists of questions
with answers true or false only. Suppose the questions are present in a text file
Questions.txt, in the following format:
Each odd line of the file consists of a question, and the immediate even line consists of the
answer (“true” or “false”).
Your program should display questions one by one, and prompt the user to enter his
answer, at the end display the score of the user. And also display the questions the user has
wrongly answered along with the correct answer. (You can assume that maximum of 20
questions are there in the file and each question is of length at most 80 characters).
A sample Questions.txt file:
There are one thousand years in a CENTURY.
false
DOZEN is equivalent to 20.
false
The past tense of FIND is FOUND.
true

You might also like