Computer Science (Semester 3)
Total marks: 80
Total time: 3 Hours
INSTRUCTIONS
(1) Question 1 is compulsory.
(2) Attempt any three from the remaining questions.
(3) Draw neat diagrams wherever necessary.
Module - 1
1.a.
Differentiate between structures and unions
(4 marks)
00
1.b.
Explain with examples: i) insertion and ii) deletion in an array
(8 marks)
00
1.c.
Suppose each student in a class of 25 students is given 4 tests,. Azim the students are numbered from 1 to 25, and the test scores are assigned in the 25 x 4 Matrix called SCORE. Suppose base (SCORE) = 200, W = 4 and the programming language uses Row-major order to store this 2D array , then find the address of 3rd test of 12th students i.e SCORE (12, 3)
(4 marks)
00
Or
2.a.
list and explain any four functions supported in C for dynamic memory allocation with examples
(8 marks)
00
2.b.
Consider two polynomials A (x) = 2x^100 + 1 and B(x) = x⁴ + 10x³ + 1 with a diagram show how this polynomials are stored in 1D array
(2 marks)
00
2.c.
With an example illustrates that "product of two sparse matrices may not be sparse" . Also write a C function for matrix multiplication of 2 sparse matrices
(6 marks)
00
Module -2
3.a.
Write an algorithm to evaluate a postfix expression . Evaluate the following postfix expression abc + * d e/- where a = 5, b= 6, c = 2, d = 12, e = 4
(6 marks)
00
3.b.
Write the algorithm for ackermann function. Evaluate A(1,2) using ACKERMANN function
(4 marks)
00
3.c.
With neat diagram explain ONE - WAY list representation of a priority queue
(6 marks)
00
Or
4.a.
Write a C program demonstrating the various stack operations. Including cases for overflow and underflow of STACKS.
(8 marks)
00
4.b.
Describe how you could model a maze. Where 0 represents open path and 1 represents barriers. What moves are permitted in the matrix model? Provide an example MAZE together with its allowable moves and table of moves
(8 marks)
00
Module-3
5.a.
Write a function for singly linked list with integer data, to search an element in the list that is unsorted and a list that is sorted.
(8 marks)
00
5.b.
Given 2 singly linked list. LIST-1 and LIST-2. Write an algorithm to form a new list LIST-3 using concatenation of the LIST-1 and LIST-2
(8 marks)
00
Or
6.a.
Write a note on header linked list. Explain the widely used header lists with diagram.
(5 marks)
00
5.b.
List out any 2 differences between doubly linked list and singly linked list
(2 marks)
00
6.c.
Illustrate with examples how to insert a node at the beginning. INSERT a node at intermediate position, DELETE a node with a given value
(9 marks)
00
Module -4
7.a.
Write a short note on threaded binary trees and state the rules to construct a threaded binary tree.
(8 marks)
00
7.b.
With separate function illustrate recursive search and iterative search of a binary search tree.
(8 marks)
00
Or
8.a.
Consider the following tree T in (fig.8(a)) write the preorder , inorder , postorder for the tree T. Also find the depth of TREE in (Fig.8.(a))
Pic
(4 marks)
00
8.b.
Write functions to illustrate copying of binary trees. And testing equality of binary trees.
(8 marks)
00
8.c.
Define complete binary tree. Illustrate with example
(4 marks)
00
Module -5
9.a.
State and explain WARSBALLS algorithm with an example
(8 marks)
00
9.b.
Write an algorithm for insertion sort. Apply insertion sort, showing the various passes to sort the array A, where A = [77, 33, 44 , 11, 88 , 22 , 66 , 55]
(8 marks)
00
Or
10.a
Write a short note on hashing. Explain any 3 popular HASH function
(8 marks)
00
10.b.
What do you understand by the term file organisation? Briefly summarise any 3 widely used file organisation techniques.
(8 marks)
00