• No results found

BT0033 DATA STRUCTURE USING C PAPER 2 (BSciIT SEM 1)

N/A
N/A
Protected

Academic year: 2021

Share "BT0033 DATA STRUCTURE USING C PAPER 2 (BSciIT SEM 1)"

Copied!
15
0
0

Loading.... (view fulltext now)

Full text

(1)

BT0033

BT0033

DATA STRUCTURE USING C

DATA STRUCTURE USING C

[1 mark each]

[1 mark each]

1)

1) Most aMost appropriappropriate data te data structstructure in ure in C to C to represrepresent linkent linked list ed list isis

a) a) arrayarray  b)  b) structstruct cc)) uunniioonn d)

d) nonone ne of of ththe ae aboboveve 2)

2) LinLink of k of linklinked lied list ist in C in C is of s of typetype a)

a) ununsisigngned ed inintetegeger r 

b)

b) Pointer to integer Pointer to integer  c)

c) Pointer to structPointer to struct

d)

d) NoNone ne of of ththe ae aboboveve 3)

3) In liIn linked lnked listist, a nod, a node conte contains ains at leat leastast a)

a) NodNode adde addreress fiss fieleld, dad, data fta filileded  b)

 b) Node numNode number, datber, data fielda field c)

c) NexNext addt addresress fies field, ild, infornformatmation fion fielieldd d)

d) NoNone ne of of tthehesese 4)

4) In liIn linked lnked listist, the lo, the logicgical ordal order of eer of elemlementsents a)

a) Is sIs same ame as tas their heir physphysicaical arl arrangrangemeementnt  b)

 b) Is not necessarily equivalent to their physical arrangementIs not necessarily equivalent to their physical arrangement

c)

c) Is deIs deterterminemined by thed by their physir physical aical arrarrangengementment d)

d) NoNone ne of of ththe ae aboboveve.. 5)

5) Direct Direct or raor random andom access ccess of eof element lement is not is not possiblpossible in-e in-a)

a) Linked listLinked list

 b)

 b) ArrayArray cc)) SSttrriinngg d)

d) NoNone ne of of ththe ae aboboveve 6)

6) In liIn linked lnked listist, the su, the succesccessive esive elemlements

ents--a)

a) Must occupy contiguous space in memoryMust occupy contiguous space in memory  b)

 b) Need not occupy contiguous space in memoryNeed not occupy contiguous space in memory

c)

c) MusMust not ot not occupccupy conty contiguiguous sous space ipace in memn memoryory d)

d) NoNone ne of of ththe ae aboboveve 7)

7) NUNULL poLL pointinter ier is uss used ted to teo tellll a)

a) End of linked listEnd of linked list

 b)

 b) Empty poEmpty pointer finter field of a ield of a structstructureure c)

c) The The lilinkenked ld lisist it is es emptmptyy d)

(2)

8) Underflow condition in linked list may occur when attempting to a) Insert a new node when there is no free space for it

b) Delete a non-existent node in the list c) Delete a node in empty list

d) None of the above

9) Overflow condition in linked list may occur when attempting to a) Create a node when free space pool is empty

 b) Traverse the nodes when free space pool is empty c) Create a node when linked list is empty

d) None of the above

10) Header of a linked list is a special node at the a) End of linked

b) At the middle of the list c) Beginning of the list

d) None of the above

11) Header linked list in which last node points the header node is called

a) Grounded header   b) Circular header list

c) General header  d) None of the above

12) A technique, which collects all deleted space onto free storage list, is

called-a) Static memory

 b) Garbage collection allocation

c) Dynamic allocation d) None of the above

13) Which of the following process is faster for threaded trees compared with their  unthreaded counterparts?

a) Insertion

b) Deletion c) Traversal

d) None of these

14) Which of the following statements is TRUE in view of a threaded binary tree? It can have

a) NULL links but no structural links  b) Only structural links but no NULL links

c) Structural links and NULL links

d) None of these

(3)

