0

Data Structure (NCO)

Description: This test contains basics of data structures.
Number of Questions: 31
Created by:
Tags: Data Structure DS Stack Queue Tree Graph Linkedlist Data Structures
Attempted 0/31 Correct 0 Score 0

Which of the following is not a type of linear data structure?

  1. Array

  2. Graph

  3. Linked List

  4. Stack

  5. Queue


Correct Option: B
Explanation:

Graph is a non-linear data structure where data is stored in hierarchical form.

A set of values (carrier set) and operations on those values is called a/an

  1. data type

  2. abstract data type

  3. data set

  4. data structure

  5. identifier


Correct Option: B
Explanation:

A set of values (carrier set) and operations on those values is called Abstract Data type (ADT). Example: For Boolean ADT carrier set is {True, False} and negation, conjunction, etc. are operations on it.

Which of the following statements is not true about a stack data structure?

  1. In a stack, data is stored from only one side. It is called 'top of stack'.

  2. At a time only one item can be inserted or deleted in a stack.

  3. In a stack, after insertion operation, the value of top is decremented.

  4. Stack is a linear data structure.

  5. Stack is called LIFO [last in first out].


Correct Option: C
Explanation:

It is not a true statement about a stack. Since in a stack after insertion operation, the value of top is incremented.

What is the name of a deletion operation in a stack?

  1. Push operation

  2. Pop operation

  3. Empty operation

  4. Dequeue operation

  5. Enqueue operation


Correct Option: B
Explanation:

Pop operation is the name of deletion operation in a stack, which pop or delete items from the stack.

Which of the following is not true about a queue data structure?

  1. In a queue, data is inserted from the front end of the queue.

  2. In a queue after insertion and deletion operations, value of front end and rear end is incremented, respectively.

  3. Queue is called FIFO [First in first out].

  4. At a time, only one item can be inserted or deleted in a queue.

  5. Queue is a linear data structure.


Correct Option: A
Explanation:

This is a wrong answer. Since in a queue, data is inserted from the rear end of the queue and is deleted from the front end of the queue.

An arrangement of data in memory locations to represent values of carrier set of abstract data type is called a/an

  1. assertion

  2. container

  3. structure

  4. data structure

  5. array


Correct Option: D
Explanation:

An arrangement of data in memory locations to represent values of carrier set of abstract data type is called data structure.

Accessing each record/node exactly once, so that certain items in the record may be processed is called a/an

  1. insertion operation

  2. deletion operation

  3. search operation

  4. traversing operation

  5. sorting operation


Correct Option: D
Explanation:

Accessing each item exactly once, so that certain items in the record may be processed is called a traversing operation.

Reverse polish notation form is also called

  1. infix form

  2. prefix form

  3. postfix form

  4. suffix form

  5. polish notation


Correct Option: C
Explanation:

Reverse polish notation form is also called a postfix form where the operator is placed after two operands.

A data structure in which elements may be added to or deleted from the front or the rear is called a

  1. queue

  2. dequeue

  3. priority queue

  4. circular queue

  5. stack


Correct Option: B
Explanation:

Dequeue is a data structure in which elements may be added to or deleted from the front or the rear.

Which of the following statements is not correct about binary search tree?

  1. Values of in the left subtree are less than root.

  2. Values of in the right subtree are greater than or equal to the root.

  3. Each subtree is itself a binary search tree.

  4. They do not have a recursively defined data structure.

  5. The nodes at the lowest levels of the tree are known as leaves.


Correct Option: D
Explanation:

This is the wrong answer since they have a recursively defined data structure.

In an empty stack, perform the following operations: push (A), push (B), push (C), pop, pop, push (D), push (E), pop. What is the value of the top of the stack?

  1. D

  2. A

  3. B

  4. C

  5. E


Correct Option: A
Explanation:

It is the right answer. According to the given operations, first push A, then B and C. After that, perform the pop operation two times. This will delete B and C. Now again, push D and E, at last perform the pop operation, which deletes the last inserted item E. Now, the value of the top of the stack is D.

Which sorting algorithm is pivot used for?

  1. Insertion sort

  2. Quick sort

  3. Selection sort

  4. Bubble sort

  5. Binary search


Correct Option: B
Explanation:

It is a right answer since it is based on 'divide and conquer' method, which requires a middle element. Pivot is used for this.

In any type of data structure, overflow condition occurs when

  1. any element is inserted into the data structure

  2. any element is deleted from the data structure

  3. a data structure is empty and you are trying to delete any element from it

  4. a data structure is full and you are trying to insert any element into it

  5. a data structure is half empty


Correct Option: D
Explanation:

This is the right operation. This condition is called overflow.

Which of the following is a correct prefix notation of given expression "A + B * C"?

  1. +AB+C

  2. +A*BC

  3. ABC*+

  4. +AB*C

  5. +A+BC


Correct Option: B
Explanation:

It is the correct prefix notation. Here, in the given expression, "A + B * C", * has a higher priority +. * is between B and C, so it placed after BC, then + is placed after it, so we get  "+ A * BC".

What will be the value of the postfix expression 10, 5, 1, +, +, 4, /?

  1. 4

  2. 20

  3. 64

  4. 12

  5. 1


Correct Option: A
Explanation:

This is the correct answer. We calculate it using stack; we push operands into stack and when an operator will come, then push top two elements and perform the necessary operation. According to this, we get 10 -> 105 -> 10, 51 -> 10, 5, 1+ -> 10, 6+ -> 164 -> 16, 4/ -> 4. This is the final value.

The maximum number of child nodes in a B-tree is

  1. 2

  2. 0

  3. 1

  4. m

  5. 4


Correct Option: D
Explanation:

The maximum number of child nodes in a B-tree is m since B-tree is a balanced m-way search tree, not a binary tree.

A type of Linked list where the pointer in the last node points back to the first node is called a

  1. singly linked list

  2. circular singly linked list

  3. doubly linked list

  4. circular doubly linked list

  5. header linked list


Correct Option: B
Explanation:

Circular singly linked list is a linked list where the pointer in the last node points back to the first node.

Find out the postorder traversal of the binary tree if the preorder traversal is I J K L M N and inorder traversal is K J I M L N.

  1. K J I N M L

  2. K J M N L I

  3. M N L K J I

  4. N M K L J I

  5. N M L K I J


Correct Option: B
Explanation:

This is the correct postorder traversal of the binary tree. Here, we first create the tree using preorder and inorder traversal. Then, find out postorder traversal. First select root from the given preorder that is I. Now, select its left subtree nodes and the right subtree nodes from inorder. We continue to apply this process until all nodes are not finished.

Find out the preorder traversal of the binary tree if the postorder traversal is S T Q U R P and inorder traversal is S Q T P R U.

  1. P Q S T R U

  2. P Q R S T U

  3. P Q S R U T

  4. Q S T P R U

  5. P Q S R T U


Correct Option: A
Explanation:

This is the correct preorder traversal of the binary tree. Here, we first create the tree using postorder and inorder traversals. Then, find out the preorder traversal. First select root from given postorder that is P, now select its left subtree [LST] nodes and right subtree [RST] nodes from inorder. The LST node of root P is S Q T and RST nodes of P is R U. Now, take S Q T and apply the same process. Here, we get root node Q from postorder [S T Q] and its LST and RST nodes from inoder [S Q T]. Similary, we take R U and apply the same process. Here, we get root node R from postorder [U R] and its LST and RST nodes from inoder [R U].

Which of the following traversal is used for Graph?

  1. In-order Traversal

  2. Reverse Polish Notation

  3. Pre-order Traversal

  4. Level order traversal

  5. Post-order Traversal


Correct Option: D
Explanation:

It is correct answer.

