You are on page 1of 2

Introduction to Programming & Data Structures

(Subject Code - CS1101)

END SEMESTER EXAMINATION OF 1ST SEM B.TECH OF SPRING


SEMESTER 2021-2022
TOTAL MARKS-50

Answer any 5 questions.


1)
a) Write a C program to find the reverse of an integer number NUM and
check whether it is PALINDROME or NOT.
Sample Output:
Enter a Number: 121
It is a Palindrome
b) Distinguish between array and linked list.
c) Write an algorithm to traverse a linked list.

[Marks – 6+2+2]
2)
a) Convert the following infix expression to its prefix form using stack
A + B – C*D/E + F.
b) What are bitwise operators available in C?
c) What is purpose of strcmp( )and strcpy( )?
d) Show the effect of INSERT and DELETE operations on to the Linear queue
of size 10. The Linear queue sequentially contains 100, 200, 300, 400,
and 500 where 100 is at front of the queue. Show diagrammatically the
effect of -
1. INSERT (12)
2. DELETE
3. INSERT (34)
4. INSERT (56)

[Marks – 2+2+2+4]

3)
a) Write the algorithm to delete an element from a queue.
b) How do you test for an empty queue in a circular queue?
c) Explain how to evaluate arithmetic expressions using stacks.

[Marks – 5+2+3]

4)
a) Explain stack overflow and underflow conditions with example.
b) Define ADT. What are the benefits of ADT?
c) When can singly linked list be represented as circular linked list?
d) What is the need for the header in linked list? What is a circular
linked list?
e) Define double ended queue.
[Marks – 2+2+2+2+2]

5)
a) Sort the following numbers in ascending order using Bubble sort. Given
Numbers :
347, 12, 604, 5281, 46 and Write the output after each iteration.
b) What is the main idea behind the selection sort?
c) Suppose we have the following sorted list:
[1, 4, 5, 8, 12, 13, 14, 15, 20, 22]
and array data structure is used. We are using recursive binary search
algorithm to search an element 8. After how many iterations will be
get the search key. Explain step by step.
[Marks – 4+1+5]

6)
a) Distinguish between stack and queue.
b) Differentiate linear and non-linear data structure.
c) Write a C program that reads a sentence and prints frequency of each
of the vowels and total count of consonants.
Sample Output:
Enter sentence: Hello my name is Raju.
Frequency of Vowels:
A:2
E:2
I:1
O:1
U:1
Count of consonants: 10
.
[Marks – 2+2+6]

You might also like