Sei sulla pagina 1di 16

BC0038

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 ina) Linked list b) Array c) String d) None of the above 6) In linked list, the successive elementsa) 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

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 calleda) 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? 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 witha) 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 ofa) 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 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 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 calleda) 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 bya) 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 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 witha) 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) b) c) d) 1 and 3 2 and 3 1 and 2 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) b) c) d) 1 and 3 1 and 4 only 4 No Error

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

47) Suppose we want to store a file with 50000 fixed length data records on a typical 2.1giga- 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

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) b) c) d) 1 and 2 1 and 3 2 and 3 1, 2 and 3 Set B 1. Hi (key) =(hash(key +12)) 2. Primary clustering occurs in this case 3. It avoids pointers usage to chain elements together 4. Each key is mapped into some bucket number ranging 5. All elements that hash into same value are placed in a (iii) -3 (iii) -1 (iii) -2 (iii) -2 (iv) -1 (iv) -4 (iv) -1 (iv) -3 (v) -1 (v) -4 (v) -3 (v) -1

49) Match the following Set A (i) Hash function (ii) Separate chaining (iii)I linear probing (iv) quadratic Probing (v) Open addressing list a) b) c) d) (i) -4 (i) -2 (i) -4 (i) -4

(ii) -2 (ii) -3 (ii) -5 (ii) -5

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) b) c) d) (i) (iii) true (ii) (iv) (v) true (i) (iv) (v) true (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 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) b) c) d) (iii) and (iv) are true (ii) and (iv) are true (i), (ii) and (iv) are true (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) b) c) d) A, B,C B, C, A B, A, C 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) b) c) d) (i) bcbcba (i) bcba (i) bcbac (i) bcbca (ii) bcbca (ii) bca (ii) bcca (ii) bcbcba

55) Node is consist of _________ and __________.

a b c d

Float, link Integer, link Information, link None

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

57) What is main advantage of Circular queue over simple queue a) b) c) d) Efficient Efficient use of memory saving Work slow but good to listen 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) b) c) d) Lists implemented with an array. Doubly-linked lists. Singly-linked lists. 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? 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) b) c) d) Breadth first search Depth first search A cycle-finding algorithm A shortest-path algorithm

62) For markov algorithm Input string: abcdcdipcd Production P1 : cdc --> a What will be output? a) b) c) d) Abadipcd Abadlpa Abadlpd 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) b) c) d) True, false, false True, true, false False, false, true True, false, true

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

__________ area, and the __________ area. a) b) c) d) Prime, index, overflow Secondary memory, index, underflow Secondary memory, index, overflow None

66) A _________ is a co centric ring around the platter containing information sector are basically slices of the track a) b) c) d) Sectors, cylinder Cylinder, sectors Tracks, sectors None

67) Identify true and false statement for Read(Source_addr, size) functions. Source_file = location the program reads from, i.e., its logical file name Destination_addr = first address of the memory block where we want to store the Data Size = how much information be being brought in from the file (byte count). a) b) c) d) All true Only first true Second and third are true None of them are true

68) Identify true and false statement sbout Unix directory Structure A) Any file can be uniquely identified by giving it its absolute pathname. B) The user directory you are in is called as root directory. C) . Stands for the current directory and . Stands for the parent directory. a) b) c) d) True, false, true False, true, false True, true, false False, false, false

69) A ___________ is one endpoint of a two way communication link between two programs running on the network. A socket is bund to a _______ number so that the __________ layer can identify the application that data is destined to be sent. a) b) c) d) Socket, port, TCP TCP, Socket, port TCP, port, Socket TCP, port, Socket

70) Fill in the blanks to create a node for doubly linked list struct node { . A) ----------------B) -----------------C) ____________ } . information part, b- link to next node c- link to previous node Link to next node, c- link to previous node, b- Link to addition node link to previous, b- information part, c- link to next node a) Both a & c

