0% found this document useful (0 votes)
11 views3 pages

Updated_End_Term_Examination

Uploaded by

kk4020002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views3 pages

Updated_End_Term_Examination

Uploaded by

kk4020002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

END TERM EXAMINATION

THIRD SEMESTER, 2023-2024

Subject: Data Structures and Programming Paradigms

Max Marks: 60

Time Allowed: 3 Hours

General Instructions
• Follow the instructions given in each section.

• Attempt the questions in order.

SECTION-A (5x1=5 Marks)


(Multiple Choice Questions: Choose the correct option)

1(i) Which of the following is a generic function in C++?


(a) void print<T>(T val)
(b) void print(int val)
(c) int print(T val)
(d) template<void> print()

1(ii) Which STL container provides constant time complexity for element access using a
key?
(a) vector
(b) map
(c) unordered_map
(d) list

1(iii) What is the difference between a deque and a vector?


(a) Deque supports push_back only.
(b) Vector supports push_front.
(c) Deque allows insertion at both ends, vector does not.
(d) Both are identical.

1(iv) What does the `front()` function do in STL queues?


(a) Removes the first element
(b) Adds an element to the front
(c) Returns the first element
(d) Returns the size of the queue

1(v) Which of the following algorithms has the best average case complexity for sorting?
(a) Bubble Sort
(b) Quick Sort
(c) Insertion Sort
(d) Merge Sort

SECTION-B (5x2=10 Marks)


(Attempt any 5 questions. Each question carries 2 marks.)

2. Write a short note on the advantages of using generic programming.

3. What are iterators in STL? Explain their significance.

4. Differentiate between time complexity and space complexity.

5. Explain the differences between linear search and binary search.

6. Write a note on recursion and its applications in algorithms.

7. List and briefly describe the operations of a stack.

SECTION-C (5x5=25 Marks)


(Answer any 6 questions. Each question carries 5 marks.)

8. Compare and contrast `std::vector` and `std::deque` in terms of operations and usage.

9. Write a program to demonstrate the insertion and deletion operations in a singly linked
list.

10. Explain the memory representation of a two-dimensional array.

11. Write a program to implement the Bubble Sort algorithm.

12. What are Polish notations? Explain with examples.

13. Describe the different types of tree traversal algorithms and their applications.
SECTION-D (2x10=20 Marks)
(Answer any 3 questions. Each question carries 10 marks.)

14. Write a program to demonstrate stack operations using linked lists.

15. Write a program to implement Merge Sort using recursion and explain its working step
by step.

16. Write a program to implement a queue using two stacks and explain its functionality.

You might also like