In which method of hashing function, a key is broken into several parts and each part has the same length as that of the required address except the last part?

  1. Division method

  2. Folding method

  3. Midsquare method

  4. Multiplicative method

  5. Digit analysis


Correct Option: B
Explanation:

In folding method, a key is broken into several parts and each part has the same length as that of the required address except the last part.

What is equivalent reverse polish notation of the given infix notation "P * Q ^ R ^ S + T"?

  1. P Q R S ^ ^ * T +

  2. P Q R S ^ ^ * + T

  3. P Q R ^ S ^ * T +

  4. P Q * R ^ S ^ T +

  5. P Q * R ^ S T + ^


Correct Option: A
Explanation:

This is correct reverse polish notation.-> P * Q ^ [ R S ^ ] + T-> P * [ Q R S ^ ^ ] + T-> [ P Q R S ^ ^ * ] + T-> P Q R S ^ ^ * T +

Which of the following is not correct about a B-tree?

  1. In a B-tree, each non-leaf node has a maximum of M children keys.

  2. Each node has one fewer key than the number of children with a maximum of M-1 keys.

  3. In a B-tree, each non-leaf node has a minimum of M/2 keys.

  4. In a B-tree, all leaves are not on the same level.

  5. It is also called a balanced m-way search tree.


Correct Option: D
Explanation:

It is an incorrect statement about B-tree. In a B-tree, all leaves are on the same level.

In a tree, a node without parent is called a/an

  1. root node

  2. leaf node

  3. internal node

  4. pendent node

  5. child node


Correct Option: A
Explanation:

Root node is a node without a parent.

In delete operation of a binary tree, the next inorder successor node is replaced when a node has

  1. 0 child or leaf node

  2. 3 child nodes

  3. 1 child node

  4. 2 child node

  5. m child nodes


Correct Option: D
Explanation:

When a node with 2 child nodes is deleted, then it is replaced by its next inorder successor node.

In an expression binary tree, the internal node stores

  1. operands

  2. operators

  3. alphabets

  4. special symbols

  5. functions


Correct Option: B
Explanation:

In an expression binary tree, the internal node stores operators.

Collection of trees is known as ________?

  1. Group of trees

  2. Super-trees

  3. General trees

  4. Forest

  5. Sub-trees


Correct Option: D
Explanation:

Collection of trees is known as Forest.

In a tree, the number of direct children of any node is called

  1. branching factor

  2. height of tree

  3. depth of a node

  4. degree of node

  5. path length


Correct Option: D
Explanation:

Degree of node is the number of direct children of the given node.

Minimum spanning tree is the application of which data structure?

  1. Tree

  2. Graph

  3. Linked list

  4. Stack

  5. Queue


Correct Option: B
Explanation:

Graph is used for finding minimum spanning tree.

Which of the following is incorrect about a full binary tree?

  1. In a non-empty full binary tree, T has I internal nodes, then the total number of nodes is N = 2I + 1 and number of leaves is L = I + 1.

  2. If full binary tree T has a total of N nodes, the number of internal nodes is I = (N + 1)/2.

  3. In a non-empty full binary tree, T has I internal nodes, then the number of leaves is L = I + 1.

  4. If T has L leaves, the total number of nodes is N = 2L – 1.

  5. If T has L leaves, the number of internal nodes is I = L – 1.


Correct Option: B
Explanation:

It is an incorrect statement since if full binary tree T has a total of N nodes, the number of internal nodes is I = (N – 1)/2. And the number of internal nodes is I = (N + 1)/2.

A type of binary tree in which all levels except possibly the last are full, and the last level has all its nodes to the left side is called a

  1. full binary tree

  2. complete binary tree

  3. skewed binary tree

  4. binary search tree

  5. B-tree


Correct Option: B
Explanation:

Complete bianry tree is a type of binary tree in which all levels except possibly the last are full, and the last level has all its nodes to the left side.

- Hide questions