Monday, February 28, 2011

MCQ: Data Structures

Two main measures for the efficiency of an algorithm are
A. Processor and memory
B. Complexity and capacity
C. Time and space
D. Data and space
ANSWER: C

The time factor when determining the efficiency of algorithm is measured by
A. Counting microseconds
B. Counting the number of key operations
C. Counting the number of statements
D. Counting the kilobytes of algorithm
ANSWER: B

The space factor when determining the efficiency of algorithm is measured by
A.Counting the maximum memory needed by the algorithm
B.Counting the minimum memory needed by the algorithm
C. Counting the average memory needed by the algorithm
D. Counting the maximum disk space needed by the algorithm
ANSWER: A


Which of the following case does not exist in complexity theory?
A. Best case
B. Worst case
C. Average case
D. Null case
ANSWER: D

The Worst case occur in linear search algorithm when
A. Item is somewhere in the middle of the array
B. Item is not in the array at all
C. Item is the last element in the array
D. Item is the last element in the array or is not there at all
ANSWER: D


The Average case occur in linear search algorithm
A. When Item is somewhere in the middle of the array
B. When Item is not in the array at all
C. When Item is the last element in the array
D. When Item is the last element in the array or is not there at all
ANSWER: A


The complexity of the average case of an algorithm is
A. Much more complicated to analyze than that of worst case
B. Much more simpler to analyze than that of worst case
C. Sometimes more complicated and some other times simpler than that of worst case
D. None or above
ANSWER: A


The complexity of linear search algorithm is
A. O(n)
B. O(log n)
C. O(n2)
D. O(n log n)
ANSWER: A

The complexity of Binary search algorithm is
A. O(n)
B. O(log )
C. O(n2)
D. O(n log n)
ANSWER: B


The complexity of Bubble sort algorithm is
A. O(n)
B. O(log n)
C. O(n2)
D. O(n log n)
ANSWER: C


The complexity of merge sort algorithm is
A. O(n)
B. O(log n)
C. O(n2)
D. O(n log n)
ANSWER: D


The indirect change of the values of a variable in one module by another module is called
A. internal change
B. inter-module change
C. side effect
D. side-module update
ANSWER: C


Which of the following data structure is not linear data structure?
A. Arrays
B. Linked lists
C. Both of above
D. None of above
ANSWER: D


Which of the following data structure is linear data structure?
A. Trees
B. Graphs
C. Arrays
D. None of above
ANSWER: C


The operation of processing each element in the list is known as
A. Sorting
B. Merging
C. Inserting
D. Traversal
ANSWER: D


Finding the location of the element with a given value is:
A. Traversal
B. Search
C. Sort
D. None of above
ANSWER: B


Arrays are best data structures
A. for relatively permanent collections of data
B. for the size of the structure and the data in the structure are constantly changing
C. for both of above situation
D. for none of above situation
ANSWER: A


Linked lists are best suited
A. for relatively permanent collections of data
B. for the size of the structure and the data in the structure are constantly changing
C. for both of above situation
D. for none of above situation
ANSWER: B

Each array declaration need not give, implicitly or explicitly, the information about
A. the name of array
B. the data type of array
C. the first data from the set to be stored
D. the index set of the array
ANSWER: C

The elements of an array are stored successively in memory cells because
A. by this way computer can keep track only the address of the first element and the addresses of other elements can be calculated
B. the architecture of computer memory does not allow arrays to store other than serially
C. both of above
D. none of above
ANSWER: A


Which data structure allows deleting data elements from front and inserting at rear?
A. Stacks
B. Queues
C. Deques
D. Binary search tree
ANSWER: B

Identify the data structure which allows deletions at both ends of the list but insertion at only one end.
A. Input-restricted deque
B. Output-restricted deque
C. Priority queues
D. None of above
ANSWER: A

Which of the following data structure is non-linear type?
A. Strings
B. Lists
C. Stacks
D. None of above
ANSWER: D

Which of the following data structure is linear type?
A. Strings
B. Lists
C.   Queues
D. All of above
ANSWER: D

To represent hierarchical relationship between elements, which data structure is not suitable?
A. Deque
B. Priority
C. Tree
D. All of above
ANSWER: C