a) Traversal of the left sub tree in post order.

b) Processing of the root node

c) Traversal of the left sub tree in in-order

d) None of the above

16) A B-tree of order n is also called a) (n-n)-1 tree

 b) n-(n-2) tree c) (n-1)-n tree

d) None of these

17) The preorder traversal of a binary tree begins with-a) Processing of the root node

 b) Traversal of the right sub tree in preorder  c) Traversal of the left sub tree in preorder  d) None of the above

18) If a binary search technique is used for accessing and implementing a symbol table, which of the following statements is TRUE? The ratio

of-a) Insertion time to access time for its entries is quite high

 b) Access time to insertion time is quite high c) Search time to insertion time is very high d) None of the above

19) The post order traversal of a binary tree begins a) The post order traversal of the left sub tree

 b) Processing of the root node

c) The post order traversal of the right sub tree d) None of the above

20) Which of the following figures is not possible as a balance of any node of an AV tree? a) 1

 b) –1

c) 0

d) None of the above

21)The in-order traversal of some binary tree produced the sequence DBEAFC, and the  post order traversal of the same tree produced the sequence DEBFCA. What will be the

total number of nodes on the left sub tree of the given tree?

a) 1

b) 4

c) 5

d) None of these

22) Name the sort for which time is not proportional to n2

(4)

b) Bubble sort

c) Quick sort d)  None of these

23)This sort does not use divide & conquer methodology

a) Merge sort

b) Bubble sort c) Quick sort d) None of these

24) Name the sort in which array to be sorted is partitioned again & again in such a way that all elements less than or equal to partition element appear before it and those which are greater appear after it.

a) Merge sort

b) Quick sort

c) Selection sort

d)  None of these

25)Worst case efficiency of this search is n.

a) Sequential search b) Binary search

c) Indexed search

d)  None of these

26) Which is not a hashing technique? a) Division remainder method  b) Folding

c) Mid square

d) All are hashing technique

27) Extra space in each record is kept for this collision processing method

a) Linear collision processing

b) Linked collision processing

c) Quadratic collision processing d) None of these

28) This method of collision processing requires prime area and overflow area. a) Linked collision processing

 b) Quadratic collision processing c) Linear collision processing d) None of these

29) In this method of collision processing some of the addresses may remain unchecked.

a) Linear collision processing  b) Quadratic collision processing

(5)

d) None of these

30) In this search keys must be ordered a) Sequential search

b) Hashing

c) Binary search

d) None of these

31) This searching method requires that all keys must reside in internal memory. a) Binary search

 b) Sequential search c) Hashing

d) None of these

32) A vertex with degree one in a graph is

called-a) Leaf 

 b) Pendant vertex

c) End vertex d) None of these

33) Which one is not a representation of a graph? (1) Adjacency matrix

 b) Edge listing c) Adjacency list

d) All represent graphs

34) In an adjacency matrix parallel edges are given by-a) Similar columns

 b) Similar rows

c) Similar rows & similar columns d) None of the above

35) Breadth first search – 

a) Scans all incident edges before moving to other vertex

 b) Scans adjacent unvisited vertex as soon as possible c) Is same as backtracking

d) None of these

36) Name the sort for which time is not proportional to n2

a) Selection sort

b) Bubble sort c) Quick sort

d) None of these

37) In which case adjacency list representation of graph is not useful a) When no of edges is small

(6)

 b) When no of vertices are changing due to insertion and deletion c) In breadth first traversal

d) It is useful in all above cases

38) Which method of traversal does not use stack to hold nodes a) Breadth first

 b) Depth first c) D-search d) None of these

39) Back tracking is another name for this method of traversal a) Depth first

 b) Breadth first c) D-search d) None of these

40) The preorder traversal of a binary tree begins

with-a) Processing of the root node

 b) Traversal of the right sub tree in preorder  c) traversal of the left sub tree in preorder  d) None of the above

[2 marks each]

41) Select the aspects of problem solving of an application Formulation of algorithms

