CS301 Data Structures Past Paper PDF

Summary

This document contains a past paper for a CS301 Data Structures course, specifically the Spring 2010 midterm exam. The paper features multiple-choice questions covering topics like data structures, algorithms, and programming concepts.

Full Transcript

Here’s the corrected numerical formatting for the questions in your document: 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 ► Tr...

Here’s the corrected numerical formatting for the questions in your document: 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: 4o mini You said: merge numbering ChatGPT said: ChatGPT Here’s the complete document with the numbering merged across both midterm examinations for a seamless flow: 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: 18 (Marks: 1) Which one of the following is a valid postfix expression? ► ab+cd- ► abc+d- ► abc+d- ► (abc)+d- Question No: 19 (Marks: 1) The tree data structure is: ► Linear data structure ► Non-linear data structure ► Graphical data structure ► Data structure like queue Question No: 20 (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: 21 (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: 22 (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: 23 (Marks: 1) The operation for removing an entry from a stack is traditionally called: ► delete ► peek ► pop ► remove Question No: 24 (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: 25 (Marks: 1) Parameters in function calls are passed using: ► Stack ► Queue ► Binary Search Tree ► AVL Tree Question No: 26 (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: 27 (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: 28 (Marks: 1) Consider the following function: cpp Copy code void test_a(int n) { cout nextNode; Question No: 39 (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: 40 (Marks: 1) Each operator in a postfix expression refers to the previous __ operand(s): ► One ► Two ► Three ► Four Question No: 41 (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: 42 (Marks: 1) A binary search tree should have a minimum of one __ node/s at each level: ► One ► Two ► Three ► Four Question No: 43 (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: 44 (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: 45 (Marks: 1) There is/are case/s for rotation in an AVL tree: ►1 ►2 ►3 ►4 Question No: 46 (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: 47 (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: 48 (Marks: 1) Which of the following is a non-linear data structure? ► Linked List ► Stack ► Queue ► Tree Question No: 49 (Marks: 1) “+” is a ___ operator: ► Unary ► Binary ► Ternary ► None of the above CS301 - Data Structures: Additional Questions Question No: 50 (Marks: 1) Addition of new items in a stack makes the pointer ______________ by 2: ► Increment, bits ► Increment, bytes ► Decrement, bits ► Decrement, bytes Question No: 51 (Marks: 1) The next item in a linked list is known as: ► Index ► Item ► Node ► Child Question No: 52 (Marks: 1) What will be the postfix notation of 5 + 6 / 2? ► 56+/2 ► 562+/ ► 562/+ ► 5+62/ Question No: 53 (Marks: 1) In an AVL tree, to delete a parent with two children in a straight line, the following rotations will be required: ► Single ► Double ► Triple ► None Question No: 54 (Marks: 1) To check the depth of an AVL tree, the following time will be taken: ► 1.66 Log2n ► 1.44 Log2n ► Log2(n + 1) - 1 ► 1.66 Log2(n + 1) Question No: 55 (Marks: 1) BST is a structure: ► Linear ► Non-linear ► Circular ► None of the above Question No: 56 (Marks: 1) After the creation of an array: ► Size can be increased but cannot be decreased. ► Size can be decreased but cannot be increased. ► Size can neither be increased nor decreased. ► Size can be increased and can also be decreased. Question No: 57 (Marks: 1) Each node in a BST has: ► 1 pointer ► 2 pointers ► 3 pointers ► 4 pointers Question No: 58 (Marks: 1) The highest operator precedence is of the following operator: ► Plus ► Minus ► Multiply ► Exponentiation Question No: 59 (Marks: 1) Following are the linear data structures: ► Stacks ► Queues ► Both a & b ► None of the above Question No: 60 (Marks: 1) Each entry which points to a null value in a singly linked list is known as: ► Node ► First Node ► Last Node ► Head Node Question No: 61 (Marks: 1) Non-recursive calls are faster than recursive calls: ► True ► False Question No: 62 (Marks: 1) A tree data structure is: ► Linear ► Non-linear ► Circular ► None of the above Question No: 63 (Marks: 1) What will be the valid postfix notation of A + B * C - D? ► ABC+D- ► ABC+D- ► ABCD+-* ► AB+D*C Question No: 64 (Marks: 1) When an operator is used between two operands, this is which type of notation? ► Prefix ► Postfix ► Infix ► None of the above Midterm Examination Spring 2009 Question No: 65 (Marks: 1) Which one of the following is a valid postfix expression? ► ab+cd- ► abc+d- ► abc+d- ► (abc)+d- Question No: 66 (Marks: 1) The tree data structure is a: ► Linear data structure ► Non-linear data structure ► Graphical data structure ► Data structure like queue Question No: 67 (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: 68 (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: 69 (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: 70 (Marks: 1) The operation for removing an entry from a stack is traditionally called: ► delete ► peek ► pop ► remove Question No: 71 (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: 72 (Marks: 1) Parameters in function calls are passed using: ► Stack ► Queue ► Binary Search Tree ► AVL Tree Question No: 73 (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: 74 (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: 75 (Marks: 1) Consider the following function: cpp Copy code void test_a(int n) { cout

Use Quizgecko on...
Browser
Browser