A binary tree whose every node has either zero or two children is called
A. Complete binary tree
B. Binary search tree
C. Extended binary tree
D. None of above
ANSWER: C

The depth of a complete binary tree is given by
A. Dn = n log2n
B. Dn = n log2n+1
C. Dn = log2n
D. Dn = log2n+1
ANSWER: D

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
B. the operations in E will appear as external nodes and variables in internal nodes
C. the variables and operations in E will appear only in internal nodes
D. the variables and operations in E will appear only in external nodes
ANSWER: A

A binary tree can easily be converted into a 2-tree
A. by replacing each empty sub tree by a new internal node
B. by inserting an internal nodes for non-empty node
C. by inserting an external nodes for non-empty node
D. by replacing each empty sub tree by a new external node
ANSWER: D

When converting binary tree into extended binary tree, all the original nodes in binary tree are
A. internal nodes on extended tree
B. external nodes on extended tree
C. vanished on extended tree
D. None of above
ANSWER: A

The post order traversal of a binary tree is DEBFCA. Find out the pre order traversal
A. ABFCDE
B. ADBFEC
C. ABDECF
D. ABDCEF
ANSWER: C

Which of the following sorting algorithm is of divide-and-conquer type?
A. Bubble sort
B. Insertion sort
C. Quick sort
D. All of above
ANSWER: C

An algorithm that calls itself directly or indirectly is known as
A. Sub algorithm
B. Recursion
C. Polish notation
D. Traversal algorithm
ANSWER: B

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 called
A. Leaf
B. branch
C. path
D. thread
ANSWER: D

The in order traversal of tree will yield a sorted listing of elements of tree in
A. Binary trees
B. Binary search trees
C. Heaps
D. None of above
ANSWER: B

In a Heap tree
A. Values in a node is greater than every value in left sub tree and smaller than right sub tree
B. Values in a node is greater than every value in children of it
C. Both of above conditions applies
D. None of above conditions applies
ANSWER: B

In a graph if e=[u, v], Then u and v are called
A. endpoints of e
B. adjacent nodes
C. neighbors
D. all of above
ANSWER: D

A connected graph T without any cycles is called
A. a tree graph
B. free tree
C. a tree
D. All of above
ANSWER: D

In a graph if e=(u, v) means
A. u is adjacent to v but v is not adjacent to u
B. e begins at u and ends at v
C. u is processor and v is successor
D. both b and c
ANSWER: D


If every node u in G is adjacent to every other node v in G, A graph is said to be
A. isolated
B. complete
C. finite
D. strongly connected
ANSWER: B


The memory address of the first element of an array is called
A. floor address
B. foundation address
C. first address
D. base address
ANSWER: D

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
ANSWER: A

Which of the following data structures are indexed structures?
A. linear arrays
B. linked lists
C. both of above
D. none of above
ANSWER: A

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
ANSWER: C

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 deletions are needed
C. there must be a mechanism to access middle element directly
D. binary search algorithm is not efficient when the data elements are more than 1000.
ANSWER: D

Two dimensional arrays are also called
A. tables arrays
B. matrix arrays
C. both of above
D. none of above
ANSWER: C

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 DATA
C. P can store only memory addresses
D. P contain the DATA and the address of DATA
ANSWER: A

Which of the following data structure can't store the non-homogeneous data elements?
A. Arrays
B. Records
C. Pointers
D. None
ANSWER: A

Which of the following data structure store the homogeneous data elements?
A. Arrays
B. Records
C. Pointers
D. None
ANSWER: B

Each data item in a record may be a group item composed of sub-items; those items which are indecomposable are called
A. elementary items
B. atoms
C. scalars
D. all of above
ANSWER: D

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 type
B. 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 not
D. All of above
ANSWER: D

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 memory
C. pointers store the next data element of a list
D. linked lists are collection of the nodes that contain information part and next pointer
ANSWER: C

Binary search algorithm can not be applied to
A. sorted linked list
B. sorted binary trees
C. sorted linear array
D. pointer array
ANSWER: A

