Lab Exam External Questions PDF
Lab Exam External Questions PDF
1.Generally a program requires two stack containing the same type of items such as integers. If
the two stacks are stored in separate arrays. Then one stack might overflow while there was
considerable unused space in the other. A neat way to avoid the problem is to put all the space
in one array and let one stack grow from one end of the array and the other stack start at the
other end and grow in opposite direction i.e., toward the first stack, in this way, if one stack
turns out to be large and the other small, then they will still both fit, and there will be no
overflow until all the space is actually used. Declare a new structure type Double stack that
includes the array and the two indices top A and top B, and write a program in C which
contains the functions Push A, Push B, Pop A and Pop B to handle the two stacks within one
DoubleStack. Now in this program the double stack will consists of odd and ever integers. You
can use top A to take even integers and top B to push odd integers. The odd and even numbers
will be user inputs.
2. Write a program in c to accept n numbers from user to create a single linked list. After that
splits the linked list into two linked lists, so that odd numbers go to the first list, and all even-
numbers go to the second list.
3. Choose the correct options from the following.
a. If a node having two children is deleted from a binary tree, it is replaced by its
A ) Inorder predecessor
B ) Inorder successor
C ) Preorder predecessor
D ) Post order
A ) Stack
B ) Queue
C ) List
D ) Heap
c. You have to sort a list L consisting of a sorted list followed by a few “random” elements.Which of the following sorting
methods would be especially suitable for such a task?
A ) Bubble sort
B ) Selection sort
C ) Quick sort
D ) Insertion sort
d. For an undirected graph with n vertices and e edges, the sum of the degree of each vertex is equal to
A ) 2n
B ) (2n-1)/2
C) 2e
D ) e2/2
e. The OS of a computer may periodically collect all the free memory space to form contiguous block of free space. This
is called
A ) Concatenation
B ) Garbage collection
C ) Collision