ds1(1)
-
Upload
ankur-jain -
Category
Documents
-
view
32 -
download
2
Transcript of ds1(1)
Question Ans Option(a) Option(b) Option(c) Option(d)
1 c
2 b Internal External Stable
3 d Queue Stack Heap Dequeue
4 c
5 c
Maximum no of nodes in a binary tree of depth K 2k-1 2k 2k-1 2k+1
If the records to be sorted are in auxiliary storage ,sorting is
None of these
An ordered set of items from which items may be deleted at either end and into which items may be inserted at either end is called
The property of hash function is that
it minmizes the rate of overflow
it preserves the order of key values
it minimizes number of collisions
it minimizes rate of underflow
Binary search tree is a
tree whose right and left subtree has value less than root
Tree whose right and left subtree has value more than root
tree whose left subtree has value less than root and right subtree has value more than root
tree whose left subtree has value greater than root and right subtree has value more than root
6 c
7 d a circular list
8 c
9 c
10 c m*(i-1)+j m*(j-1)+i m*(n-j)+i m*(m-i)+j
Aforest is obtained from a tree when
its children are removed
a subtree is removed
root of the tree is removed
root of the tree is added
In an 16 bit computer,30 digit integer can be stored in
an interger variable
floating point variable
none of these
A stack can be used to
allocate resources by the operating system
to schedule jobs on round-robin basis
process procedure call in a program
none of the above
Which of the following statements are true
binary search is always better than sequential search
binary search is always better than sequential search when no of element is small
binary search is always better than sequential search when no of element is large
binary search very inferior to sequential search
Which of the following expressions accesses the (I,j)th entry of a m*n matrix stored in a column major form?
11 b 2,2,1,2,1 2,2,1,1,2 2,1,2,2,1 2,1,2,2,2
12 c 8 5 10
13 b 3 junk value
14 c
15 c
16 b
The following sequence of operation is performed on a stack
The result of evauating prefix expression */b + d a c d where a=3 ,b=6 c=1 d=5 is
None of these
Write the output of the following program int a[]={1,2,3},*p; p=&a[0];printf("%d",*(p+3));
runtime error
address of third element
A priority queue is a data structure with operation(s) as
Insert an item
Remove the item having the largest (or smallest)key
Both(a) and (b)
Remove the item having the priority key
Two main measures for the efficiency of an algorithm are
Processor and memory
Complexity and capacity
Time and space
Data and space
The time factor when determining the efficiency of algorithm is measured by
Counting microseconds
counting the number of key operations
Counting the number of statements
Counting the kilobytes of algorithm
17 a
18 d Best case Worst case Null case
19 d
20 a
The space factor when determining the efficiency of algorithm is measured by
Counting the maximum memory needed by the algorithm
Counting the minimum memory needed by the algorithm
Counting the average memory needed by the algorithm
Counting the maximum disk space needed by the algorithm
Which of the following case does not exist in complexity theory
Average case
The Worst case occur in linear search algorithm when
Item is somewhere in the middle of the array
Item is not in the array at all
Item is the last element in the array
Item is the last element in the array or is not there at all
The Average case occur in linear search algorithm
When Item is somewhere in the middle of the array
When Item is not in the array at all
When Item is the last element in the array
When Item is the last element in the array or is not there at all
21 a
22 a O(n) O(log n) O(n2) O(n log n)
23 b O(n) O(log n ) O(n2) O(n log n)
24 c O(n) O(log n) . O(n2) O(n log n)
25 d O(n) O(log n) O(n2) O(n log n)
26 c side effect
The complexity of the average case of an algorithm is
Much more complicated to analyze than that of worst case
Much more simpler to analyze than that of worst case
Sometimes more complicated and some other times simpler than that of worst case
None or above
The complexity of linear search algorithm is
The complexity of Binary search algorithm is
The complexity of Bubble sort algorithm is
The complexity of merge sort algorithm is
The indirect change of the values of a variable in one module by another module is called
internal change
inter-module change
side-module update
27 d Arrays . Linked lists
28 c Trees Graphs Arrays
29 d Sorting Merging Inserting Traversal
30 b Traversal Search Sort
31 a
32 b
Which of the following data structure is not linear data structure?
Both of above
None of above
Which of the following data structure is linear data structure?
None of above
The operation of processing each element in the list is known as
Finding the location of the element with a given value is:
None of above
Arrays are best data structures
for relatively permanent collections of data
for the size of the structure and the data in the structure are constantly changing
for both of above situation
for none of above situation
Linked lists are best suited
for relatively permanent collections of data
for the size of the structure and the data in the structure are constantly changing
for both of above situation
for none of above situation
33 c
34 a
35 d
36 a 1014 1012 1001 1002
Each array declaration need not give, implicitly or explicitly, the information about
the name of array
the data type of array
the first data from the set to be stored
the index set of the array
The elements of an array are stored successively in memory cells because
by this way computer can keep track only the address of the first element and the addresses of other elements can be calculated
the architecture of computer memory does not allow arrays to store other than serially
both of above
none of above
The deque and list classes are both optimized for:
insertion at the end of the sequence
insertion at the start of the sequence.
insertion in the middle of a sequence
insertion at either end of a sequence.
How many different trees are possible with 10 nodes
37 b 13 15 8 14
38 b a b both b and c c
39 a 46, 16, 18 45, 15, 18 47, 45, 18
40 c 7, 0, 14 8, 1, 15 8, 0, 8 7, 0, 7
There are 8, 13, 14, 15 different nodes in different binary trees. Which of them coud have formed a full binary tree ?
Of the following tree structure, which is, efficient considering space and time complexities(a) Incomplete Binary Tree(b) Complete Binary Tree (c) Full Binary Tree
Consider the linear arrays aaa(5:50), bbb(-5:10) and
ccc(18), then the number of
elements in each array is
46, 46, undefined
Suppose T contains the text 'THIS FATHER IS THE PROFESSOR', then the INDEX(T, 'THE'), INDEX(T, 'THEN') and INDEX(T, 'THE') have the values
41 a
42 d +/+A^BD-EFG ++/A^BD-EFG
43 a 12.0 14.0 20.0 18.0
44 a P-Quick Sort Pivot Sort
45 a
46 b 6 elements 8 elements 12 elements 20 elements
INSERT(T, K, S) can be simulated as
SUBSTRING(T, 1, K-1)//S//SUBSTRING(T,K,L
SUBSTRING(T, K, K-1)//S//SUBSTRING(T,K,LE
SUBSTRING(T, 1, K+1)//S//SUBSTRING(T,K
SUBSTRING(T, 1, K-1)//S//SUBSTRING(T,K,L
(A+B^D)/(E-F)+G can be written in the post fix notation as
++/A^-BDEFG
None of these
Take A = 7.0, B = 4.0, C = 3.0 and D = 12.0, the values of Reverse Polish Notation expression ABC + /D* is
A variant of quick sort which attempts to choose a pivot likely to represent the middle of the values to be sorted is
Balanced Quick Sort
Optional Quick Sort
A technique for recursively processing the nodes of a tree in which subtrees are processed before root is processed is
Post-Order Traversal
Quick Traversal
Pre-Order Traversal
In-Order Traversal
An array M is declared as Double M[2][4]; Array M has
47 a 3 , 5, 4, 6 3, 4, 6, 5 3, 6, 4, 5 3, 5, 6, 4
48 c O (n) O (n log n) O (n * n) O (log n)
49 b 100 10 11 101
50 d 1000 1014 1001
51 a
If a binary search tree has an inorder traversal if 1, 2, 3, 4, 5, 6 and the root node contains 3 and 5 as the root of its right subtree, the order in which numbers were inserted in this tree is
Prim's algorithm is a method available for finding out the minimum cost of a spanning tree. Its time complexity is given as
The minimum height of a binary tree having 1000 nodes is
The number of trees possible with 10 nodes would be
none of these
The height of a AVL tree with n nodes is at most log2 (N) log2 (2 * N+1) log2 (N+2) N log2 N
52 a
53 The circular List has b 1 NULL link No NULL Link 2 NULL Links
54 a
55 b m-1 m m+1 2m
56 b
57 c
58 c
The linear representation method of implementing a binary tree uses a one-dimensional array of one of the following size where d is the depth of the binary tree: 2d+1 - 1 (1+d)2 -1 2 * log d2 2d+2 - 1
at least 1 NULL Link
Worst case sort of Merge Sort and Insertion sort are:
O (n log n), N * (N-1)/2
N * (N-1)/2, O (n log n)
O (n log n), O (n log n)
O (log n), O (n2)
In a multi-way tree , each node can have more than ? Children.
In Min-Heap, which is true ?
All child have key greater than key of parent
All child have key greater than equal to key of parent
All child have key less than equal to key of parent
All child have key equal to key of parent
what is true regarding the vertex of an Acyclic graph ?
Repeats more than one vertex
Repeats a Vertex thus forming a cycle
Repeats No vertex
Has no vertex
Uniform Hashing technique uses
Open addressing method
Unique Hash method
Closed addressing method
Uniform Address method
59 b
60 c reclamation copying traversal compaction
61 b 2 1 3 4
62 d parallel decreasing same increasing
63 a
If all nodes in a graph are connected to itself with edges of weight w, then the adjacency matrix of the graph is
is a matrix with all 1's
is a diagonal matrix with value w for diagonal elements
is a upper traingular matrix with all non-zero entries being w
is a matrix with all zero elements
Reference count may be maintained for memory locations used in a linked list for the purpose of
In an AVL tree the heights of two sub-trees of every node never differ by more than
Kruksals algorithm for building minimal cost spanning tree of a graph considers edges for inclusion in the tree in the ? Order of the cost
Which is true for an indexed search method ?
An auxiliary table is set aside in addition to the file itself
Index is computed using hashing and stored within the search file itself
The index is maintained in a separate indexed file
The index is stored on separate storage media for fast retrieval
64 a
65 d 2n - 1 nodes
66 c
67 c 4 2 1 3
68 b
69 c Radix Sort Re-Hashing
70 c Matrix Sparse Matrix
An ordered forest is one whose
component trees are ordered
component trees are unordered
O(f) = Sum O(t)
O(f) = Sum O(t+1)
A strict Binary tree with n leaves contains n2 nodes 2n+1 nodes n2 - 1 nodes
For a Row Major array type the address of item[i1][i2] will be
base(item + 1) + (i1 * m1 + i2 ) * esize
base(item) + (i1 + m1 * i2 ) * esize
base(item) + (i1 * m1 + i2 ) * esize
base(item) + (i1 * m1 + i2 ) + esize
A B-Tree of order 24 contains at least ? Keys in a non-root node
Re-Hashing is done to
Re-create a Hash when it has become inefficient over time
Resolve Hash Clash
Re-Order a Hash
None of these
Adjacency Multi-List is used in
Adjacency Matrix
Sparse Matrix
Two Dimensional Array of Arcs is also known as
Adjacency Matrix
None of these
c. Time and space
d. Null case
1. Two main measures for the efficiency of an algorithm are
2. The time factor when determining the efficiency of algorithm is measured by
b. Counting the number of key operations
3. The space factor when determining the efficiency of algorithm is measured by
a. Counting the maximum memory needed by the algorithm
4. Which of the following case does not exist in complexity theory
5. The Worst case occur in linear search algorithm when
a. O(n)
b. O(log n)
d. Item is the last element in the array or is not there at all
6. The Average case occur in linear search algorithm
a. When Item is somewhere in the middle of the array
7. The complexity of the average case of an algorithm is
a. Much more complicated to analyze than that of worst case
8. The complexity of linear search algorithm is
9. The complexity of Binary search algorithm is
10. The complexity of Bubble sort algorithm is
c. O(n2)
d. O(n log n)
c. side effect
d. None of above
c. Arrays
d. Traversal
11. The complexity of merge sort algorithm is
12. The indirect change of the values of a variable in one module by another module is called
13. Which of the following data structure is not linear data structure?
14. Which of the following data structure is linear data structure?
15. The operation of processing each element in the list is known as
16. Finding the location of the element with a given value is:
b. Search
17. Arrays are best data structures
a. for relatively permanent collections of data
18. Linked lists are best suited
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
c. the first data from the set to be stored
20. 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