100% found this document useful (1 vote)
915 views

DS Assignment 1

This document contains questions about data structures and algorithms. It includes short answer questions about data structures like arrays, algorithms, complexity analysis and more. It also includes long answer questions about specific data structures like arrays, their properties, operations, and representations. Multiple choice questions test understanding of key concepts like time and space complexity, different cases of algorithm analysis, linear and non-linear data structures, and arrays.

Uploaded by

Sonal Jaiswal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
915 views

DS Assignment 1

This document contains questions about data structures and algorithms. It includes short answer questions about data structures like arrays, algorithms, complexity analysis and more. It also includes long answer questions about specific data structures like arrays, their properties, operations, and representations. Multiple choice questions test understanding of key concepts like time and space complexity, different cases of algorithm analysis, linear and non-linear data structures, and arrays.

Uploaded by

Sonal Jaiswal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

UNIT 1

Short Questions:-
1. Define data structure.
2. Define algorithm.
3. List out areas in which data structures are applied.
4. List out structure of algorithm.
5. List out properties of algorithm.
6. List out the steps involved in the development of an algorithm.
7. Define Abstract Data Type.
8. List out the classification of data structure.
9. What is linear/primitive data structure?
10. What is non-linear/non-primitive data structure?
11. Gives the names of linear data structure.
12. Gives the names of non-linear data structure.
13. Which are the operations performed on data structure?
14. How to measure the performance of algorithm?
15. What is time complexity?
16. Define space complexity.
17. When empirical testing is used?
18. What is the use of theoretical testing?
19. What is average, best and worst case complexity?
20. Define O notation of time complexity.
21. List out the notation that used to express time complexity of algorithm.

Long Questions:-
1. Explain the classification of data structure.
2. Explain various operations performed on data structures.
3. Write a short note on abstract data type.
4. Explain the properties of algorithm.
5. Explain the steps for the development of algorithm.
6. Differentiate between linear and non-linear data structure.
7. What do you mean by algorithm? Give example.
8. Explain efficiency of algorithm.
9. Write a short note on asymptotic notations.
10. Distinguish between best, worst and average case complexities of an algorithm.
11. What do you mean by Time and Space complexity and how to represent these complexity?
12. Explain the concept of data type.
13. Find the complexity of following
code. for (int i = 0; i < n; i++) {
for(int j=I;j<n;j++)
cout<<j
}
14. Find the total frequency count of following
code.
for send=1 to n do
for receive =1 to send do
for ack=2 to receive do
message=send-(receive+ack) ack=ack-1
send=send+1
end
end
end
15. Find the total frequency count of following code.
i=2n
for j=1 to i
for k=3 to j
n=n+1
end
end

Multiple Choice Questions:-


1. Two main measures for the efficiency of an algorithm are
a. Processor and memory
b. Complexity and capacity
c. Time and space
d. Data and space
2. The time factor when determining the efficiency of algorithm is measured by
a. Counting microseconds
b. Counting the number of key operations
c. Counting the number of statements
d. Counting the kilobytes of algorithm
3. The space factor when determining the efficiency of algorithm is measured by
a. Counting the maximum memory needed by the algorithm
b. Counting the minimum memory needed by the algorithm
c. Counting the average memory needed by the algorithm
d. Counting the maximum disk space needed by the algorithm
4. Which of the following case does not exist in complexity theory
a. Best case
b. Worst case
c. Average case
d. Null case
5. Full form of ADT is
a. Advanced data type
b. Array data type
c. Abstract data type
6. The complexity of the average case of an algorithm is
a. Much more complicated to analyze than that of worst case
b. Much simpler to analyze than that of worst case
c. Sometimes more complicated and some other times simpler than that of worst case
d. None or above
7. Which of the following data structure is not linear data structure?
a. Arrays
b. Linked lists
c. Both of above
d. None of above
8. Which of the following data structure is linear data structure?
a. Trees
b. Graphs
c. Arrays
d. None of above
9. Which of the following data structure is non-linear type?
a. String
b. Lists
c. Stacks
d. None of above
10. Which of the following data structure is linear type?
a. Strings
b. Lists
c. Queues
d. All of above
11. is a step-by-step procedure for calculation
a. Data structure
b. Abstract Data Type
c. Primitive Data Type
d. Algorithm

