Data Structure MCQ with Answers | Data Structures And Algorithms MCQ

1.  The logical or mathematical model of a particular organization of data is called

a.     Tree

b.    Algorithm

c.      Data structure

d.    File

 

2.  The way in which the data items are logically related defines -----

a.     Storage structure

b.    Data structure

c.      Data relationship

d.    Data operation

 

3.  Which of the following is a linear data structure?

a.     Array   

b.    AVL trees

c.      Binary trees

d.    Graphs

 

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

a.     Graph

b.    Tree

c.      Binary tree

d.    Stack

 

5.  Which data structure is not linear?

a.     Arrays

b.    Linked list

c.      Both

d.    None

 

6.  Which of the following is not a linear data structure?

a.     Array

b.    Linked list

c.      Heap

d.    None of the above

 

7.  The operation of processing each element in the list is known as :

a.     Sorting

b.    Merging

c.      Inserting

d.    Traversal

 

8.  Finding the location of an element with a given value is :

a.     Traversal

b.    Search

c.      Sort

d.    Find

 

9.  The operation of arranging data in a given order is known as

a.     Sorting

b.    Searching

c.      Traversing

d.    Hashing

 

10.  Accessing each record exactly once so that certain items in the record may be processed is known as

a.     Traversing

b.    Searching

c.      Sorting

d.    Processing

 

11.  Which of the following are the operations applicable on primitive data structure?

a.     Create

b.    Destroy

c.      Update

d.    All of the above


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

a.     Array

b.    Records

c.      Pointers

d.    List

 

13.  In general, the index of the first element in an array is _______

a.     0

b.    -1

c.       2

d.     1

 

14.  Linear array are also called

a.     Straight line array

b.    One-dimensional array

c.      Vertical array

d.    Horizontal array

 

15.  Two dimensional arrays are also called

a.     Table arrays

b.    Matrix arrays

c.      Both

d.    None

 

16.  If an array is declared as int a[5][5], how many elements can be stored in it?

a.     10

b.    20

c.      25

d.    None of the above

 

17.  Stack is

a.     LIFO

b.    FIFO

c.      FILO

d.    LILO

 

18.  Which linear structure has a provision of Last-In-First-Out (LIFO) mechanism for its elements?

a.     Stack

b.    Queue

c.      Both (a) and (b)

d.    None of the above

 

19.  Stack is called ___________

a.     Last in first out

b.    First in first out

c.      Last in last out

d.    None of the above

 

20.  Stack has the property of ____________

a.     Last in first out

b.    First in first out

c.      Last in last out

d.    First in last out

 

21.  Which of the following is known as LIFO?

a.     Array

b.    Linked list

c.      Queue

d.    Stack

 

22.  Process of inserting an element in stack is called ___________

a.     Create

b.    Push

c.      Evaluation

d.    Pop

 

23.  Process of removing an element from stack is called ________

a.     Create

b.    Push

c.      Evaluation

d.    Pop

 

24.  Deleting an element from the stack is called

a.     Push operation

b.    Pop operation

c.      Del operation

d.    Rem operation

 

25.  Which function places an element on the stack

a.     pop()

b.    push()

c.      peek()

d.    is empty()

 

26.  Pop operation in a stack is performed

a.     At the middle of the stack

b.    At the bottom of the stack

c.      At the top of the stack

d.    None of the above

 

27.  What does ‘stack underflow’ refer to?

a.     Accessing item from an undefined stack

b.    Adding items to a full stack

c.      Removing items from an empty stack

d.    Index out of bounds exception

 

28.  In a stack, if a user tries to remove an element from an empty stack it is called _________

a.     Underflow

b.    Empty collection

c.      Overflow

d.    Garbage Collection

29.  Which data structure is mainly used for implementing the recursive algorithm?

a.     Queue

b.    Stack

c.      Array

d.    List

 

30.  Which data structure do we use for testing a palindrome?

a.     Heap

b.    Tree

c.      Priority queue

d.    Stack

 

31.  Which data structure is used for implementing recursion?

a.     Queue

b.    Stack

c.      Array

d.    List

 

32.  Which term is used for Polish notation?

a.     Prefix

b.    Postfix

c.      Infix

d.    None of these

33.  Reverse Polish notation is other name of

a.     Infix

b.    Prefix

c.      Postfix

d.    Algebraic expression

 

34.  Which expression is also regarded as ‘Reverse Polish Notation’?

a.     Prefix

b.    Postfix

c.      Infix

d.    All of the above

