CS301 Data Structures Past Paper PDF 2010

Summary

This document is a past paper from 2010 for CS301 Data Structures, containing multiple-choice questions for a mid-term exam. Topics include various data structures, algorithms, and computer science concepts.

Full Transcript

CS301 - Data Structures: Latest Solved MCQs from Midterm Papers Midterm Examination Spring 2010 Question No: 1 (Marks: 1) A queue where the de-queue operation depends not on FIFO is called a priority queue: ► False ► True Question No: 2 (Marks: 1) The data of the problem is 2GB and the hard disk...

CS301 - Data Structures: Latest Solved MCQs from Midterm Papers Midterm Examination Spring 2010 Question No: 1 (Marks: 1) A queue where the de-queue operation depends not on FIFO is called a priority queue: ► False ► True Question No: 2 (Marks: 1) The data of the problem is 2GB and the hard disk is 1GB capacity; to solve this problem we should: ► Use better data structures ► Increase the hard disk space ► Use the better algorithm ► Use as much data as we can store on the hard disk Question No: 3 (Marks: 1) Consider the function int X(int& Value) { return Value; }. Which one of the following is a valid call to the function X? ► a = X(b); ► a = X(&b); ► a = X(*b); ► None of the given options Question No: 4 (Marks: 1) In the call by value methodology, a copy of the object is passed to the called function: ► False ► True Question No: 5 (Marks: 1) The tree data structure is: ► Linear data structure ► Non-linear data structure ► Graphical data structure ► Data structure like queue Question No: 6 (Marks: 1) When should you use a const reference parameter? ► Whenever the parameter has huge size. ► 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. ► 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. ► Whenever the parameter has huge size, and the function does not change the parameter within its body. Question No: 7 (Marks: 1) Which of the three member functions can alter the PRIVATE member variables of the foo object that activates the function? ► Only x can alter the private member variables of the object that activates the function. ► Only y can alter the private member variables of the object that activates the function. ► Only z can alter the private member variables of the object that activates the function. ► Two of the functions can alter the private member variables of the object that activates the function. Question No: 8 (Marks: 1) What is the maximum depth of recursive calls a function may make? ►1 ►2 ► n (where n is the argument) ► There is no fixed maximum Question No: 9 (Marks: 1) If n is the number of nodes in a complete Binary Tree, then the maximum steps required for a search operation are: ► Log2(n+1) - 1 ► Log2(n+1) ► Log2(n) - 1 ► Log2(n) Question No: 10 (Marks: 1) In the linked list implementation of the stack class, where does the push member function place the new entry on the linked list? ► At the head ► At the tail ► After all other entries that are greater than the new entry. ► After all other entries that are smaller than the new entry. Question No: 11 (Marks: 1) Where does the push member function place the new entry in the circular array implementation of the queue class, with ten items in the queue stored at data through data and CAPACITY is 42? ► data ► data ► data ► data Question No: 12 (Marks: 1) The expression AB+C* is called: ► Prefix expression ► Postfix expression ► Infix expression ► None of these Question No: 13 (Marks: 1) ___ is a binary tree where every node has a value, every node's left subtree contains only values less than or equal to the node's value, and every node's right subtree contains only values that are greater than or equal? ► Strictly Binary Tree ► Binary Search Tree ► AVL tree ► All of these Question No: 14 (Marks: 1) If node A in the BST is deleted, which two nodes are the candidates to take its place? ► J and I ► H and E ► D and E ► L and M Question No: 15 (Marks: 1) What is correct about the insertion cases in an AVL tree? ► Single rotation can fix the balance in the cases of left-left or right-right. ► Single rotation cannot fix the balance in these cases. Question No: 16 (Marks: 1) We access elements in AVL Tree in: ► Linear way only ► Non-linear way only ► Both linear and non-linear ways Question No: 17 (Marks: 2) AVL Tree is: ► Non-linear data structure ► Linear data structure ► Hybrid data structure (Mixture of linear and non-linear) Midterm Examination Spring 2009 Question No: 1 (Marks: 1) Which one of the following is a valid postfix expression? ► ab+cd- ► abc+d- ► abc+d- ► (abc)+d- Question No: 2 (Marks: 1) The tree data structure is: ► Linear data structure ► Non-linear data structure ► Graphical data structure ► Data structure like queue Question No: 3 (Marks: 1) A Compound Data Structure is the data structure which can have multiple data items of the same type or of different types. Which of the following can be considered a compound data structure? ► Arrays ► LinkLists ► Binary Search Trees ► All of the given options Question No: 4 (Marks: 1) Suppose a pointer has been declared in main but has not assigned any variable address, then: ► That pointer points to the first byte in the main function ► That pointer contains a NULL value ► None of these ► That pointer points to any memory address Question No: 5 (Marks: 1) Here is the start of a C++ class declaration: class foo { public: void x(foo f); void y(const foo f); void z(foo f) const;... Which of the three member functions can alter the PRIVATE member variables of the foo object that activates the function? ► Only x can alter the private member variables of the object that activates the function. ► Only y can alter the private member variables of the object that activates the function. ► Only z can alter the private member variables of the object that activates the function. ► Two of the functions can alter the private member variables of the object that activates the function. Question No: 6 (Marks: 1) The operation for removing an entry from a stack is traditionally called: ► delete ► peek ► pop ► remove Question No: 7 (Marks: 1) Which statement of the following statements is incorrect? ► Lists can be implemented by using arrays or linked lists ► A list is a sequence of one or more data items ► Stack is a special kind of list in which all insertions and deletions take place at one end ► Stacks are easier to implement than lists Question No: 8 (Marks: 1) Parameters in function calls are passed using: ► Stack ► Queue ► Binary Search Tree ► AVL Tree Question No: 9 (Marks: 1) Consider the following sequence of push operations in a stack: stack.push('7'); stack.push('8'); stack.push('9'); stack.push('10'); stack.push('11'); stack.push('12'); ► 7 8 9 10 11 12 ► 9 8 11 10 7 12 ► 9 10 8 11 12 7 ► 9 10 8 12 7 11 Question No: 10 (Marks: 1) What is the maximum depth of recursive calls a function may make? ►1 ►2 ► n (where n is the argument) ► There is no fixed maximum Question No: 11 (Marks: 1) Consider the following function: cpp Copy code void test_a(int n) { cout nextNode; Question No: 6 (Marks: 1) Which one of the following statements is NOT correct? ► In a linked list, the elements are necessarily contiguous ► In a linked list, the elements may locate at far positions in the memory ► In a linked list, each element also has the address of the element next to it ► In an array, the elements are contiguous Question No: 7 (Marks: 1) Each operator in a postfix expression refers to the previous __ operand(s): ► One ► Two ► Three ► Four Question No: 8 (Marks: 1) Which one of the following calling methods does not change the original value of the argument in the calling function? ► None of the given options ► Call by passing the value of the argument ► Call by passing reference of the argument ► Call by passing the address of the argument Question No: 9 (Marks: 1) A binary search tree should have a minimum of one __ node/s at each level: ► One ► Two ► Three ► Four Question No: 10 (Marks: 1) Which of the following is "TRUE" about arrays? ► We can increase the size of arrays after their creation. ► We can decrease the size of arrays after their creation. ► We can increase but can't decrease the size of arrays after their creation. ► We can neither increase nor decrease the array size after their creation. Question No: 11 (Marks: 1) Searching for an element in an AVL tree takes a maximum of: ► Log2(n+1) time (where n is the number of nodes) ► Log2(n+1) - 1 ► 1.44 Log2(n) ► 1.66 Log2(n) Question No: 12 (Marks: 1) There is/are case/s for rotation in an AVL tree: ►1 ►2 ►3 ►4 Question No: 13 (Marks: 1) Consider the following statements regarding binary trees: (i) A binary tree can contain at least 2^L Nodes at level L. (ii) A complete binary tree of depth d is a binary tree that contains 2^L Nodes at each level L between 0 and d, both inclusive. (iii) The total number of nodes (Tn) in a complete binary tree of depth d is 2^(d+1) - 1. (iv) The height of the complete binary tree can be written as h = log2(Tn + 1) - 1 where Tn is the Total number of Nodes. Which one of the following is correct in respect of the above statements regarding binary trees? ► (i) and (iii) only ► (i), (ii) and (iii) only ► (ii) and (iii) only ► (ii), (iii) and (iv) only Question No: 14 (Marks: 1) Consider the following infix expression: 5 + 6/2. If one converts the above expression into postfix, what would be the resultant expression? ► 56/ + ►562/+ ►56/2+ ► /62 + 5 Question No: 15 (Marks: 1) Which of the following is a non-linear data structure? ► Linked List ► Stack ► Queue ► Tree Question No: 16 (Marks: 1) “+” is a ___ operator: ► Unary ► Binary ► Ternary ► None of the above CS301 - Data Structures: Additional Questions 1. Addition of new items in a stack makes the pointer ______________ by 2: a. Increment, bits b. Increment, bytes c. Decrement, bits d. Decrement, bytes 2. The next item in a linked list is known as: a. Index b. Item c. Node d. Child 3. What will be the postfix notation of 5 + 6 / 2? a. 56+/2 b. 562+/ c. 562/+ d. 5+62/ 4. In an AVL tree, to delete a parent with two children in a straight line, the following rotations will be required: a. Single b. Double c. Triple d. None 5. To check the depth of an AVL tree, the following time will be taken: a. 1.66 Log2n b. 1.44 Log2n c. Log2(n + 1) - 1 d. 1.66 Log2(n + 1) 6. BST is a structure: a. Linear b. Non-linear c. Circular d. None of the above 7. After the creation of an array: a. Size can be increased but cannot be decreased. b. Size can be decreased but cannot be increased. c. Size can neither be increased nor decreased. d. Size can be increased and can also be decreased. 8. Each node in a BST has: a. 1 pointer b. 2 pointers c. 3 pointers d. 4 pointers 9. The highest operator precedence is of the following operator: a. Plus b. Minus c. Multiply d. Exponentiation 10. Following are the linear data structures: a. Stacks b. Queues c. Both a & b d. None of the above 11. Each entry which points to a null value in a singly linked list is known as: a. Node b. First Node c. Last Node d. Head Node 12. Non-recursive calls are faster than recursive calls: a. True b. False 13. A tree data structure is: a. Linear b. Non-linear c. Circular d. None of the above 14. What will be the valid postfix notation of A + B * C - D? a. ABC+D- b. ABC+D- c. ABCD+-* d. AB+D*C 15. When an operator is used between two operands, this is which type of notation? a. Prefix b. Postfix c. Infix d. None of the above Midterm Examination Spring 2009 Question No: 1 (Marks: 1) Which one of the following is a valid postfix expression? ► ab+cd- ► abc+d- ► abc+d- ► (abc)+d- Question No: 2 (Marks: 1) The tree data structure is a: ► Linear data structure ► Non-linear data structure ► Graphical data structure ► Data structure like queue Question No: 3 (Marks: 1) A Compound Data Structure is the data structure which can have multiple data items of the same type or of different types. Which of the following can be considered a compound data structure? ► Arrays ► LinkLists ► Binary Search Trees ► All of the given options Question No: 4 (Marks: 1) Suppose a pointer has been declared in main but has not assigned any variable address, then: ► That pointer points to the first byte in the main function ► That pointer contains a NULL value ► None of these ► That pointer points to any memory address Question No: 5 (Marks: 1) Here is the start of a C++ class declaration: cpp Copy code class foo { public: void x(foo f); void y(const foo f); void z(foo f) const;... } Which of the three member functions can alter the PRIVATE member variables of the foo object that activates the function? ► Only x can alter the private member variables of the object that activates the function. ► Only y can alter the private member variables of the object that activates the function. ► Only z can alter the private member variables of the object that activates the function. ► Two of the functions can alter the private member variables of the object that activates the function. Question No: 6 (Marks: 1) The operation for removing an entry from a stack is traditionally called: ► delete ► peek ► pop ► remove Question No: 7 (Marks: 1) Which statement of the following statements is incorrect? ► Lists can be implemented by using arrays or linked lists ► A list is a sequence of one or more data items ► Stack is a special kind of list in which all insertions and deletions take place at one end ► Stacks are easier to implement than lists Question No: 8 (Marks: 1) Parameters in function calls are passed using: ► Stack ► Queue ► Binary Search Tree ► AVL Tree Question No: 9 (Marks: 1) Consider the following sequence of push operations in a stack: cpp Copy code stack.push('7'); stack.push('8'); stack.push('9'); stack.push('10'); stack.push('11'); stack.push('12'); ► 7 8 9 10 11 12 ► 9 8 11 10 7 12 ► 9 10 8 11 12 7 ► 9 10 8 12 7 11 Question No: 10 (Marks: 1) What is the maximum depth of recursive calls a function may make? ►1 ►2 ► n (where n is the argument) ► There is no fixed maximum Question No: 11 (Marks: 1) Consider the following function: cpp Copy code void test_a(int n) { cout

Use Quizgecko on...
Browser
Browser