MCAN201 Data Structure With Python Questions For 1st Internal
MCAN201 Data Structure With Python Questions For 1st Internal
1. What is data structure? What are the types of data structure? What are the need & applications of
data structure?
2. What is Abstract Data type? What do you mean by Dynamic Data structure?
3. What are sparse matrices? How is it represented in memory? What are the types of sparse matrices?
4. Write a function / algorithm to add two sparse matrices.
5. Write an algorithm to multiply two two-dimensional array of size m x n.
6. Given an array A [10]. Initially the array contains six elements. Write a python function to insert
a new element at the third position in the array.
7. Given an array A [10]. Initially the array contains six elements. Write a python function to delete
an element at the third position in the array.
8. Given an array A[10]. Initially the array contains six elements. Write a python function to delete
an element from the array. If the element not exists in the array then it will show an appropriate
message.
9. What is the addressing formula for an element A[i][j] in row major order, if i& j are bounded by
the lower and upper limits as l1<=i<=u1 and l2<=j<=u2?
[Assume that the base address is L and w be the number of words allocated to each element]
10. Let the size of the elements stored in an 8 x 3 matrix be 4 bytes each. If the base address of the
matrix is 3500, then find the address of A [5, 2] for both row major & column major cases.
11. How you represent a polynomial in computer memory? Define a python function for the same.
12. Write a python function / algorithm to add two polynomials.
13. What is stack? Why it is called LIFO? What is top of the stack? What are the conditions for stack
underflow & stack overflow? Why stack is called ADT?
14. Write an algorithm to insert an element into a stack. Write an algorithm to delete an item from a
stack.
15. What are the applications of stacks? What is linked stack?
16. Write an algorithm to convert an infix expression to its postfix form using stack.
17. What is the difference between Linear & Binary Search? What is the prerequisite for binary
search? What are the advantages of binary search over linear search?
18. What is the precondition of performing binary search in an array? Write the Binary search
algorithm.
19. Suppose a 2-dimentional array defined as a[4...7, -1...3] requires 2bytes of storage space for each
element. If the array is stored in row major form, then calculate the address of element at location
a[6, 2]. Given that the base address is 100.Solve the same problem using column major form.
20. Consider the following stack of characters, where STACK is allocated N=8 memory cells:
STACK: A, C, D, F, K, _, _, _. Describe the stack as the following operations take place: (a)
POP(STACK, ITEM) (b) POP(STACK, ITEM) (c) PUSH(STACK,L) (d) PUSH(STACK,P) (e)
POP(STACK, ITEM) (f) PUSH(STACK,R) (g) PUSH(STACK,S) (h) POP(STACK, ITEM).
21. Suppose that you have a stack and push to the stack the integers 1,2,...n in that sequence. In
between these push operations you also invoke some pop operations in such a way that pop request
is never set to an empty stack. Immediately before each pop operation you also print the top of
the stack. After all of the integers 1, 2 ...n are pushed, the elements remaining in the stack are
1
ACADEMY OF TECHNOLOGY, QUESTION BANK, 2022
printed and popped resulting in an eventually empty stack. If n=5 it means1, 2,3,4,5 then what is
the printed sequence?
22. Convert A+ (B*C-(D/E^F)*G)*H into its postfix form.
23. Evaluate: 562+*124/- using stack.
24. The following postfix expression with single digit operands is evaluated using stack
8 2 3 ^ / 2 3 * + 5 1 * -
25. What will be the top two elements of the stack after the first * is evaluated.
Convert A $ B * C- D +E / F/(G+G) into prefix.
26. Differentiate data structure, algorithm and program with a suitable example.
27. Let A be a two-dimensional array declared as follows:
28. A : array [1... 10] [1... 15] of integer; Assuming that each integer takes one memory
location. The array is stored in row-major order and the first element of the array is
stored at location 100, what is the address of the element A[i][j]?
29. Can a primitive data type be considered as an ADT?
30. List out some of the areas in which data structures are used?
31. What are the major data structures used in the following areas: RDBMS, Network data model and
Hierarchical data model?
32. Define an algorithm. What are the properties of an algorithm?
33. A program P reads in 500 integers in the range [0...100] representing the scores of 500 students.
It then prints the frequency of each score above 50. What would be the best way for P to store the
frequencies?
34. Write a sub algorithm to find the smallest element in the array.
35. Parenthesis are never needed in prefix or postfix expressions. Why?
36. A single array A[1…MAXSIZE] is used to implement two stacks. These two stacks grow from
opposite ends of the array. Variables top 1 and top 2 (top 1 < top 2) point to the location of topmost
element in each of the stacks. If the space is to be used efficiently what is the condition for stack
full?
37. Pick out the equivalent postfix expression for this infix expression:
X=((A+B)*C-(D-E)^(F+G))