When new data are to be inserted into a data structure, but there is no available space; this situation is usually called
A. underflow
B. overflow
C. housefull
D. saturated
ANSWER: B

The situation when in a linked list START=NULL is
A. underflow
B. overflow
C. housefull
D. saturated
ANSWER: A

Which of the following is two way list?
A. grounded header list
B. circular header list
C. linked list with header and trailer nodes
D. none of above
ANSWER: D

Which of the following name does not relate to stacks?
A. FIFO lists
B. LIFO list
C. Piles
D. Push-down lists
ANSWER: A

The term "push" and "pop" is related to the
A. array
B. lists
C. stacks
D. all of above
ANSWER: C

A data structure where elements can be added or removed at either end but not in the middle
A. Linked lists
B. Stacks
C. Queues
D. Deque
ANSWER: D

When inorder traversing a tree resulted E A C K F H D B G; the preorder traversal would return
A. FAEKCDBHG
B. FAEKCDHGB
C. EAFKHDCBG
D. FEAKDCHBG
ANSWER: B

A cyclic graph has:
A. a shape like a unicycle
B. a graph that cycles from vertices to edges
C. a cycle of two or more nodes
D. a cycle of three or more nodes
ANSWER: D

A(n) _______________________ graph is a graph in which each vertex has a connection to every other vertex.
A. directed
B. cyclic
C. acyclic
D. NONE
ANSWER: D

A(n) ____________________ is a graph in which each connection has two directions.
A. undirected graph
B. bigraph
C. bidirectional graph
D.NONE
ANSWER: D

In a selectionsort of n elements, how many times is the swap function called in the complete execution of the algorithm?
A. 1
B. n - 1
C. n log n
D. n^2
ANSWER : B


Selectionsort and quicksort both fall into the same category of sorting algorithms. What is this category?
A. O(n log n) sorts
B. Divide-and-conquer sorts
C. Interchange sorts
D. Average time is quadratic.
ANSWER : C


Suppose that a selectionsort of 100 items has completed 42 iterations of the main loop. How many items are now guaranteed to be in their final spot (never to be moved again)?
A. 21
B. 41
C. 42
D. 43
ANSWER : C


Suppose we are sorting an array of ten integers using a some quadratic sorting algorithm. After four iterations of the algorithm's main loop, the array elements are ordered as shown here:
1 2 3 4 5 0 6 7 8 9
Which statement is correct? (Note: Our selection sort picks largest items first.)
A. The algorithm might be either selection sort or insertion sort.
B. The algorithm might be selectionsort, but could not be insertionsort.
C. The algorithm might be insertionsort, but could not be selectionsort.
D. The algorithm is neither selectionsort nor insertionsort.
ANSWER : C


Suppose we are sorting an array of eight integers using a some quadratic sorting algorithm. After four iterations of the algorithm's main loop, the array elements are ordered as shown here:
2 4 5 7 8 1 3 6
Which statement is correct? (Note: Our selectionsort picks largest items first.)
A. The algorithm might be either selectionsort or insertionsort.
B. The algorithm might be selectionsort, but it is not insertionsort.
C. The algorithm is not selectionsort, but it might be insertionsort.
D. The algorithm is neither selectionsort nor insertionsort.
ANSWER : C


When is insertionsort a good choice for sorting an array?
A. Each component of the array requires a large amount of memory.
B. Each component of the array requires a small amount of memory.
C. The array has only a few items out of place.
D. The processor speed is fast.
ANSWER : C


What is the worst-case time for mergesort to sort an array of n elements?
A. O(log n)
B. O(n)
C. O(n log n)
D. O(n^2)
ANSWER : C


What is the worst-case time for quicksort to sort an array of n elements?
A. O(log n)
B. O(n)
C. O(n log n)
D. O(n^2)
ANSWER : D


Mergesort makes two recursive calls. Which statement is true after these recursive calls finish, but before the merge step?
A. The array elements form a heap.
B. Elements in each half of the array are sorted amongst themselves.
C. Elements in the first half of the array are less than or equal to elements in the second half of the array.
D. None of the above.
ANSWER : B