35.  The type of expression in which operator succeeds its operands is?

a.     Infix Expression

b.    Prefix Expression

c.      Postfix Expression

d.    Both Prefix and Postfix Expressions

 

36.  Which direction of scanning is suitable for the evaluation of a prefix expression?

a.     Left to left

b.    Right to right

c.      Left to right

d.    Right to left

 

37.  Which of the following data structures finds its use in recursion?

a.     Stack

b.    Arrays

c.      Linked List

d.    Queues

 

38.  The data structure required to check whether an expression contains a balanced parenthesis is?

a.     Stack

b.    Queue

c.      Array

d.    Tree

 

39.  Which of the following application of stack?

a.     Finding factorial

b.    Tower of Hanoi

c.      Infix to prefix

d.    All of the above

 

40.  Which data structure can be used to check if a syntax has balanced parenthesis?

a.     Queue

b.    Tree

c.      List

d.    Stack

 

41.  Which of the following is not an inherent application of stack?

a.     Reversing a string

b.    Evaluation of postfix expression

c.      Implementation of recursion

d.    Job scheduling

 

42.  Which of the following is an application of stack?

a.     Recursion

b.    Evaluation of postfix expression

c.      Conversion of arithmetic expression from one notation to another

d.    All of the above

 

43.  Which data structure is needed to convert infix notation to postfix notation?

a.     Branch

b.    Tree

c.      Queue

d.    Stack

 

44.  If TOP = MAX-1, then the stack is

a.     Empty

b.    Full

c.      Contains some data

d.    None of these

 

45.  When does top value of the stack change?

a.     Before deletion

b.    While checking underflow

c.      At the time of deletion

d.    After deletion

 

46.  How many elements are present in the stack if the variable top exhibits pointing towards the topmost element in the array?

a.     Top+1

b.    Top-1

c.      Zero

d.    Infinite

 

47.  What will be the value of Top, if there is a size of stack STACK-Size is 5?

a.     5

b.    6

c.      4

d.    None of the above

 

48.  How do the nested calls of the function get managed?

a.     Through queues

b.    Through stacks

c.      Through trees

d.    Through graphs

 

49.  Pushing an element into stack already having five elements and stack size of 5, then stack becomes ___________

a.     Overflow

b.    Crash

c.      Underflow

d.    User flow

 

50.  What does ‘stack overflow’ refer to?

a.     accessing item from an undefined stack

b.    adding items to a full stack

c.      removing items from an empty stack

d.    index out of bounds exception

 

51.  When is the pop operation on stack considered to be an error?

a.     Only when the stack is empty

b.    Only when the stack is full

c.      When the stack is neither empty nor full

d.    Cannot be predicted

 

52.  Which function plays an important role in returning the address of memory block allocated to locate/store a node especially while declaring ‘top’ in the linked representation of the stack?

a.     Galloc()

b.    Falloc()

c.      Malloc()

d.    Calloc()

 

53.  Stacks do not find their applicability for

a.     Simplification of an arithmetic expression in postfix form

b.    Recursion implementation

c.      Conversion of infix to its equivalent postfix form

d.    Allocation of resources by an operating system

 

54.  Which of the following data structures can be used for parentheses matching?

a.     binary tree

b.    queue

c.      priority queue

d.     stack

 

55.  Which of the following is not the application of stack?

a.     A parentheses balancing program

b.    Tracking of local variables at run time

c.      Compiler Syntax Analyzer

d.    Data Transfer between two asynchronous process

 

 

56.  A queue is a

a.     FIFO (First In First Out)

b.    LIFO (Last In First Out)

c.      Ordered array

d.    Linear tree

 

57.  Which data structure follows a FIFO system?

a.     Stack

b.    Queue

c.      Linked list

d.    Tree

 

58.  In a queue, insertion is done at

a.     Rear

b.    Front

c.      Back

d.    Top

 

59.  Which of the following data structure allows deleting data elements from and inserting at rear?

a.     Stack

b.    Queues

c.      Dequeues

d.    BST

 

60.  In queue insertion is done at

a.     Front end

b.    Middle end

c.      Rear end

d.    None of the above

 

61.  From where does the insertion and deletion of elements get accomplished in Queues?

a.     Front and Rear ends respectively

b.    Rear and Front ends respectively

c.      Only Front ends

d.    Only Rear ends

 

62.  A queue follows __________

a.     FIFO (First In First Out) principle

b.    LIFO (Last In First Out) principle

c.      Ordered array

d.    Linear tree

 

63.  Which of the following properties is associated with a queue?

