Professional Documents
Culture Documents
Hafiz Syed Muhammad Hur
Hafiz Syed Muhammad Hur
Algorithm
a. O(n)
b. O(log n)
c. O(n2)
d. O(n log n)
b. for the size of the structure and the data in the structure are constantly changing
4. If the values of a variable in one module is indirectly changed by another module, this
situation is called
a. internal change
b. inter-module change
c. side effect
d. side-module update
d. The item is the last element in the array or is not there at all
c. Sometimes more complicated and some other times simpler than that of worst case
d. None or above
a. O(n)
b. O(log n)
c. O(n2)
d. O(n log n)
b. O(log n)
c. O(n2)
d. O(n log n)
a. Counting microseconds
a. Trees
b. Graphs
c. Arrays
d. None of above
11. The elements of an array are stored successively in memory cells because
a. by this way computer can keep track only the address of the first element and the addresses
of other elements can be calculated
b. the architecture of computer memory does not allow arrays to store other than serially
c. both of above
d. none of above
12. Which of the following data structure is not linear data structure?
a. Arrays
b. Linked lists
c. Both of above
d. None of above
d. When Item is the last element in the array or is not there at all
15. Finding the location of the element with a given value is:
a. Traversal
b. Search
c. Sort
d. None of above
16. Which of the following case does not exist in complexity theory
a. Best case
b. Worst case
c. Average case
d. Null case
a. Sorting
b. Merging
c. Inserting
d. Traversal
b. for the size of the structure and the data in the structure are constantly changing
19. Each array declaration need not give, implicitly or explicitly, the information about
a. O(n)
b. O(log )
c. O(n2)
d. O(n log n)
11 – A 12 – D 13 – A 14 – C 15 – B 16 – D 17 – D 18 – A 19 – C 20 – B
1. Each data item in a record may be a group item composed of sub-items; those items which are
indecomposable are called
a. elementary items
b. atoms
c. scalars
d. all of above
b. data elements in linked list need not be stored in adjacent space in memory
d. linked lists are collection of the nodes that contain information part and next pointer
4. When inorder traversing a tree resulted E A C K F H D B G; the preorder traversal would return
a. FAEKCDBHG
b. FAEKCDHGB
c. EAFKHDCBG
d. FEAKDCHBG
a. floor address
b. foundation address
c. first address
d. base address
a. An array is suitable for homogeneous data but the data items in a record may have different
data type
d. All of above
a. FIFO lists
b. LIFO list
c. Piles
d. Push-down lists
a. linear arrays
b. linked lists
c. both of above
d. none of above
a. array
b. lists
c. stacks
d. all of above
10. The memory address of fifth element of an array can be calculated by the formula
d. None of above
a. tables arrays
b. matrix arrays
c. both of above
d. none of above
12. When new data are to be inserted into a data structure, but there is no available space; this
situation is usually called
a. underflow
b. overflow
c. housefull
d. saturated
a. underflow
b. overflow
c. housefull
d. saturated
15. Which of the following data structure can’t store the non-homogeneous data elements?
a. Arrays
b. Records
c. Pointers
d. None
16. Which of the following data structure store the homogeneous data elements?
a. Arrays
b. Records
c. Pointers
d. None
b. requirement of sorted array is expensive when a lot of insertion and deletions are needed
d. pointer array
19. A data structure where elements can be added or removed at either end but not in the
middle
a. Linked lists
b. Stacks
c. Queues
d. Deque
20. Which of the following is not the required condition for binary search algorithm?
a. The list must be sorted
b. there should be the direct access to the middle element in any sublist
d. none of above
1- d 2- d 3- c 4- b 5- b 6- d 7- a 8- a 9- c 10- a
11- c 12- b 13- a 14- a 15- a 16- a 17- d 18- a 19- d 20- c
short questions
Q No ::01
answer:
Start
show=a+b
a=b
b=show
End
Q NO ::02
INSERTION SORT
The data is sorted by inserting the data into an existing sorted file.
SELECTION SORT
The data is sorted by selecting and placing the consecutive elements in sorted location.
The best case run time complexity of selection sort is O(n^2).
Q NO ::03
The major difference between Array and Linked list regards to their structure. Arrays are index
based data structure where each element associated with an index. On the other hand, Linked
list relies on references where each node consists of the data and the references to the previous
and next element.
Accessing the element in Array Direct or randomly accessed, i.e., Specify the array index or
subscript. example Binary search and linear search
Types of linked lists are Singly-linked list, Doubly linked list, Circular linked list, Circular double
linked list.
Accessing the element in linked list Sequentially accessed, i.e., Traverse starting from the first
node in the list by the pointer.example linear search
Q no:: 04
Algorithm--Examples
• Repairing a lamp • A cooking recipe • Calling a friend on the phone • The rules of how to play a
game • Directions for driving from A to B • A car repair manual
Q NO::05
what is the complexity of best, average and worst case with example or graph?
The worst-case complexity of the algorithm is the function defined by the maximum number of
steps taken on any instance of size n. It represents the curve passing through the highest point of
each column.
The best-case complexity of the algorithm is the function defined by the minimum number of
steps taken on any instance of size n. It represents the curve passing through the lowest point of
each column.
Finally, the average-case complexity of the algorithm is the function defined by the average
number of steps taken on any instance of size n.