Selection of an appropriate mathematical model Design of storage structures for the Data structures

a) 1 and 3  b) 2 and 3 c) 1 and 2

d) 2, 1 and 3

42) Consider the function given below. Choose the line number which has error function CHANGE (S, TOP, X,1)

If TOP -1+i<=0

Then write (‘stack UNDERFLOW’) Return S[TOP -1 +i] Return a) 1 and 3 b) 1 and 4 c) only 4 d) No Error 

(7)

43) Select the true statements regarding simulation from a real situation It is the process of forming an abstract model from a real situation It permits experimentation by modifying real situation

Large detailed simulation can be executed in computer with reasonable cost a) 1 and 3

 b) 2 and 3

c) only 1

d) None of these

44) Consider the expression A/B * C * D + E the post order of this given by a) + */* ABCDE, ABCDE/** +

 b) + **/ ABCDE, ABC/D * E * + c) +**/ EDCBA, AB/C * D * E +

d) +**/ABCDE, AB/C * D *E +

45) Choose the properties of non-empty Binary search tree

Every element has a key, and no two element have the same key, that is the key is unique

The keys in a non-empty left sub-tree must be larger than the key in the root of the sub tree

The left and right sub-trees are also binary search tree a) 1 and 2

 b) 2 and 3

c) 1 and 3

d) 1, 2 and 3

46) Select the true statements with respect to magnetic disks They provide low access time and high speed data transfer 

The outermost surfaces of the top and bottom platters are not used for storing data Information is transferred to or from a disk through read/write heads

a) 1 and 2  b) 2 and 3 c) 1 and 3

d) 1,2 and 3

47) Suppose we want to store a file with 50000 fixed length data records on a typical 2.1-giga- byte disk with the following characteristics:

 Number of bytes/sector = 512  Number of sectors /track = 63  Number of tracks/ cylinder = 16  Number of cylinders = 4092

How many cylinders does the file require if each data record requires 256 bytes? a) 12.4

(8)

b) 24.8

c) 28.4 d) 12.8

48) Select true statements regarding hashing:

It is a technique used for performing insertions, deletions and finding constant average time

Hash table is the central data structure a) 1 and 2

 b) 1 and 3

c) 2 and 3

d) 1, 2 and 3 49) Match the following

SetA Set B

(i) Hash function 1. Hi (key) =(hash(key +12))

(ii) Separate chaining 2. Primary clustering occurs in this case

(iii)I linear probing 3. It avoids pointers usage to chain elements together  (iv) quadratic Probing 4. Each key is mapped into some bucket number ranging (v) Open addressing list 5. All elements that hash into same value are placed in a

a) (i) -4 (ii) -2 (iii) -3 (iv) -1 (v) -1  b) (i) -2 (ii) -3 (iii) -1 (iv) -4 (v) -4

c) (i) -4 (ii) -5 (iii) -2 (iv) -1 (v) -3

d) (i) -4 (ii) -5 (iii) -2 (iv) -3 (v) -1 50) Select the true statements

Insertion and deletion of elements to and from a data structure in pointers is time consuming

Fixed longer bit sequences can be handled more efficiently than variable fength bit sequence

Pointers provides a homogeneous method of referencing any data structures ‘ Selection ‘ operation changes the data in the structure

Using functions one or more values can be returned to the main routine a) (i) (iii) true

 b) (ii) (iv) (v) true c) (i) (iv) (v) true

d) (ii) (iii) true

51) The two sub arrays obtained by applying quick sort aigorithm on the array 26 5 37 1 61 59 15 48 19 as first step is

(9)

 b) [5 19 15 1 26 ] 11 [59 61 48 37]

c) [11 5 19 1 15] 26 [59 61 48 37]

d) [5 19 1 15 26] 11 [59 61 48 37]

52) Select the true statements

Magnetic Disk is preferred for high-speed, large volume batch processing applications A drum is referred to as a direct-access storage device

In magnetic disk the outmost surfaces of the top and bottom platters are used for data storing