12. A mathematical-model with a collection of operations defined on that model is called


e. Data structure
f. Abstract Data Type
g. Primitive Data Type
h. Algorithm
13. Representation of data structure in memory is known as:
a. Recursive
b. Abstract data type
c. Storage structure
d. File structure
14. Which of the following is considered an Abstract Data Type?
a. Array
b. reference variable
c. any of the primitive types (e.g., int, double, char)
d. Stack
e. all of the above
15. An algorithm must be generic enough to solve all problems of a particular class.
a. Finiteness
b. Definiteness
c. Generality
d. Effectiveness
16. The first step of development of an algorithm is
a. Problem analysis
b. Problem statement
c. Algorithm analysis
d. Implementation
17. Input instance for which algorithm take minimum possible time is called
a. Worst case
b. Best case
c. Average case
d. Null case
18. Input instance for which algorithm take maximum possible time is called
a. Worst case
b. Best case
c. Average case
d. Null case
19. Which case analysis appropriate when the response time of the algorithm is critical?
a. Worst case
b. Best case
c. Average Case
d. Null Case

20. The time complexity of the algorithm in a best case would be expressed as
a. O(1)
b. O(n)
c. O(n2)
d. O(n+1)
Arrays
Short Questions:-
1. Define array.
2. List out application of Array.
3. Which operation is supported by an array ADT?
4. What will happen in a C++ program when you assign a value to an array element whose subscripts
exceed the size of array?
5. What is the index number of the last element of an array with 20 elements?
6. List out the operations performed on Array.
7. Give the number of elements in array a[1:5].
8. Give the number of elements in array a[1:5,1:4,1:3].
9. Give the number of elements in array A[3][2].
10. What is row major order?
11. What is column major order?
12. Write formula to calculate address of elements in one-dimensional array.
13. Write formula to calculate address of elements in two-dimensional array.
14. Write formula to calculate address of elements in three-dimensional array.
15. Define sparse matrix.
16. Define order-list matrix.
17. If the starting address of array a[-2,23] is 100 then what will be the address of 16th element?
18. If the starting address of array a[1:5,1:6] is 100 then what will be the address of a[3,4] element?
19. If the starting address of array a[1:5,1:6,1:4] is 100 then what will be the address of a[3,4,5] elem ent?
20. Write any one difference between row major and column major.
What are the disadvantages of array
Long Questions:-
1. What is an array? Which operations can be performed on Array? Explain with example.
2. How to calculate number of elements in one dimensional array? Explain with example.
3. How to calculate number of elements in two dimensional arrays? Explain with example.
4. How to calculate number of elements in three dimensional arrays? Explain with example.
5. Explain one-dimensional array. How one dimensional array can be represented in memory?
6. Explain two-dimensional array. How two dimensional arrays can be represented in memory?
7. Explain three-dimensional array. How three dimensional arrays can be represented in memory?
8. Explain any one method to calculate memory location for different position in two-dimensional array.
9. What are the applications of an array? Explain each with examples.
10. Explain sparse matrix. What are the benefits of the sparse matrix?
11. Explain order-list matrix. What are the benefits of the order-list matrix?
12. Write an algorithm for insert and delete operation in array.
13. Write an algorithm to implement sparse matrix.
14. Write an algorithm to search element in array.
15. Write program to insert element at position of user choice.
16. For the following array A, compute
Array: A
Column Index: 0:5
Base address: 100
Size of memory location: 4 bytes Row Index: 0:15
a. the dimension of A
b. the space occupied by A in the memory
c. the address of A[7,2]
17. Distinguish between the row major and column major ordering of an array.
18. Suppose A is linear array with n numeric values. Write procedure which finds the average of the values
in A.
19. Write a program to find second highest value from array elements.
20. Write a program to delete an element of array at position of user choice.
Multiple Choice Questions:-
1. Which of the following linear Data Structure?
a. Array b. Structure c. Tree d. Long
2. Consider following
code:
#include<iostream
.h> int main()
{ int a[10];
A[0]=10; A[1]=4; A[3]=15;
cout<<A[2+1];
}
What will be the output of following code?
a. NULL b. 10 c. 4 d. 15
3. Which are the correct array initialization
statements? a. int A[3]={1,2,3};
b. int A[3]={123};
c. int A[3]=”123”;
d. All
4. Which of the following statements are wrong statements?
a. Array is primitive data structure.
b. Every element of array must be same.
c. In array, Insert element is called push operation.
d. All
5. Which are the applications of array?
a. Sparse matrix
b. Ordered list
c. Both a & b
d. none
6. Which among the following pairs of operations is supported by an array ADT?
a. Store and Retrieve
b. Insert and Delete
c. Copy and Delete
d. Append and Copy
7. The number of elements in array Array[1:u] is
given by
a. (1 - u)
b. (u)
c. (u – 1 + 1)
d. (u – 1 - 1)
8. The number of elements in array Array[l1:u1, l2:u2] is
given by
a. (u1- l1 – 1)(u2 – l2 - 1)
b. (u1*u2)
c. (u1 – l1)(u2 – l2)
d. (u1- l1 + 1)(u2 – l2 + 1)
9. The number of elements in array Array[l1:u1, l2:u2, l3:u3] is
given by
a. (u1- l1 – 1)(u2 – l2 - 1) (u3 – l3 - 1)
b. (u1*u2*u3)
c. (u1 – l1)(u2 – l2)(u3-l3)
d. (u1- l1 + 1)(u2 – l2 + 1)(u3 – l3 + 1)
10. For the array A[1:u1, 1:u2] where α is the base address, A[i,1] has its address
given by
a. (i – 1)u2
b. α + (i – 1)u2
c. α + i * u2
d. α + (I – 1) * u1

