Docstoc

BT0033 DATA STRUCTURE USING C

Document Sample
BT0033 DATA STRUCTURE USING C Powered By Docstoc
					                      PC TRAINING INSTITUTE LIMITED



                                         BT0033
                          DATA STRUCTURE USING C
                                [1 mark each]
1) Most appropriate data structure in C to represent linked list is
     a) array
     b) struct
     c) union
     d) none of the above

2) Link of linked list in C is of type
      a) unsigned integer
      b) Pointer to integer
      c) Pointer to struct
      d) None of the above

3) In linked list, a node contains at least
        a) Node address field, data filed
        b) Node number, data field
        c) Next address field, information field
        d) None of these

4) In linked list, the logical order of elements
        a) Is same as their physical arrangement
        b) Is not necessarily equivalent to their physical arrangement
        c) Is determined by their physical arrangement
        d) None of the above.

5) Direct or random access of element is not possible in-
      a) Linked list
      b) Array
      c) String
      d) None of the above

6) In linked list, the successive elements-
        a) Must occupy contiguous space in memory
        b) Need not occupy contiguous space in memory
        c) Must not occupy contiguous space in memory
        d) None of the above

7) NULL pointer is used to tell
     a) End of linked list
     b) Empty pointer field of a structure
     c) The linked list is empty
     d) All of the above


                PC Training Institute Ltd., An ISO-9001 Certified Organisation   1
                       PC TRAINING INSTITUTE LIMITED


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

15) Which of the following steps is performed first for in order traversal of a binary tree?



                           We touch the future ☺ we teach !                                2
                       PC TRAINING INSTITUTE LIMITED

       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



               PC Training Institute Ltd., An ISO-9001 Certified Organisation             3
                      PC TRAINING INSTITUTE LIMITED

       a)   Merge sort
       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



                            We touch the future ☺ we teach !                               4
                      PC TRAINING INSTITUTE LIMITED

       c) Linked collision processing
       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



              PC Training Institute Ltd., An ISO-9001 Certified Organisation       5
                         PC TRAINING INSTITUTE LIMITED

       a)   When no of edges is small
       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


                           We touch the future ☺ we teach !                              6
                         PC TRAINING INSTITUTE LIMITED


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?




                PC Training Institute Ltd., An ISO-9001 Certified Organisation             7
                         PC TRAINING INSTITUTE LIMITED

       a)   12.4
       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
         Set A                           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




                             We touch the future ☺ we teach !                                8
                        PC TRAINING INSTITUTE LIMITED

       a)   [11 5 15 1] 59 [26 61 48 37]
       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




                 PC Training Institute Ltd., An ISO-9001 Certified Organisation           9
                      PC TRAINING INSTITUTE LIMITED

55) Node is consist of _________ and __________.

       a    Float, link
       b    Integer, link
       c    Information, link
       d    None

56) 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?



                          We touch the future ☺ we teach !                               10
                       PC TRAINING INSTITUTE LIMITED


       a)   O(log n), o(log n)
       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




                PC Training Institute Ltd., An ISO-9001 Certified Organisation            11
                      PC TRAINING INSTITUTE LIMITED

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

         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;}

       a)      BST insertion
       b)      BST Deletion
       c)      BFS Insertion
       d)      BFS Deletion

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



                          We touch the future ☺ we teach !                              12
                       PC TRAINING INSTITUTE LIMITED


   a. Check for overflow, if overflows then report it and exit otherwise proceed.
   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

       a)   1, 3 and 5
       b)   4 and 5
       c)   1, 2, 3 and 4
       d)   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



                PC Training Institute Ltd., An ISO-9001 Certified Organisation           13
                       PC TRAINING INSTITUTE LIMITED

5. Splitting is complex, non efficient process

       a)   1, 3 & 5
       b)   1, 2 & 5
       c)   2, 3 & 4
       d)   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.

       a)   1, 2 and 4
       b)   1, 3, 4 and 5
       c)   1, 2, and 5
       d)   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

       a)   1, 5
       b)   2, 3
       c)   1, 2, 4 and 5
       d)   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 =_______________




                            We touch the future ☺ we teach !                                 14
                        PC TRAINING INSTITUTE LIMITED

}
}
       a)       stack =0, stack--> data, new-->node
       b)       stack !=0, data, new_node
       c)       stack =0, stack--> new_node
       d)       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




                PC Training Institute Ltd., An ISO-9001 Certified Organisation    15

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:51
posted:4/4/2011
language:English
pages:15