Suppose we are sorting an array of eight integers using quicksort, and we have just finished the first partitioning with the array looking like this:
2 5 1 7 9 12 11 10
Which statement is correct?
A. The pivot could be either the 7 or the 9.
B. The pivot could be the 7, but it is not the 9.
C. The pivot is not the 7, but it could be the 9.
D. Neither the 7 nor the 9 is the pivot.
ANSWER : A


What is the worst-case time for heapsort to sort an array of n elements?
A. O(log n)
B. O(n)
C. O(n log n)
D. O(n^2)
ANSWER : C


Suppose you have an array of N elements,containing only 2 distinct keys, true and false.Give an O(N) algorithm to sort the array.
A. Bucket sort with 2 buckets.
B. Merge sort
C. Both
D. None of these
ANSWER : A


Maximum number of nodes in a binary tree of depth K
A. 2K-1
B. 2K
C. 2K +1
D. None of these
ANSWER : A


For a nonempty tree T, if n0 is the number of leaf nodes and n2 the number of nodes of degree 2  then
A. n0 = n2 + 1.
B. n0 = 2n2 + 1.
C. n0 = 2n2 + 1.
D. None of these
ANSWER : A


If the records to be sorted are in auxiliary storage, sorting is called
A. Internal
B. External
C. Stable
D. None of the above
ANSWER : B


The property of hash function is that
A. it minimizes the rate of overflow
B. it preserves the order of key values.
C. it minimizes number of collisions.
D. none of the above.
ANSWER : C


Binary Search Tree is a
A. tree whose right and left sub-tree has value less than root.
B. tree whose right and left sub-tree has value more than root.
C. tree whose left sub-tree has value less than root and right sub-tree has value more than root.
D. none of the above.
ANSWER : C


Binary search is applicable to multidimensional arrays.
A. True
B. False
ANSWER : B


Which one of the followings is not an abstract type?
A. Container
B. Deque
C. List
D. Record
ANSWER : D


Which one of the following is not a composite type?
A. Record
B. Union
C. Tagged Union
D. List
ANSWER : D


The technique of representing an aggregate data structure so that it is convenient for writing programs that traverse the structure arbitrarily and update its contents, especially in purely functional programming languages is known as
A. Zipper
B. VList
C. Jump List
D. None of the above
ANSWER : A


Which one of the followings is a prababilistic data structure?
A. Bloom Filter
B. Hash Table
C. Hash Trie
D. Finger tree
ANSWER : A


Which one of the followings is not a kind of list?
A. Jump List
B. VList
C. Xor Linked List
D. Map List
ANSWER : D


What is the complexity of Ford–Fulkerson algorithm?
A. O(Ef)  where E is the number of edges in the graph and f is the maximum flow in the graph
B. O(E/f)  where E is the number of edges in the graph and f is the maximum flow in the graph
C. O(E+f)  where E is the number of edges in the graph and f is the maximum flow in the graph
D. None of these
ANSWER : A


Which algorithm is used to find out the maximum flow from a source to a sink in a graph?
A.  Ford-Fulkerson algorithm
B.  Dijkstra's algorithm
C.  Floyd-Warshall algorithm
D.  None of these
ANSWER : A


Which of the following is NOT a raster data structure?
A. Run-length encoding.
B. Quadtree.
C. Spaghetti.
D. Block encoding.
ANSWER : C


Which of the following might be considered as the fourth dimension in GIS?
A. Space.
B. Time.
C. Scale.
D. Location.
ANSWER : B


Object-oriented models in GIS refer to models where data is:
A. Organized into a single layer containing all entities.
B. Organized into thematic layers.
C. Organized into a series of tiles.
D. None of these
ANSWER : A


When using a vector data model the maximum number of points possible should be used to represent a feature. 
A. True
B. False
ANSWER : A


Run length encoding reduces the size of a raster data set on a row by row basis. 
A. True
B. False
ANSWER : A



5 comments:

  1. thank u very much for posting these questions

    ReplyDelete
  2. thanks a lot thank u very much for posting these questions...These are very helpful for me ,tomorrow is my M.C.Q test thanks once again..

    ReplyDelete
  3. thank u very much for posting these questions

    ReplyDelete