Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Sample OBE Questions for MID-Term Exam- Spring 23-24 (Section DS(A))

1. Given the following 2D array:

0 1 2 3
0 12 5 8 10
1 6 7 4 11
2 18 9 2 1
3 20 3 15 13

a) Find the summation of the elements of a 2D array.


b) Find the summation of two 2D arrays and store the result in another 2D array.
c) Find the Summation of the boundary elements of a 2D array.
d) Find the transpose of the 2D array.

2. Walid is excited about going to the cattle market with his father and brother to buy cows for Eid-
ul-Adha. They plan to buy three similar (in height, weight and color) cows from a seller. While
roaming around the market, they found a seller who has assigned ratings to his cows based on
their height, weight and color. Walid along with his father and brother has decided to buy the
three cows having the minimum difference between their ratings. Now, you must identify the
proper data structure concept for this (which concept you need to follow). Write a C++ Program
for Walid to find the difference in ratings between three cows.
3. Write a program with appropriate data structure to keep records of 10 students. Each student will
have the following information: Unique ID (you can use integer for this), Number of Credits
Completed, CGPA
Print all the student’s ID whose CGPA is more than 3.75.
Print all the student’s ID who has completed more than 50 credits.
4. You are designing a text editor that includes a feature to check the validity of parentheses in a
given text. Your task is to implement a function that checks whether the parentheses in the text
are balanced or not. For example, "((())())" is a valid sequence of parentheses, whereas "())(" is
not.
5. You're working on a program that manages a library inventory system. The system stores
information about books in an array, with each element containing details like title, author, and
publication year. A user wants to search for a specific book by title. You need to efficiently locate
the book within the array if it exists and inform the user accordingly.

You might also like