data structure

25
Set - 2 1. The memory address of the first element of an array is called a. floor address b. foundation address c. first address d. base address 2. The memory address of fifth element of an array can be calculated by the formula a. LOC(Array[5]=Base(Array)+w(5-lower bound), where w is the number of words per memory cell for the array b. LOC(Array[5])=Base(Array[5])+(5-lower bound), where w is the number of words per memory cell for the array c. LOC(Array[5])=Base(Array[4])+(5-Upper bound), where w is the number of words per memory cell for the array d. None of above 3. Which of the following data structures are indexed structures? a. linear arrays b. linked lists c. both of above d. none of above 4. 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 c. There must be mechanism to delete and/or insert elements in list d. none of above 5. Which of the following is not a limitation of binary search algorithm? a. must use a sorted array b. requirement of sorted array is expensive when a lot of insertion and

Upload: rajinder-singh

Post on 01-Sep-2014

165 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Data Structure

Set - 2

1. The memory address of the first element of an array is called

a. floor addressb. foundation addressc. first addressd. base address

2. The memory address of fifth element of an array can be calculated by the formula

a. LOC(Array[5]=Base(Array)+w(5-lower bound), where w is the number of words per memory cell for the arrayb. LOC(Array[5])=Base(Array[5])+(5-lower bound), where w is the number of words per memory cell for the arrayc. LOC(Array[5])=Base(Array[4])+(5-Upper bound), where w is the number of words per memory cell for the arrayd. None of above

3. Which of the following data structures are indexed structures?

a. linear arraysb. linked listsc. both of aboved. none of above

4. Which of the following is not the required condition for binary search algorithm?

a. The list must be sortedb. there should be the direct access to the middle element in any sublistc. There must be mechanism to delete and/or insert elements in listd. none of above

5. Which of the following is not a limitation of binary search algorithm?

a. must use a sorted arrayb. requirement of sorted array is expensive when a lot of insertion and deletions are neededc. there must be a mechanism to access middle element directlyd. binary search algorithm is not efficient when the data elements are more than 1000.

6. Two dimensional arrays are also called

a. tables arraysb. matrix arrays

Page 2: Data Structure

c. both of aboved. none of above

7. A variable P is called pointer if

a. P contains the address of an element in DATA.b. P points to the address of first element in DATAc. P can store only memory addressesd. P contain the DATA and the address of DATA

8. Which of the following data structure can't store the non-homogeneous data elements?

a. Arraysb. Recordsc. Pointersd. None

9. Which of the following data structure store the homogeneous data elements?

a. Arraysb. Recordsc. Pointersd. None

10. Each data item in a record may be a group item composed of sub-items; those items which are indecomposable are called

a. elementary itemsb. atomsc. scalarsd. all of above

11. The difference between linear array and a record is

a. An array is suitable for homogeneous data but hte data items in a record may have different data typeb. In a record, there may not be a natural ordering in opposed to linear array.c. A record form a hierarchical structure but a lienear array does notd. All of above

12. Which of the following statement is false?

a. Arrays are dense lists and static data structure b. data elements in linked list need not be stored in adjecent space in memoryc. pointers store the next data element of a listd. linked lists are collection of the nodes that contain information part and next pointer

Page 3: Data Structure

13. Binary search algorithm can not be applied to

a. sorted linked listb. sorted binary treesc. sorted linear arrayd. pointer array

14. When new data are to be inserted into a data structure, but there is no available space; this situation is usually called

a. underflowb. overflowc. housefulld. saturated

15. The situation when in a linked list START=NULL is

a. underflowb. overflowc. housefulld. saturated

16. Which of the following is two way list?

a. grounded header listb. circular header listc. linked list with header and trailer nodesd. none of above

17. Which of the following name does not relate to stacks?

a. FIFO listsb. LIFO listc. Pilesd. Push-down lists

18. The term "push" and "pop" is related to the

a. arrayb. listsc. stacksd. all of above

19. A data structure where elements can be added or removed at either end but not in the middle

Page 4: Data Structure

a. Linked listsb. Stacksc. Queuesd. Deque

20. When inorder traversing a tree resulted E A C K F H D B G; the preorder traversal would return

a. FAEKCDBHGb. FAEKCDHGBc. EAFKHDCBGd. FEAKDCHBG

Answers

1. The memory address of the first element of an array is calledd. base address

2. The memory address of fifth element of an array can be calculated by the formulaa. LOC(Array[5]=Base(Array)+w(5-lower bound), where w is the number of words per memory cell for the array

3. Which of the following data structures are indexed structures?a. linear arrays

4. Which of the following is not the required condition for binary search algorithm?c. There must be mechanism to delete and/or insert elements in list

5. Which of the following is not a limitation of binary search algorithm?d. binary search algorithm is not efficient when the data elements are more than 1000.

6. Two dimensional arrays are also calledc. both of above

7. A variable P is called pointer ifa. P contains the address of an element in DATA.

8. Which of the following data structure can't store the non-homogeneous data elements?a. Arrays

9. Which of the following data structure store the non-homogeneous data elements?b. Records

10. Each data item in a record may be a group item composed of sub-items; those items which are indecomposable are calledd. all of above

Page 5: Data Structure

11. The difference between linear array and a record isd. All of above

12. Which of the following statement is false?c. pointers store the next data element of a list

13. Binary search algorithm can not be applied toa. sorted linked list

14. When new data are to be inserted into a data structure, but there is no available space; this situation is usually calledb. overflow

15. The situation when in a linked list START=NULL isa. underflow

16. Which of the following is two way list?d. none of above

17. Which of the following name does not relate to stacks?a. FIFO lists

18. The term "push" and "pop" is related to thec. stacks

19. A data structure where elements can be added or removed at either end but not in the middled. Deque

20. When inorder traversing a tree resulted E A C K F H D B G; the preorder traversal would returnb. FAEKCDHGB

1. Value of the first linked list index is _______

1. One 2. Zero 3. -1 4. None of these

2. A linked list index is ____ that represents the position of a node in a linked list.

1. An Integer 2. a variable 3. a character 4. a boolean

3. Why is the constructor of the QueueLinkedList class empty?

1. because initialization of data members of the LinkedList class is performed by the constructor of the LinkedList class.

2. because initialization of data members of the LinkedList class is performed by the destructor of the LinkedList class. 3. because initialization of data members of the QueueLinkedList class is performed by the constructor of the

LinkedList class. 4. because initialization of data members of the QueueLinkedList class is performed by the destructor of the LinkedList

class 4. _______ form of access is used to add and remove nodes from a queue

Page 6: Data Structure

1. LIFO,Last In First Out 2. FIFO , First In First Out 3. Both 1 and 2 4. None of these

5. ______ form of access is used to add and remove nodes from a stack

1. LIFO 2. FIFO 3. Both 1 and 2 4. None of these

6. New nodes are added to the _____ of the queue.

1. front 2. back 3. middle 4. Both 1 and 2

7. A _______ is a data structure that organizes data similar to a line in the supermarket, where the first one in line is the first one out.

1. queue linked list 2. stacks linked list 3. both of them 4. neither of them

8. In an array queue, data is stored in an _____ element.

1. Node 2. linked list 3. array 4. constructor

9. The pop() member function determines if the stack is empty by calling the _____ member function

1. removeback() 2. isEmpty() 3. removedfront() 4. hasNext()

10. What happens when you push a new node onto a stack?

1. the new node is placed at the front of the linked list. 2. the new node is placed at the back of the linked list. 3. the new node is placed at the middle of the linked list. 4. No Changes happens

Set - 1

1. Two main measures for the efficiency of an algorithm are a. Processor and memoryb. Complexity and capacityc. Time and spaced. Data and space

2. The time factor when determining the efficiency of algorithm is measured bya. Counting microseconds b. Counting the number of key operationsc. Counting the number of statementsd. Counting the kilobytes of algorithm

3. The space factor when determining the efficiency of algorithm is measured bya. Counting the maximum memory needed by the algorithmb. Counting the minimum memory needed by the algorithm

Page 7: Data Structure

c. Counting the average memory needed by the algorithmd. Counting the maximum disk space needed by the algorithm

4. Which of the following case does not exist in complexity theorya. Best caseb. Worst casec. Average cased. Null case

5. The Worst case occur in linear search algorithm when a. Item is somewhere in the middle of the arrayb. Item is not in the array at allc. Item is the last element in the arrayd. Item is the last element in the array or is not there at all

6. The Average case occur in linear search algorithma. When Item is somewhere in the middle of the array b. When Item is not in the array at allc. When Item is the last element in the arrayd. When Item is the last element in the array or is not there at all

7. The complexity of the average case of an algorithm is a. Much more complicated to analyze than that of worst caseb. Much more simpler to analyze than that of worst casec. Sometimes more complicated and some other times simpler than that of worst case d. None or above

8. The complexity of linear search algorithm isa. O(n)b. O(log n)c. O(n2)d. O(n log n)

9. The complexity of Binary search algorithm is a. O(n)b. O(log )c. O(n2)d. O(n log n)

10. The complexity of Bubble sort algorithm is a. O(n)b. O(log n)c. O(n2)d. O(n log n)

Page 8: Data Structure

11. The complexity of merge sort algorithm isa. O(n)b. O(log n)c. O(n2)d. O(n log n)

12. The indirect change of the values of a variable in one module by another module is calleda. internal changeb. inter-module changec. side effectd. side-module update

13. Which of the following data structure is not linear data structure?a. Arraysb. Linked listsc. Both of aboved. None of above

14. Which of the following data structure is linear data structure?a. Treesb. Graphsc. Arraysd. None of above

15. The operation of processing each element in the list is known asa. Sortingb. Mergingc. Insertingd. Traversal

16. Finding the location of the element with a given value is:a. Traversalb. Searchc. Sortd. None of above

17. Arrays are best data structuresa. for relatively permanent collections of datab. for the size of the structure and the data in the structure are constantly changingc. for both of above situationd. for none of above situation

18. Linked lists are best suited

Page 9: Data Structure

a. for relatively permanent collections of data b. for the size of the structure and the data in the structure are constantly changingc. for both of above situationd. for none of above situation

19. Each array declaration need not give, implicitly or explicitly, the information abouta. the name of arrayb. the data type of arrayc. the first data from the set to be storedd. the index set of the array

20. The elements of an array are stored successively in memory cells becausea. by this way computer can keep track only the address of the first element and the addresses of other elements can be calculatedb. the architecture of computer memory does not allow arrays to store other than seriallyc. both of aboved. none of above

Answers

1. Two main measures for the efficiency of an algorithm arec. Time and space2. The time factor when determining the efficiency of algorithm is measured byb. Counting the number of key operations3. The space factor when determining the efficiency of algorithm is measured bya. Counting the maximum memory needed by the algorithm4. Which of the following case does not exist in complexity theoryd. Null case5. The Worst case occur in linear search algorithm whend. Item is the last element in the array or is not there at all6. The Average case occur in linear search algorithma. When Item is somewhere in the middle of the array7. The complexity of the average case of an algorithm isa. Much more complicated to analyze than that of worst case8. The complexity of linear search algorithm isa. O(n)9. The complexity of Binary search algorithm isb. O(log n)10. The complexity of Bubble sort algorithm isc. O(n2)11. The complexity of merge sort algorithm isd. O(n log n)12. The indirect change of the values of a variable in one module by another module is calledc. side effect

Page 10: Data Structure

13. Which of the following data structure is not linear data structure?d. None of above14. Which of the following data structure is linear data structure?c. Arrays15. The operation of processing each element in the list is known asd. Traversal16. Finding the location of the element with a given value is:b. Search17. Arrays are best data structuresa. for relatively permanent collections of data18. Linked lists are best suitedb. for the size of the structure and the data in the structure are constantly changing19. Each array declaration need not give, implicitly or explicitly, the information aboutc. the first data from the set to be stored

20. The elements of an array are stored successively in memory cells becausea. by this way computer can keep track only the address of the first element and the addresses of other elements can be calculated

Set - 2

1. The memory address of the first element of an array is called

a. floor addressb. foundation addressc. first addressd. base address

2. The memory address of fifth element of an array can be calculated by the formula

a. LOC(Array[5]=Base(Array)+w(5-lower bound), where w is the number of words per memory cell for the arrayb. LOC(Array[5])=Base(Array[5])+(5-lower bound), where w is the number of words per memory cell for the arrayc. LOC(Array[5])=Base(Array[4])+(5-Upper bound), where w is the number of words per memory cell for the arrayd. None of above

3. Which of the following data structures are indexed structures?

a. linear arraysb. linked listsc. both of aboved. none of above

4. Which of the following is not the required condition for binary search algorithm?

Page 11: Data Structure

a. The list must be sortedb. there should be the direct access to the middle element in any sublistc. There must be mechanism to delete and/or insert elements in listd. none of above

5. Which of the following is not a limitation of binary search algorithm?

a. must use a sorted arrayb. requirement of sorted array is expensive when a lot of insertion and deletions are neededc. there must be a mechanism to access middle element directlyd. binary search algorithm is not efficient when the data elements are more than 1000.

6. Two dimensional arrays are also called

a. tables arraysb. matrix arraysc. both of aboved. none of above

7. A variable P is called pointer if

a. P contains the address of an element in DATA.b. P points to the address of first element in DATAc. P can store only memory addressesd. P contain the DATA and the address of DATA

8. Which of the following data structure can't store the non-homogeneous data elements?

a. Arraysb. Recordsc. Pointersd. None

9. Which of the following data structure store the homogeneous data elements?

a. Arraysb. Recordsc. Pointersd. None

10. Each data item in a record may be a group item composed of sub-items; those items which are indecomposable are called

a. elementary itemsb. atomsc. scalarsd. all of above

Page 12: Data Structure

11. The difference between linear array and a record is

a. An array is suitable for homogeneous data but hte data items in a record may have different data typeb. In a record, there may not be a natural ordering in opposed to linear array.c. A record form a hierarchical structure but a lienear array does notd. All of above

12. Which of the following statement is false?

a. Arrays are dense lists and static data structure b. data elements in linked list need not be stored in adjecent space in memoryc. pointers store the next data element of a listd. linked lists are collection of the nodes that contain information part and next pointer

13. Binary search algorithm can not be applied to

a. sorted linked listb. sorted binary treesc. sorted linear arrayd. pointer array

14. When new data are to be inserted into a data structure, but there is no available space; this situation is usually called

a. underflowb. overflowc. housefulld. saturated

15. The situation when in a linked list START=NULL is

a. underflowb. overflowc. housefulld. saturated

16. Which of the following is two way list?

a. grounded header listb. circular header listc. linked list with header and trailer nodesd. none of above

17. Which of the following name does not relate to stacks?

Page 13: Data Structure

a. FIFO listsb. LIFO listc. Pilesd. Push-down lists

18. The term "push" and "pop" is related to the

a. arrayb. listsc. stacksd. all of above

19. A data structure where elements can be added or removed at either end but not in the middle

a. Linked listsb. Stacksc. Queuesd. Deque

20. When inorder traversing a tree resulted E A C K F H D B G; the preorder traversal would return

a. FAEKCDBHGb. FAEKCDHGBc. EAFKHDCBGd. FEAKDCHBG

Answers

1. The memory address of the first element of an array is calledd. base address

2. The memory address of fifth element of an array can be calculated by the formulaa. LOC(Array[5]=Base(Array)+w(5-lower bound), where w is the number of words per memory cell for the array

3. Which of the following data structures are indexed structures?a. linear arrays

4. Which of the following is not the required condition for binary search algorithm?c. There must be mechanism to delete and/or insert elements in list

5. Which of the following is not a limitation of binary search algorithm?

Page 14: Data Structure

d. binary search algorithm is not efficient when the data elements are more than 1000.

6. Two dimensional arrays are also calledc. both of above

7. A variable P is called pointer ifa. P contains the address of an element in DATA.

8. Which of the following data structure can't store the non-homogeneous data elements?a. Arrays

9. Which of the following data structure store the non-homogeneous data elements?b. Records

10. Each data item in a record may be a group item composed of sub-items; those items which are indecomposable are calledd. all of above

11. The difference between linear array and a record isd. All of above

12. Which of the following statement is false?c. pointers store the next data element of a list

13. Binary search algorithm can not be applied toa. sorted linked list

14. When new data are to be inserted into a data structure, but there is no available space; this situation is usually calledb. overflow

15. The situation when in a linked list START=NULL isa. underflow

16. Which of the following is two way list?d. none of above

17. Which of the following name does not relate to stacks?a. FIFO lists

18. The term "push" and "pop" is related to thec. stacks

19. A data structure where elements can be added or removed at either end but not in the middled. Deque

20. When inorder traversing a tree resulted E A C K F H D B G; the preorder traversal would returnb. FAEKCDHGB

Page 15: Data Structure

Set - 3

1. Which data structure allows deleting data elements from front and inserting at rear?a. Stacks b. Queues c. Deques d. Binary search tree

2. Identify the data structure which allows deletions at both ends of the list but insertion at only one end.a. Input-restricted dequeb. Output-restricted dequec. Priority queuesd. None of above

3. Which of the following data structure is non-linear type?a. Stringsb. Listsc. Stacksd. None of above

4. Which of the following data structure is linear type?a. Stringsb. Listsc. Queuesd. All of above

5. To represent hierarchical relationship between elements, which data structure is suitable?a. Dequeb. Priorityc. Treed. All of above

6. A binary tree whose every node has either zero or two children is calleda. Complete binary treeb. Binary search treec. Extended binary treed. None of above

7. The depth of a complete binary tree is given bya. Dn = n log2nb. Dn = n log2n+1c. Dn = log2nd. Dn = log2n+1

8. When representing any algebraic expression E which uses only binary operations in a 2-tree,a. the variable in E will appear as external nodes and operations in internal nodesb. the operations in E will appear as external nodes and variables in internal nodesc. the variables and operations in E will appear only in internal nodes

Page 16: Data Structure

d. the variables and operations in E will appear only in external nodes

9. A binary tree can easily be converted into q 2-treea. by replacing each empty sub tree by a new internal nodeb. by inserting an internal nodes for non-empty nodec. by inserting an external nodes for non-empty noded. by replacing each empty sub tree by a new external node

10. When converting binary tree into extended binary tree, all the original nodes in binary tree area. internal nodes on extended treeb. external nodes on extended treec. vanished on extended treed. None of above

11. The post order traversal of a binary tree is DEBFCA. Find out the pre order traversala. ABFCDEb. ADBFECc. ABDECFd. ABDCEF

12. Which of the following sorting algorithm is of divide-and-conquer type?a. Bubble sortb. Insertion sortc. Quick sortd. All of above

13. An algorithm that calls itself directly or indirectly is known asa. Sub algorithmb. Recursionc. Polish notationd. Traversal algorithm

14. In a binary tree, certain null entries are replaced by special pointers which point to nodes higher in the tree for efficiency. These special pointers are calleda. Leafb. branchc. pathd. thread

15. The in order traversal of tree will yield a sorted listing of elements of tree ina. Binary treesb. Binary search treesc. Heapsd. None of above

16. In a Heap treea. Values in a node is greater than every value in left sub tree and smaller than right sub treeb. Values in a node is greater than every value in children of itc. Both of above conditions appliesd. None of above conditions applies

Page 17: Data Structure

17. In a graph if e=[u, v], Then u and v are calleda. endpoints of eb. adjacent nodesc. neighborsd. all of above

18. A connected graph T without any cycles is calleda. a tree graphb. free treec. a treed. All of above

19. In a graph if e=(u, v) meansa. u is adjacent to v but v is not adjacent to ub. e begins at u and ends at vc. u is processor and v is successord. both b and c

20. If every node u in G is adjacent to every other node v in G, A graph is said to bea. isolatedb. completec. finited. strongly connected

Answers:

1. Which data structure allows deleting data elements from front and inserting at rear?b. Queues

2. Identify the data structure which allows deletions at both ends of the list but insertion at only one end.a. Input-restricted deque

3. Which of the following data structure is non-linear type?d. None of above

4. Which of the following data structure is linear type?d. All of above

5. To represent hierarchical relationship between elements, which data structure is suitable?c. Tree

6. A binary tree whose every node has either zero or two children is calledc. Extended binary tree

Page 18: Data Structure

7. The depth of a complete binary tree is given byd. Dn = log2n + 1

8. When representing any algebraic expression E which uses only binary operations in a 2-tree,a. the variable in E will appear as external nodes and operations in internal nodes

9. A binary tree can easily be converted into q 2-treed. by replacing each empty sub tree by a new external node

10. When converting binary tree into extended binary tree, all the original nodes in binary tree area. internal nodes on extended tree

11. The post order traversal of a binary tree is DEBFCA. Find out the pre order traversalc. ABDECF

12. Which of the following sorting algorithm is of divide-and-conquer type?c. Quick sort

13. An algorithm that calls itself directly or indirectly is known asb. Recursion

14. In a binary tree, certain null entries are replaced by special pointers which point to nodes higher in the tree for efficiency. These special pointers are calledd. thread

15. The in order traversal of tree will yield a sorted listing of elements of tree inb. Binary search trees

16. In a Heap treeb. Values in a node is greater than every value in children of it

17. In a graph if e=[u, v], Then u and v are calledd. all of above

18. A connected graph T without any cycles is calledd. All of above

19. In a graph if e=(u, v) meansd. both b and c

20. If every node u in G is adjacent to every other node v in G, A graph is said to beb. complete

Data Structures Multiple Choice Questions - Part 1

1. _____________ Memory is Volatile

Page 19: Data Structure

1. main 2. Random Access

3. Both 1 and 2 4. Virtual

2. An _________ data type is a keyword of a programming language that specifies the amount of memory needed to store data and the kind of data that will be stored in that memory location

1. abstract 2. int

3. vector 4. None of these

3. Which of the following abstract data types are NOT used by Integer Abstract Data type group?

1. Short 2. Int

3. float 4. long

4. The hashString() member function is called by other member functions of the Hashtable class whenever a function needs to convert a ________________

1. a hash number key to a key 2. key to a hash number key

3. a key to an Index 4. None of these

5. An application iterates the hashtable by calling the ______ and ______ member functions

1. hasNext() and hasDelete() 2. hasNext() and getNextKey()

3. Both 1 and 2 4. None of these

6. The java.util package contains two classes that are designed to work with hashtables. They are _______ and _________..

1. Hashtable , HashMap class 2. Hashtable,List

3. Vector,List 4. Vector,Hashtable

7. Data members of the Hashtable class stored in the private access specifier

1. private access specifier 2. Public access specifier

3. common access specifier 4. None of these

8. _____ is the common programming technique used for hashing in all hashing functions

1. Cloning 2. Bit Shifting

3. Hashmapping 4. Listing

9. If the depth of a tree is 3 levels, then what is the Size of the Tree?

1. 4 2. 2 3. 8 4. 6

10. deleteNode() function requires the _____ of the data element of the node that is being removed

1. reference 2. value

3. declaration 4. variable

Data Structures Multiple Choice Questions - Part 2 1. Value of the first linked list index is _______

Page 20: Data Structure

1. One 2. Zero 3. -1 4. None of these

2. A linked list index is ____ that represents the position of a node in a linked list.

1. An Integer 2. a variable 3. a character 4. a boolean

3. Why is the constructor of the QueueLinkedList class empty?

1. because initialization of data members of the LinkedList class is performed by the constructor of the LinkedList class.

2. because initialization of data members of the LinkedList class is performed by the destructor of the LinkedList class.

3. because initialization of data members of the QueueLinkedList class is performed by the constructor of the LinkedList class.

4. because initialization of data members of the QueueLinkedList class is performed by the destructor of the LinkedList class 4. _______ form of access is used to add and remove nodes from a queue

1. LIFO,Last In First Out 2. FIFO , First In First Out 3. Both 1 and 2 4. None of these

5. ______ form of access is used to add and remove nodes from a stack

1. LIFO 2. FIFO 3. Both 1 and 2 4. None of these

6. New nodes are added to the _____ of the queue.

1. front 2. back 3. middle 4. Both 1 and 2

7. A _______ is a data structure that organizes data similar to a line in the supermarket, where the first one in line is the first one out.

1. queue linked list 2. stacks linked list 3. both of them 4. neither of them

8. In an array queue, data is stored in an _____ element.

1. Node 2. linked list 3. array 4. constructor

9. The pop() member function determines if the stack is empty by calling the _____ member function

1. removeback() 2. isEmpty() 3. removedfront() 4. hasNext()

10. What happens when you push a new node onto a stack?

1. the new node is placed at the front of the linked list. 2. the new node is placed at the back of the linked list. 3. the new node is placed at the middle of the linked list. 4. No Changes happens