Magnetic tab is a plastic ribbon coated on one side with an iron oxide material Magnetic disk provides high access time

a) (iii) and (iv) are true

b) (ii) and (iv) are true

c) (i), (ii) and (iv) are true d) (ii), (iii) and (v) are true

53) Arrange the following statement to make it a correct algorithm for pop operation of  stack data structure.

A) decrement top

B) check for stack underflow. If underflows repot it and exit otherwise proceed C) return the element

a) A, B,C b) B, C, A c) B, A, C d) None 54) Let productions be P1 = ‘ab’→ ‘b’ P2 = ‘ac’→ ‘c’ P3 = ‘aa’→ ‘a’ P4 = ‘bb’→ ‘b’

On the alphabet v = {a, b, c} f input string is (i) bcaabaabcabaa

(ii) baacaabacaa

The output of MARKOV algorithm is

a) (i) bcbcba (ii) bcbca

 b) (i) bcba (ii) bca c) (i) bcbac (ii) bcca d) (i) bcbca (ii) bcbcba

(10)

a Float, link    b Integer, link 

c Information, link 

d None

d) What all operations are related with stack  A) Push B) Pop C) Change D) Peep E) Pipe e) All operations f) Last three operation g) First three operations

h) First four operations

57) What is main advantage of Circular queue over simple queue a) Efficient

b) Efficient use of memory saving

c) Work slow but good to listen d) None of the above

58) Which of the following is true for linear search?

a) N comparison to find D in the worst case, N/2 comparison on the average case and one comparison in best case

 b) N/2 Comparison to find d in the worst case, N Comparison on the average case and one comparison in best case

c) 1 comparison to find D in the worst case, N/2 Comparison on the average case and N comparison in best case

d) 1 comparison to find D in the worst case, N comparison on the average case and  N/2 comparison in best case

59) 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 r singly-linked lists are equally best

60) What is the worst-case time & average time for quick sort to sort an array of n elements?

(11)

 b) O(n), o(n log n) c) O(n log n), o(n2)

d) o(n2), o(n log n)

[4 marks each]

61) Suppose you have a directed graph represented all the flights that an airline fillies. What algorithm might be used to find the best sequence of connections from one city to another?

a) Breadth first search  b) Depth first search

c) A cycle-finding algorithm

d) A shortest-path algorithm

62) For markov algorithm Input string: abcdcdipcd Production P1 : cdc --> a What will be output?

a) Abadipcd

 b) Abadlpa c) Abadlpd d) None

63) What is different between Circular linked list & simple linked list?

a) Circular linked. List consist of only one node and link part store address of first node

 b) Circular linked list consist of many node but all node are circular in nature

c) Circular linked list is simple linked list but last mode link points to first nide.

 None

64) Identify true and false statement

Magnetic tapes have higher transfer rate than cards or paper tapes

Magnetic tapes are available on reels is 21/2” to 3” wide and 2400 ft. long. Magnetic tapes cannot be erased and refused.

a) True, false, false

 b) True, true, false c) False, false, true d) True, false, true

65) An IBM indexed sequential file consists of three separate areas – The _______ area, the  __________ area, and the __________ area.

(12)

a) Prime, index, overflow

 b) Secondary memory, index, underflow c) Secondary memory, index, overflow d) None

66) Fill in the blanks to complete bubble sort algorithm for ( i= 1:i< = n; i++)

{ for (j = n; j>=i; j—) { if (a [j – 1] > A [j] ) /* ...do*/ } } /* do*/ means

a) swap a[i] and a[j+1]

b) swap a[j-1] and a[j]

c) swap a[n-1] and a[n] d) swap a[j] and a[j+1]

67) Identify the following algorithm.

Tree_pointer ABC (int Element, Tree_pointer T) {

If (T = NULL) {

T = malloc (sizeof (struct node)); T data = element;

T left_child = T Right_child = NULL; }

else

If (Element <T data)

T left_child = ABC (Element, T left_child); Else

If (element> T data)

T right_child = ABC (Element, T right_child); Return T;}