a.     First In Last Out

b.    First In First Out

c.      Last In First Out

d.    Last In Last Out

 

64.  Which of the following is not the type of queue?

a.     Priority queue

b.    Single-ended queue

c.      Circular queue

d.    Ordinary queue

 

65.  Which value is assigned/ set at front and rear ends during the initialization of a Queue?

a.     0

b.    1

c.      -1

d.    Infinity

 

66.  In a queue, the initial values of front pointer ‘f’ rare pointer ‘r’ should be ________ and ________

a.     0 and 1

b.    0 and -1

c.      -1 and 0

d.    1 and 0

 

67.  What should be the value of rear (end) if the queue is full (elements are completely occupied)?

a.     1

b.    -1

c.      MAX +1

d.    MAX-1

 

68.  Which of the following data structures allow insertion and deletion from both ends?

a.     Stack

b.    Dequeue

c.      Queue

d.    Strings

 

69.  The function that deletes value from a queue is called

a.     Enqueue

b.    Dequeue

c.      Pop

d.    Peek

 

70.  A linear list of elements in which deletion can be done from one end (front) and insertion can take place only at the other end (rear) is known as _____________

a.     Queue

b.    Stack

c.      Tree

d.    Linked list

 

71.  A data structure where elements can be added or removed at either end but not in the middle is called ________

a.     Linked list

b.    Stack

c.      queue

d.    Dequeue

 

72.  Which linear list allows elements to be added or removed at either end but not in the middle?

a.     Queue

b.    Stack

c.      Dequeue

d.    Linked list

 

73.  What is the term for inserting into a full queue known as?

a.     Overflow

b.    Underflow

c.      null pointer exception

d.    program won’t be compiled

 

74.  Circular Queue is also known as ________

a.     Ring Buffer

b.    Square Buffer

c.      Rectangle Buffer

d.    Curve Buffer

 

75.  A data structure in which elements can be inserted or deleted at/from both ends but not in the middle is?

a.     Queue

b.    Circular queue

c.      Dequeue

d.    Priority queue

 

76.  In a priority queue, if two elements have the same priority, then they are processed according to

a.     Their preference of the operating system

b.    Their position in the queue

c.      The order in which they were added to the queue

d.    The random selection by the system

 

77.  ______ is not the operation that can be performed on queue.

a.     Insertion

b.    Deletion

c.      Retrieval

d.    Traversal

 

 

78.  What is the need for a circular queue?

a.     Effective usage of memory

b.    Easier computations

c.      To delete elements based on priority

d.    Implement LIFO principle in queues

 

79.  Which among the below specified condition is applicable if the queue is non-empty?

a.     Rear>front

b.    Rear<front

c.      Rear=front

d.    Unpredictable

 

80.  What is the ‘next’ field of structure node in the Queue?

a.     Results into the storage of queue elements

b.    Results into the storage of address of next node by holding the next element of queue

c.      Results into the memory allocation of data elements to next node

d.    Results into the address allocation data elements to next node


81.  Which among the below mentioned entities is/are essential for an array representation of a Queue?

a.     An array to hold queue elements

b.    A variable to hold the index of front element

c.      A variable to hold the index of rear element

d.    All of the above


82.  A linked list is a

a.     Random access structure

b.    Sequential access structure

c.      Both

d.    None of these

 

83.  A linear collection of data elements where the linear node is given by means of pointer is called?

 

a.     Linked list

b.    Node list

c.      Primitive list

d.    Unordered list

 

84.  An empty list is the one which has no ___________________

a.     Nodes

b.    Data

c.      Both (a) and (b)

d.    Address

 

85.  Linked list is used to implement data structures like

a.     Stack

b.    Queues

c.      Trees

d.    All of these

 

86.  Traversal of a linked list always starts from the

a.     First node

b.    Middle node

c.      Last node

d.    None of the above

 

87.  Which term in linked list is used to refer to the situation where one wants to delete data from a data structure that is empty

a.     Overflow

b.    Underflow

c.      Null

d.    Error

 

88.  The pointer of the last node in a linked list contains a special value, called the

a.     Next node pointer

b.    Link field pointer

c.      Null pointer

d.    Node pointer

 

89.  In linked list each node contains a minimum of two fields. One field is data field to store the data, second field is?

a.     Pointer to character

b.    Pointer to integer

c.      Pointer to node

d.    Node

 

90.  In Linked List implementation, a node carries information regarding ___________

a.     Data

b.    Link

c.      Data and Link