71) Identify the correct PEEP and CHANGE Functions A). i) PEEP(S, TOP, I) B) i) PEEP(S, TOP, I) If TOP + I < =0 1. If TOP I + 1 <=0 Then write(Stack Underflow)exit Then write(Stack Underflow)exit 2) Return(S(Top + 1)) 2. Return (S[TOP-I +1]) ii) Change(S, TOP, , 1) ii) Change(S, TOP, , I) 1. If TOP -1 +1<=0 then write(stack Underflow)retur then write(stack Underflow) return 2. S [ TOP -1 +1 ] 2. S[Top -1 +1]! C) i) PEEP(S, TOP, I) If TOP + I < =0 Then write(Stack Underflow)exit 2) Return(S(Top + 1)) ii) Change(S, TOP, , 1) 1. If TOP +1 +1<=0 then write(stack Underflow) return 2. S [ TOP -1 +1 ] 3. Return D) ) i) PEEP(S, TOP, I) If TOP + I < =0 Then write(Stack Underflow)exit 2) Return(S(Top + 1)) ii) Change(S, TOP, , 1)

1. If TOP +1 +1<=0 then write(stack Underflow) return 2. S [ TOP -1 +1 ] 3. Return Consider the empty binary search tree for which 6 numbers inserted. The numbers are 40, 60, 50, 33, 55, 11, then 4th and 6th stage is give as 40 A) 33 60 50 11 55 40 B) 30 50 50 40 C) 33 60 50 D) none of these a) 72) Choose the correct codes for read, write open and close file (i)char C; File *infile; Infile = fopen(myfile, r++); Fread(c, 1 , 1, infile); (ii) Outfile.open(mynew.txt,ios:out); outfile<<C; (iii) Outfile =fopen(myfile.txt , w); (iv) fclose(outfile); (i) infile.open(mfile.txt , ios:out); Infile>> C; (ii) Outfile.open(mynew.txt,ios:out); 11 33 50 55 60 11 30 50 40 40 55 60 33 40 60 50

fwrite(&c, I, 1, outfile) (iii) Outfile = fopen(myfile.txt , ios::in); (iv) Outfile.close( ) ; (i) infile.open(mfile.txt , ios:out); Infile>> C; (ii) Outfile.open(mynew.txt,ios:out); fwrite(&c, I, 1, outfile) (iii) Outfile = fopen(myfile.txt , ios::in); (iv) Outfile.close( ) ; (i) char C; FILE * infile; Infile = fopen(myfile, r++); Fread(c, 1, 1, infile); (ii) Outfile.open(mynew.txt,ios:out); Outfile<<c; (iii) Outfile = open(myfile.txt , ios::in) (iv) fclose(outfile ); 73) Match following Set A (i) Magnetic Tape (ii) Clusters (iii) Sector (iv) Extent (v) Internal fragmentation a) b) c) d) (i) -3 (i) -2 (i) -5 (i) -4 (ii) -5 (ii) -5 (ii) -1 (ii) -3 14 2 1 3 10 7 40 11 30 (iii) -1 (iii) -4 (iii) -2 (iii) -5

Set B 1. File consisting of contiguous clusters 2. The loss of space within a sector 3. Fixed number of contiguous sectors 4. Preferred for high speed, large volume batch Processing 5. Fixed size segment of track (iv)-4 (iv) -3 (iv) -2 (iv) -1 (v) -1 (v) -1 (v) -4 (v) -2

74) There is a tree in the box. What is the order or nodes visited using a pre-order or nodes visited using a pre-order traversal? a) b) c) d) 1, 2, 3, 7, 10, 11, 14, 30, 40 1, 2, 3, 14, 7, 10, 11, 40, 30 1, 3, 2, 7, 10, 40, 30, 11, 14 14, 2, 1, 3, 11, 10, 7, 30, 40

75) There is a tree in the box. What is the order of nodes visited using a post-order traversal? a) b) c) d) 1, 2, 3, 7, 10, 11, 14, 30, 40 1, 2, 3, 14, 7, 10, 11, 40, 30 1, 3, 2, 7, 10, 40, 30, 11, 14 14, 2, 1, 3, 11, 10, 7, 30, 40

Potrebbero piacerti anche