11. An one-dimensional array array[1:5] contains elements.


a. 5 b. 4 c. 1 d. 6
12. A two-dimensional array array[1:3, 1:3] contains
elements. a. 3 b. 6 c. 9 d. 7
13. A multi-dimensional array array[0:2, 10:20, 3:4, -10:2] contains
elements. a. 240 b. 858 c. 390 d.
160
14. The memory address of the first element of an array is called
a. floor address
b. foundation address
c. first address
d. base address
15. The memory address of fifth element of an array can be calculated by the formula
a. LOC(Array[5]=Base(Array)+w(5-lower bound), where w is the number of words per memory cell
for the array
b. LOC(Array[5])=Base(Array[5])+(5-lower bound), where w is the number of words per memory
cell for the array
c. LOC(Array[5])=Base(Array[4])+(5-Upper bound), where w is the number of words per memory
cell for the array
d. None of above
16. Which of the following data structures are indexed structures?
a. linear arrays
b. linked lists
c. both of above
d. none of above
17. Two dimensional arrays are also called
a. tables arrays
b. matrix arrays
c. both of above
d. none of above
18. If the array is A[1:10], what will be the address of A[5] element of an array having base address
100. a. 105
b. 106
c. 107
d. 108
19. If the array is A[1:10, 1:5], _ will be the address of A[5,2] element of an array having
base address 100.
a. 120
b. 121
c. 122
d. 123
20. If the array is A[1:5, 1:2, 1:3], will be the address of A[1,2,3] element of an array having
base address 100.
a. 102
b. 104
c. 105
d. None
Linked List
Short Questions:-
1. What is the limitation of sequential data structures?
2. What is linked list?
3. Give real world example of linked list.
4. Explain logical representation of linked list.
5. What are the advantages of singly linked list?
6. What are the disadvantages of singly linked list?
7. Which are the operations performed in singly linked list?
8. What is the need for linked representation of lists?
9. Define circular linked list.
10. What are the advantages of circular linked list?
11. What are the disadvantages of circular linked list?
12. What is the node structure for circular linked list?
13. Define doubly linked list.
14. What are the advantages of doubly linked list?
15. What are the disadvantages of doubly linked list?
16. List out operations performed in doubly linked list.
17. List application of linked list.
18. What is the difference between circular linked list and linear linked list?
19. What is the difference between array and stack?
20. What do you mean by polynomials?
21. Give node structure for the term of polynomial having single variable.
22. How singly linked list representation of polynomials?

Long Questions:-
1. Write short note on linked list.
2. Explain operation of singly linked list with algorithm.
3. Explain circular linked list.
4. What are the advantages of circular linked list over singly linked list?
5. Write pseudo code to add node at the end in circular linked list.
6. Explain doubly linked list with advantage and disadvantage of it.
7. Write a pseudo code to delete a node from doubly linked list.
8. Explain operation of doubly linked list with algorithm.
9. Write short note on multiply linked lists.
10. Explain application of linked list.
11. Write short note on polynomial manipulation.
12. Write short note on sparse matrix.
13. Explain operation of linked stack and linked queue.
14. Write algorithm for push/pop operation on a linked stack.
15. What are merit of linked stack and queues over their sequential counterparts?
16. How are push and pop operations implemented on a linked stack?
17. Write algorithm for insertion/deletion operation on a linked queue.
18. Write short note on Dynamic memory management.
19. Explain application of linked stack and linked queue.
20. Write a pseudo code for implementing stack using linked list.
21. Write a pseudo code for implementing queue using linked queue

Multiple Choice Questions:-


1. A node carries information regarding
a. Data
b. Link
c. Link and Data
d. none
2. A linked list is which type of data structure.
a. Linear
b. Non Linear
c. Hierarchical
d. None
3. Type of storage is used to represent Lists
a. Random
b. Sequential
c. Dynamic
d. Logical
4. Linked list are best suited
a. For relatively permanent collections of data
b. For the size of structure is constantly changed
c. Both a & b
d. None
5. Linear order linked list is provided through
a. variables
b. arrays
c. Pointer
d. Strings
6. In a Single Link List node contains no links.
a. First
b. Last
c. last but one
d. middle
7. In Single Linked List a node contain minimum how many fields(assuming one for data).
a. 2
b. 3
c. 1
d. None
8. Single link list performs which of the following methods
1) Insertion
2) Modification
3) Searching
a. 1 and 2
b. 2 and 3
c. 1 and 3
d. All
9. In linked lists there are no NULL links in:
a. Singly linked list
b. Doubly linked list
c. Circular linked list
d. None
10. The list with no node is called as
a. Empty list
b. Null list
c. Zero list
d. None
11. Which of the following is the application of the singly linked list?
a. Sparse matrix
b. Police notation
c. Tower of Hanoi
12. Which of the following will contain more memory space?
a. Singly linked list
b. Doubly linked list
c. Array
d. Circular linked list
13. In polynomial manipulation, nodes consists of three field representing
a. Coefficient, exponential and link
b. Previous item link, data item, next item link
c. Coefficient, data item and link
d. None
14. A linked list in which last node contain the link of the first node is called
a. Singly linked list
b. Doubly linked list
c. Circular linked list
d. All
15. A singly linked list facilitates list traversal in
a. Single direction
b. Any direction
c. Circular direction
d. All
16. A doubly linked list facilitates list traversal in
e. Single direction
f. Any direction
g. Circular direction
h. All
17. Linked list START=NULL is
a. Underflow
b. Overflow
c. None
18. In a linked list, the pointer of the last node contains the special value called linked.
a. Linked to the first node
b. Null
c. Link
d. Pointer to the tail node
19. Which of the following is linear data structure?
a. Tree
b. Graph
c. Linked List
d. All
20. In which linked list, nodes in form of ring?
a. Singly linked list
b. Doubly linked list
c. Circular linked list
d. All
21. Balancing symbol is a application of .
a. Singly linked list
b. Doubly linked list
c. Circular linked list
d. Linked stack
22. What kind of list is best to answer questions such as "What is the item at position n?"
a. Lists implemented with an array
b. Doubly-linked lists
c. Singly-linked lists.
d. Doubly-linked or singly-linked lists are equally best

You might also like