d.    Node

 

91.  How many pointers are necessarily changed for the insertion in a linked list ?

a.     One

b.    Two

c.      Three

d.    Five

 

92.  Doubly linked list is especially applicable, for which of the following implementation?

a.     Double ended queue

b.    Linear list of integers

c.      Variable length String Data Structure

d.    All of the above


93.  Which linked list does not store NULL in next field?

a.     Singly linked list

b.    Circular linked list

c.      Doubly linked list

d.    All of these

 

94.  Which type of linked list comprises the adjacently placed first and the last elements?

a.     Singly linked list

b.    Doubly linked list

c.      Circular linked list

d.    All of the above

 

 

95.  A linked list whose last node points back to the first node is called a/an

a.     Doubly linked list

b.    Double ended linked list

c.      Two way list

d.    Circular linked list


96.  Which linked list stores the address of the header node in the next field of the last node?

a.     Singly linked list

b.    Circular linked list

c.      Doubly linked list

d.    Circular header linked list


97.  Which linked list can have four pointers per node

a.     Circular doubly linked list

b.    Multi-linked list

c.      Header linked list

d.    Doubly linked list

 

98.  The use of pointer to refer elements of data structure in which elements are logically adjacent is _________

a.     Pointers

b.    Linked allocation

c.      Stack

d.    Queue

 

99.  Linked lists are not suitable for the implementation of

a.     Insertion sort

b.    Radix sort

c.      Polynomial manipulation

d.    Binary search

 

100.  Which is the most suitable construct utilized for traversing in a Circular linked list?

 

a.     Do-while

b.    While

c.      For

d.    If

101.  Linked list is considered as an example of ___________ type of memory allocation.

 

a.     Dynamic

b.    Static

c.      Compile time

d.    Heap

 

102.  Linked list data structure offers considerable saving in _____

a.     Computational Time

b.    Space Utilization

c.      Space Utilization and Computational Time

d.    Speed Utilization

 

103.  To represent hierarchical relationship between elements, which data structure is suitable?

a.     Dequeue

b.    Priority queue

c.      Tree

d.    graph

 

104.  The maximum number of nodes in a branch of a tree T is called its

a.     Level

b.    Label

c.      Deep

d.    Depth

 

105.  The nodes in a tree with no successors are called

a.     Empty nodes

b.    Null nodes

c.      Terminal nodes

d.    Hash nodes

 

106.  Degree of a leaf node is

a.     0

b.    1

c.      2

d.    3

 

107.  The depth of a root node is

a.     0

b.    1

c.      2

d.    3

108.  What does a node possessing zero degree in trees known as?

a.     Branch node

b.    Root node

c.      Leaf node

d.    Trunk node

109.  Any node is the path from the root to the node is called _____

a.     Successor node

b.    Ancestor node

c.      Internal node

d.    None of the above

 

110.  The number of edges from the node to the deepest leaf is called __________ of the tree.

a.     Height

b.    Depth

c.      Length

d.    MST

 

111.  The number of edges from the root to the node is called _________ of the tree.

a.     Height

b.    Depth

c.      Length

d.    None of the above

 

112.  ____________ is a directed tree in which out degree of each node is less than or equal to two.

a.     Unary tree

b.    Binary tree

c.      Ternary tree

d.    Both (b) and (c)

 

113.  The property of Binary tree _____________

a.     The first subset is called left subtree

b.    The second subtree is called right subtree

c.      The root cannot contain NULL

d.    The right subtree can be empty


114.  Binary trees can have how many children?

a.     2

b.    Any number of children

c.      0 or 1 or 2

d.    0 or 1


115.  What is full binary tree?

a.     Each node has exactly zero or two children

b.    Each node has exactly two children

c.      All the leaves are at the same level

d.    Each node has exactly one or two children

 

116.  Preorder traversal is also called

a.     Depth first

b.    Breadth first

c.      Level order

d.    In-order

 

117.  Which of the following traversal prints the values in ascending order of a binary search tree?

a.     Pre order

b.    In order

c.      Post order

d.    None of the above

 

118.  What is the traversal strategy used in the binary tree?

a.     Depth-first traversal

b.    Breadth-first traversal

c.      Random traversal

d.    Preorder traversal

 

119.  How to travel a tree in linked list representation?

a.     Using post order traversing

b.    Using preorder traversing

c.      Level order traversing

d.    All of the above

 

120.  Visiting root node after visiting left and right subtrees is called

a.     In-order Traversal

b.    Pre-order Traversal

c.      Post-order Traversal