e) BST insertion

f) BST Deletion g) BFS Insertion h) BFS Deletion

68) Arrange the following statement to make it a correct algorithm for insert operation of  queue data structure

(13)

 b. Insert element

c. Increment rear pointer  d. Check front pointer.

e. If it is zero then assign a value equal to one:

a, c, b, d, e

a, b, c, d, e d, b, a, c, e d, a, c, b, e

69) Select true statements regarding pointers 1. A pointer is a reference to a data structure

2. Pointer provides a homogeneous method of referencing any data structure to developing upon the structure’s types

3. It permits faster insertion and deletion of element to end from a data structure

4. Pointer addressing method is less time consuming than the computed address method 5. The pointer value provides a reference to the data structure of interest

i) 1, 3 and 5

 j) 4 and 5 k) 1, 2, 3 and 4 l) 1, 3, 4 and 5

70) Select true statements regarding grammar 

1. A grammar is a specification that takes into account syntactic properties of a language

2. A grammar consists of finite set of replacement rules or productions 3. Grammar can be defined as G= (VT, Vs, S, P)

4. All strings composed of terminal symbols form sentences a 1 and 4

 b 2 and 3

c 1, 2 and 4

d All of above

71) Select the true statement regarding circular linked linear list 1. Deletion operation is very difficult & not much efficient. 2 Concatenation is more efficient.

3. It is possible to get into an infinite loop 4. Every node is accessible from a given node 5. Splitting is complex, non efficient process

(14)

n) 1, 2 & 5

o) 2, 3 & 4

 p) All of above

72) Choose the facts about index.

1. Except to use many fewer blocks for index than for data file 2. Index sorted, use linear search on index.

3. Especially useful when index can fit in memory. 4. If n index blocks, only log2 n disk I/Os

5. Indexes are additional auxiliary access structure, which provide faster access to data. q) 1, 2 and 4

r) 1, 3, 4 and 5 s) 1, 2, and 5

t) All of above

73) Select the true statements regarding magnetic tapes

1. It provides a compact and an inexpensive method of storing data and programs 2.It is preferred for low speed, large volume batch processing applications

3. 3 types magnetic tapes are used.

4. Magnetic tapes are randomly accessed

5.It is divided into either 7 or 9 parallel horizontal rows and vertical columns

u) 1, 5

v) 2, 3

w) 1, 2, 4 and 5 x) All of above

74) Consider the algorithm for stack push. Fill the gaps with appropriate value. Void stack push(stack_t stack, data * data)

{

node_t *new_node, if (___________) {

new node = (node_t*) malloc (size of 9 node_t); (size of (node_t);

new_node data = ________________  new_node next = stack_top;

stack stack_top =_______________  }

}

(15)

z) stack !=0, data, new_node

aa) stack =0, stack--> new_node  bb) stack !=0, data, new-->node

75) Given the tree, what is the resultant tree after 4 is deleted from the tree 6 2 8 1 4 3 a. 6 b. 6 2 8 4 2 8 1 3 1 3 c. 6 d. 6 2 8 2 8 1 3 1 3

References

Related documents

The unintended consequences were caused by the initial condi-tions, the nature of the EHR system and the way the system was implemented and used bynursing staff

In addition, the brain exhibits robust spontaneous activity with spatiotemporal organization that defines the brain’s functional architecture (termed functional

tivity-based routing. The reason that PROPHET_S performs worse than connectivity-based routing is that it only compares d-connectivity values of two encountering nodes for

The beetles found at the Lebanese, Spanish, French and Myanmar amber sites had not participated in the resin production that resulted in early and mid-Cretaceous ambers..

Mixing business experience of about 40 years (more than 25 in senior management positions in multinational companies), with teaching experience of over 20 years

Greater casimir force than this is binary tree zigzag order traversal happens in previous level and uses cookies, odd levels in this is the level.. Back to reach the tree zigzag