T4Tutorials .PK

VU Past Papers CS301 – MID TERM MEGA FILE – DATA STRUCTURES & C++ MCQs

MID TERM MEGA FILE – DATA STRUCTURES & C++ MCQs
Q1: Which one of the following statements is NOT correct?
(A) In linked list the elements are necessarily to be contiguous
(B) In linked list the elements may locate at far positions in the memory
(C) In linked list each element also has the address of the element next to it
(D) In an array the elements are contiguous
Answer: (A) In linked list the elements are necessarily to be contiguous

Q2: Suppose currentNode refers to a node in a linked list. What statement changes currentNode so that it refers to the next node?
(A) currentNode ++;
(B) currentNode = nextNode;
(C) currentNode += nextNode;
(D) currentNode = currentNode->nextNode;
Answer: (D) currentNode = currentNode->nextNode

Q3: A queue where the dequeue operation does not depend on FIFO is called a priority queue
(A) False
(B) True
Answer: (B) True

Q4: Which one is a self-referential data type?
(A) Stack
(B) Queue
(C) Link list
(D) All of these
Answer: (C) Link list

Q5: Each node in doubly linked list has,
(A) 1 pointer
(B) 2 pointers
(C) 3 pointers
(D) 4 pointers
Answer: (B) 2 pointers

Q6: Queue insertion into an EMPTY queue (with front and rear pointers)
(A) Neither changes
(B) Only front pointer changes
(C) Only rear pointer changes
(D) Both change
Answer: (D) Both change

Q7: How many nodes have at least one sibling?
(A) 8
(B) 7
(C) 5
(D) 6
Answer: (B) 7

Q8: The nodes with no successor are called
(A) Root Nodes
(B) Leaf Nodes
(C) Both of these
(D) None of these
Answer: (B) Leaf Nodes

Q9: AVL Tree is
(A) Non Linear data structure
(B) Linear data structure
(C) Hybrid data structure (Mixture of Linear and Non Linear)
(D) None of the given options
Answer: (A) Non Linear data structure

Q10: We access elements in AVL Tree in
(A) Linear way only
(B) Non Linear way only
(C) Both linear and non linear ways
(D) None of the given options
Answer: (B) Non Linear way only

Q11: A binary search tree should have minimum of node/s at each level
(A) One
(B) Two
(C) Three
(D) Four
Answer: (A) One

Q12: Correct statements regarding Binary Trees
(A) (i) and (iii) only
(B) (i), (ii) and (iii) only
(C) (ii), (iii) and (iv) only
(D) (ii) and (iii) only
Answer: (C) (ii), (iii) and (iv) only

Q13: “+” is a
(A) Unary
(B) Binary
(C) Ternary
(D) None of the above
Answer: (B) Binary

Q14: Data of 2GB with 1GB disk
(A) Use better data structures
(B) Increase the hard disk space
(C) Use the better algorithm
(D) Use as much data as we can store on the hard disk
Answer: (D) Use as much data as we can store on the hard disk

Q15: Valid call to function int X(int& Value)
(A) a = X(b);
(B) a = X(&b);
(C) a = X(*b);
(D) None of the given options
Answer: (A) a = X(b);

Q16: In call by value methodology, a copy of the object is passed
(A) False
(B) True
Answer: (B) True

Q17: The tree data structure is a
(A) Linear data structure
(B) Non-linear data structure
(C) Graphical data structure
(D) Data structure like queue
Answer: (B) Non-linear data structure

Q18: When should you use a const reference parameter?
(A) Whenever the parameter has huge size
(B) Whenever the parameter has huge size, the function changes the parameter within its body, and you do NOT want these changes to alter the actual argument
(C) Whenever the parameter has huge size, the function changes the parameter within its body, and you DO want these changes to alter the actual argument
(D) Whenever the parameter has huge size, and the function does not change the parameter within its body
Answer: (D) Whenever the parameter has huge size, and the function does not change the parameter within its body

Q19: Which member function can alter private member variables of the activating object?
(A) Only x
(B) Only y
(C) Only z
(D) Two of the functions
Answer: (A) Only x

Q20: Maximum depth of recursive calls a function may make
(A) 1
(B) 2
(C) n (where n is the argument)
(D) There is no fixed maximum
Answer: (D) There is no fixed maximum

Exit mobile version