d.    None of the above

 

121.  Which of the following represents the Postorder Traversal of a Binary Tree?

a.     Left -> Right -> Root

b.    Left -> Root -> Right

c.      Right -> Left -> Root

d.    Right -> Root -> Left

 

 

122.  A binary tree of height h has at least h nodes and at most  _________ nodes

a.     2h

b.    2h

c.      2 h+1

d.    2 h-1

 

123.  The number of nodes at the nth level of a binary tree is

a.     2 n

b.    2n

c.      2 n+1

d.    2 n-1

 

124.  Total number of nodes in the nth level of a binary tree is given by

a.     2n

b.       2n-1

c.        2n+1

d.    2n

 

125.  How many binary trees can be created with 3 nodes?

a.     5

b.    6

c.      7

d.    None of the above

 

126.  The data structure required for Breadth First Traversal on a graph is?

a.     Stack

b.    Array

c.      Queue

d.    Tree

 

127.  A graph without any self loop and parallel edges is called

a.     Complete graph

b.    Simple graph

c.      Acyclic graph

d.    None of the above

 

 

128.  Which data structure is used in breadth first search of a graph to hold nodes?

a.     Stack

b.    Queue

c.      Tree

d.    Array

 

129.  Which of the following is data structure is used in Depth First Search?

a.     Stack

b.    Queue

c.      Array

d.    Tree

 

130.  Which of the following ways can be used to represent a graph?

a.     Adjacency List and Adjacency Matrix

b.    Incidence Matrix

c.      Adjacency List, Adjacency Matrix as well as Incidence Matrix

d.    No way to represent

 

131.  How many nested loops are present in Prim’s algorithm?

a.     Two

b.    Three

c.      Four

d.    Infinite


132.  Which of the following rotation is called double rotation?

a.     LR

b.    RL

c.      Both (a) and (b)

d.    None of the above

 

133.  What is the value of the postfix expression 6 3 2 4 + – *?

a.     1

b.    40

c.      74

d.    -18

 

134.  Which of the following is the postfix expression for the infix expression?

(a+b) * (c-d) 

 

a.     ab + cd – *

b.    abcd + - *

c.      ab * cd + -

d.    ab – cd + *

 

135.  The postfix form of the expression (A+ B)*(C*D- E)*F / G is

a.     AB+ CD*E – FG /**

b.    AB + CD* E – F **G /

c.      AB + CD* E – *F *G /

d.    AB + CDE * – * F *G /

                       

136.  The postfix form of A*B+C/D is

a.     *AB/CD+

b.    AB*CD/+

c.      A*BC+/D

d.    ABCD+/*

 

137.  The prefix form of A-B/ (C * D ^ E) is

a.      -/*^ACBDE

b.     -ABCD*^DE

c.      -A/B*C^DE

d.    -A/BC*^DE

 

138.  What is the result of the following operation?


Top (Push (S, X))

 

a.     X

b.    X+S

c.      S

d.    XS

 

139.  The post fix equivalent of the prefix    * + ab – cd  _________

a.     ab + cd - *

b.    abcd + - *

c.      ab + cd * -

d.    ab + - cd *

 

140.  The prefix form of an infix expression (p + q) – (r * t) is

a.     + pq – *rt

b.    – +pqr * t

c.      – +pq * rt

d.    – + * pqrt

 

141.  The result of evaluating the postfix expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is

 

a.     600

b.    350

c.      650

d.    588

 

142.  Convert the following infix expressions into its equivalent postfix expressions.

 

(A + B D)/(E – F)+G

 

a.     (A B D + E F – / G +)

b.    (A B D + E F – / G +)

c.      (A B D + E F/- G +)

d.    (A B D E F + / – G +)

 

 

143.  Convert the following Infix expression to Postfix form using a stack.
x + y * z + (p * q + r) * s, Follow usual precedence rule and assume that the expression is legal.


a.     xyz*+pq*r+s*+

b.    xyz*+pq*r+s+*

c.       xyz+*pq*r+s*+

d.    xyzp+**qr+s*+

 

 

144.  Assume that the operators +,-, X are left associative and ^ is right associative. The order of precedence (from highest to lowest) is ^, X, +, -. The postfix expression for the infix expression a + b X c – d ^ e ^ f is

 

a.     abc X+ def ^^ –

b.    abc X+ de^f^ –

c.      ab+c Xd – e ^f^

d.    -+aXbc^ ^def

 

145.  If the elements “A”, “B”, “C” and “D” are placed in a stack and are deleted one at a time, what is the order of removal?

a.     ABCD

b.    DCBA

c.      DCAB

d.    ABDC

 

146.  In Reverse Polish notation, expression A*B+C*D is written as

a.     AB*CD*+

b.    A*BCD*+

c.      AB*CD+*

d.    A*B*CD+

 

147.  If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted one at a time, in what order will they be removed?

a.     ABCD

b.    DCBA

c.      DCAB

d.    ABDC

 

 

Algorithm:

 

148.  The step by step procedure for calculation is called _________

a.      Program

b.    Algorithm

c.      Greedy method

d.     Problem

 

149.  Which of the following is not a control structure used in algorithm?

a.     Sequence logic

b.    Selection logic

c.      Iteration logic

d.    Procedure logic

 

150.  Two main measures for the efficiency of the algorithm are :

a.      Processor and memory

b.     Complexity and capacity

c.      Time and space

d.     Data and space

 

151.  The amount of time needs to run to completion is known as __

a.      Space complexity

b.     Worst case

c.      Best case

d.    Time complexity

 

152.  The __________ of an algorithm is the amount of memory it needs to run to completion.

a.     Space complexity

b.     Time complexity

c.      Worst case

d.     Best case

 

153.  Graphical representation of algorithm is  __________

a.     Flow chart

b.     Graph

c.      Pseudo-code

d.     Dynamic programming

 

154.  Which from the following is not a criteria of algorithm ?

a.      Input

b.     Output

c.      Time complexity

d.    Best case

 

155.  In algorithm comments begin with __________

a.      /*

b.     /

c.      */

