Exam-1 (Data Structure & Database)
Full Marks: 100
Time: 1 hour 15 min
িনয়মাবলী :
১. A4 size খাতায় পরী া িদেবন । খাতার উপর লিগন আইিড,!ফান নং িলখেবন(!য&ট িদেয় !র(জে*শান কেরেছন)
২.0থেম ঘিড় ধের ১ ঘ5ায় পরী া !শষ করেবন । সৎ থাকেবন। !দেখ িলখেবন না।
৩.তারপর !মাবাইল ছিব ত: েল !স;েলা pdf বানােবন। িল?ঃ [Link]/jpg-to-pdf
৪.আমার ইেমইল এ পাঠােবন । সাবেজN এর ঘের লিগন আইিড, আর !ফান নং িলেখ পাঠােবন।
Email: [Link]@[Link]
Answer all the questions
1. a. Find the time complexity of the following code snippet. 2+2=4
i) for(i=0;i<=n;i++) ii) for(i=0;i<=n;i++)
{ {
Statement; for(j=0;j<=n;j++)
} {
Statement;
}
}
b. Calculate linear search and binary search time complexity. 3+3=6
2. a. What are the operations performed on a data structure? What are the advantages of linked 10
list over array?
b. Draw a Binary min heap that results from inserting 9, 3, 7, 1, 8, 2, 6, 5, 4 in that order 10
into an initially empty heap. Show each insertion step separately.
3. a. Draw a binary Tree for the expression: A*B – (C+D) *(P/Q) 10
b. Describe the three level of data abstraction. Explain super and candidate key. 6+4=10
4. a. Write an algorithm to create a stack. If stack is overflow mention it. 5
b. Describe ACID properties of Database. How indexing is created. What is the impact on 15
indexing over database?
5. Consider the following table: 3+3+4=10
EmployeeDetails(EmpId, FullName, ManagerId, DateOfJoining)
EmployeeSalary(EmpId, Project, Salary)
[Link] a SQL query to fetch the count of employees working in project 'P1'.
[Link] a SQL query to fetch employee names having salary greater than or equal to 5000
an less than or equal 10000.
[Link] a SQL query to fetch project-wise count of employees sorted by project's count in
descending order.
6. The difference between the value of a number increased by 12.5% and the value of the 10
original number decreased by 25% is 30. What is the original number?
7. Consider that A and B are two sets. If AxB={(1,0),(2,1),(3,-1),(4,3)}, then find A and B. 10
Also prove that AxB not equal BxA.