d.    //

 

156.  In algorithm specification the blocks are indicated with matching ______

a.     Braces

b.     Square brackets

c.      Parenthesis

d.     Slashes

 

157.  Which of the following case does not exist in complexity theory?

a.      Best case

b.     Average case

c.      Worst case

d.    Null case

 

158.  An algorithm that calls itself directly or indirectly is known as 

a.      Sub algorithm

b.     Polish notation

c.      Recursion

d.     Traversal algorithm

 

159.  The asymptotic notation for defining the average time complexity is 

a.     Equivalence

b.     Symmetric

c.      Reflexive

d.     Both b and c

 

160.  What term is used to describe an O(n) algorithm?

a.      Constant

b.     Non-polynomial deterministic

c.      Logarithmic

d.    Linear

 

161.  O(1) means computing time is ___________

a.     Constant

b.     Quadratic

c.      Linear

d.     Cubic

 

162.  O(n2)   means computing time is ___________

a.      Constant

b.    Quadratic

c.      Linear

d.     Cubic

 

163.  O(2n)  means computing time is ____________

a.      Constant

b.    Exponential

c.      Quadratic

d.     Linear


164.  Big ‘O’ gives

a.     Upper bound

b.    Lower bound

c.      Tight bound

d.    All of the above

 

165.  Consider a situation where SWAP operation is very costly. Which of the following sorting algorithm should be preferred so that numbers of SWAP are minimized in general?

a.      Heap sort

b.     Insertion sort

c.      Selection sort

d.     Merge sort

 

166.  The worst case series for insertion sort algorithm is

a.      O(n)

b.    O(n2)

c.      O(log n)

d.     O(n log n)

 

167.  In which sorting, consecutive adjacent pairs of element in the assay are compared with each other?

a.     Bubble sort

b.    Selection sort

c.      Merge sort

d.    Radix sort

 

168.  The complexity of Bubble sort is ___________

a.     O(n)

b.    O(log n)

c.      O(n2)

d.    O(n log n)

 

169.  The average case occur in an algorithm of linear search 

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 item in the array

d.     When the item is the last element in the array or it is not there at all

 

170.  The complexity of a linear search algorithm is

a.      n+1/2

b.     n-1/2

c.      n/2

d.    n


171.  The search algorithm which begins at a node A and then examines all the neighbors of node A is called

a.     Linear search

b.     Binary search

c.      Depth-first search

d.     Breadth-first search

 

172.  The time complexity of binary search is _________

a.      O(1)

b.    O(log n)

c.      O(n)

d.     On(log n)

 

173.  The complexity of binary search algorithm is _________

a.      O(n)

b.     O(n2)

c.      O(n log n)

d.    O(log n)


174.  Which one of following is a condition that must be satisfied for binary search to work?

a.     The list must be short

b.    The list must be numeric

c.      The list must be sorted

d.    The list must have even number of elements





Post a Comment

0 Comments