CS301 MCQS Mid oct2024 Mam Mehwish
CS301 MCQS Mid oct2024 Mam Mehwish
⬜ Dereferencing
⬜ Memory deallocation
⬜ Memory allocation
✅ Referencing
2. ~BinarySearchTree() is a ________----_- .
⬜ Switch case
✅ Constructor
⬜ Destructor
4. Symbol is used when we want to get the value of a variable using pointer.
Past Papers for Mids./Finals are also Available
⬜ ||
⬜ ::
⬜&
5. The _________ symbol is used when we want to get the value of a variable using pointer.
✅*
⬜ ||
⬜ ::
⬜&
⬜ Random choice
⬜ Binary digits
✅ ASCII values
⬜ Memory addresses
7. In which traversal method, the recursive calls can be used to traverse a binary tree?
⬜ FORTRAN
⬜ COBOL
✅ C++
Past Papers for Mids./Finals are also Available
9. A complete binary tree has 63 non-leaf nodes. The number of leaf nodes will be:
⬜ 62
⬜ 64
✅ 65
⬜ 66
10. In the perspective of memory organization every process executing, the second part of the
memory is for ____________ of the program.
✅ Code
⬜ Static Data
⬜ Stack
1. If the elements are "3","5",'1","6", in which order they will be removed from the Queue one by
one?
A) 3156 ✔
B) 3516
C) 6513
D) 6153
2. In the perspective of memory organization, each process is divided into ________ sections.
3. In level-order traversal for Binary Search Tree, ________ data structure is used.
A) Queue ✔
Past Papers for Mids./Finals are also Available
C) Heap
D) Array
A) int
B) float
C) double
5. The ________ symbol is used when we want to get the value of a variable using a pointer.
A) ::
B) ||
C) *
D) & ✔
A) construct
B) new ✔
C) build
D) delete
A) root->setinfo( &x[0] ) ✔
C) root->setinfo( [I] )
go
Copy code
``` 45 / \ 25 75 / \ 15 35 ```
A) 15 25 35 45 75 ✔
B) 25 15 35 45 75
C) 45 25 75 15 35
D) 15 25 35 75 45
10. If the above condition is satisfied (this->left == NULL && this->right == NULL), then the current node
is:
A) Left node
B) Leaf node ✔
C) Right node
D) Root node
1. After deletion of a node from a binary search tree, traversal method should be maintained.
Level order
Postorder
Inorder ✅
Preorder
Past Papers for Mids./Finals are also Available
3. For searching a particular number in Binary Search Tree (if it is not present), the maximum
number of comparisons will be _______ comparison(s) at each level.
1 comparison ✅
4. if( this->left == NULL && this->right == NULL ) If the above condition is satisfied then the
current node is:
Leaf node ✅
Root node
Right node
Left node
5. ~BinarySearchTree( ) is a _.
Switch case
Constructor
Destructor ✅
7. During in-order traversal using recursive calls, if we found a node is NULL. It means this node
will satisfy following condition.
Front end
Rear end ✅
Simulation
Logical
Physical
Conceptual ✅
Event
Register
Variable ✅
1. If the elements are "3", "5", "1", "6", in which order they will be removed from the Queue one by
one?
6513
3516 ✔️
3156
2. Which of the following calling method does not change the original value of the variable passed to a
function as an argument?
3. One should be careful about transient ___ that are stored by reference in data structures.
objects ✔️
function
stack
tree
4. Which of the following operation returns the contents of a binary tree node?
isLeaf(p)
brother(p)
parent(p)
info(p) ✔️
5. For a complete binary tree with n numbers of nodes, the depth is calculated as
loge (n-1) -1
logg (n-1) +1
logz (n+1) -1
loge (n+1) +1 ✔️
6. void traversal (TreeNode treeNode) { if( treeNode != NULL ) { traversal (treeNode->getLeft()); traversal
(treeNode->getRight()); cout << (treeNode->getinfo())<<" } }
Levelorder
Inorder
Postorder ✔️
Preorder
7. Which one of the following case is the most complicated case to delete a node from BST?
Past Papers for Mids./Finals are also Available
No case is complicated
Leaf ✔️
Root
Right
Left
10. Which one is the correct function call for the following function of calculating the cube?
cube(&&num)
cube(*num)
cube(&num)
cube(num) ✔️
1. A complete binary tree has 63 non-leaf nodes. The number of leaf nodes will be:
⬜ 64
⬜ 65
Past Papers for Mids./Finals are also Available
⬜ 63
⬜ incremented
⬜ decremented
✅ destroyed
⬜ preserved
⬜ Stack
⬜ Linked List
⬜ Queue
✅ Tree
class BinarySearchTree;
class BinaryNode {
};
⬜ Binary Declaration
✅ Forward Declaration
5. From Operating System point of view, the recursive function calls are made with the help of:
✅ Stack
Past Papers for Mids./Finals are also Available
⬜ Linked list
6. A binary tree is said to be a ___ binary tree if every non-leaf node in a binary tree has non-empty
left and right subtrees:
⬜ AVL
✅ Strictly
⬜ Perfect
⬜ Complete
⬜ Through max-heap
9. For searching a particular number in Binary Search Tree (if it is not present), the maximum number
of comparisons will be _____ comparison(s) at each level:
✅1
⬜2
Past Papers for Mids./Finals are also Available
⬜n
⬜ .cpp
⬜ .cppp
⬜ .hh
✅ .h
1. ~BinarySearchTree( ) is a
Switch case
Destructor
Constructor ✅
2. If we write functions for recursive and non-recursive inorder traversal method of BST, what
will be the difference between its functions prototypes?
3. All the objects created using ___________ operator have to be destroyed explicitly.
create
construct
build
new ✅
Past Papers for Mids./Finals are also Available
Stack
Static Data
Heap ✅
5. From Operating System point of view, the recursive function calls are made with the help of
Queue
Linked list
Stack ✅
6. From Operating System point of view, the recursive function calls are made with the help of
Queue
Linked list
Stack ✅
&✅
::
Root node
Leaf node ✅
Past Papers for Mids./Finals are also Available
Left node
Stack
Heap ✅
Static
Global
10. A binary tree is said to be a _______ binary tree if every non-leaf node in a binary tree has
non-empty left and right subtrees.
AVL
Perfect
Strictly ✅
Preorder
Inorder
Postorder ✅
Levelorder
1. In the perspective of memory organization, every process executing, the second part of the memory
is for ______ of the program.
Stack ✓
Static Data
Past Papers for Mids./Finals are also Available
Heap
2. When a node to be deleted from a BST has both left and right child, after deletion its ______ will
replace this node.
Inorder successor ✓
Predecessor
Successor
Preorder successor
3. A complete binary tree has 63 non-leaf nodes. The number of leaf nodes will be:
65
62
61
64 ✓
Referencing
Memory allocation
Dereferencing ✓
Memory deallocation
Simulation ✓
Conceptual
Physical
Logical
Past Papers for Mids./Finals are also Available
Preorder ✓
Inorder
Postorder
Sorted order
7. One should be careful about transient ______ that are stored by reference in data structures.
function ✓
stack
tree
8. Which one is the correct function call for the following function of calculating cube?
int cube(int& num)
cube(num) ✓
cube(*num)
cube(&num)
cube(&&num)
O Two pointers
✔ NULL pointer
O One pointer
O No pointer
O Technical
Past Papers for Mids./Finals are also Available
O Logical
✔ Binary
✔ Stack is full
O Stack is empty
If numbers 5, 222, 4, 48 are inserted in a queue, which one will be removed first?
✔5
O 222
O three
O four
✔ one
When add() operation of a linked list is called the following action is done:
O Four
✔ Two
O One
O Three
O ZB+DH-K/~
O ZB+D-H-K/
Past Papers for Mids./Finals are also Available
O ZB+DH-K-/
O current ~ 1 = current
O current = current ~ 2
✔ current = current - 1
O current = current + 1
✔ 12 60 + 23 -
O 12 60 + -23
O +12 60 - 23
O 12+ 60 23 -
o O Technical
o O Unary
o O Logical
o ✔ Binary
o O Prefix
o ✔ Pastfix
o O Infix
o O Postfix
o O Code
o ✔ Time
o O Correctness
Past Papers for Mids./Finals are also Available
o ✔ Last node
o O Empty collection
o O Overflow of stack
o O Garbage collection
o ✔ Underflow of stack
o ✔ One pointer
o O DE + FG */
o O DEF * G / +
o ✔ DE + F * G /
o O DE * F / G +
9. The principal benefit of a linked list over a conventional array is that the order of the linked
items may be _______ from the order that the data items are stored in memory.
o ✔ Different
o O Same
o O Equivalent
o O Identical
10. Suppose a Stack class has been defined using template. Now, we want to declare a Stack
object of an int type. What will be the correct syntax?
Past Papers for Mids./Finals are also Available
✔ Stack<int> stack;
1. Consider the linked list having data [6, 72, 35, 65, 25] stored in it. While the current pointer is
pointing to the memory location having 72 stored in it. After calling the add(4) function on the
following linked list, the current pointer will point to the memory location having value?
A) 25
B) 35 ✅
C) 72
D) 65
2. Consider the linked list having data [6, 72, 35, 65, 25] stored in it. While the current pointer is
pointing to the memory location having 35 stored in it. What will be the resultant linked list after
calling the add(18) function on the given linked list?
A) 6, 72, 35, 18, 65, 25 ✅
B) 6, 18, 72, 35, 65, 25
C) 6, 72, 35, 65, 25, 18
D) 6, 72, 18, 35, 65, 25
3. In which data structure are elements inserted at the back and removed from the front?
A) Linked List
B) Tree
C) Queue ✅
D) Stack
4. Each node in a singly linked list contains two fields, one field called the data field, while the other
field contains:
A) Pointer to character
B) Pointer to class
C) Pointer to an integer
D) Pointer to next node ✅
5. Each node in a singly linked list contains two fields, one field called the data field, while the other
field contains:
A) Pointer to character
B) Pointer to class
C) Pointer to an integer
D) Pointer to next node ✅
Past Papers for Mids./Finals are also Available
9. During the execution of a process, the operating system constructs four things for that process.
Which of the following is not part of that process?
A) Linked List ✅
B) Stack
C) A section for static data including global variables
D) None of the above
10. Consider we have performed the following operations on a stack of size 5: push(10); push(20);
push(30); pop(); pop(); push(40); What is the top of the stack?
A) 40 ✅
B) 10
C) 30
D) 20
Each node in a singly linked list contains two fields, one field called data field while other field
contains:
Pointer to next node ✅
Pointer to class
Past Papers for Mids./Finals are also Available
Whenever we call a function, the compiler makes a _______ that it uses to fulfill this
function call.
Macro
Queue
✅ Heap
Consider the following push operations of a Stack:
mathematica
Copy code
Stack.push(4);
Stack.push(6);
Stack.push(5);
Stack.push(8);
If a user calls a pop() operation, then which value will be returned?
4
6
5
✅8
Consider the following expression: P = A * B + C - D. In the above expression, "+" is a
_________.
✅ Binary
Unary
Technical
In singly linked list, a node comprises of ___________ field/s.
Three
O
One
✅ Two
Four
Which one of the following operations returns and removes top value of the stack?
Push
First
Top
✅ Pop
Stack.push(15) will push 15 on:
Anywhere in the Stack
✅ Top of the Stack
Middle of the Stack
Bottom of the Stack
Past Papers for Mids./Finals are also Available
3. Consider the linked list implementation of a stack. Which of the following node is
considered as Top of the stack?
Middle node
First node ✅
Any node
Past Papers for Mids./Finals are also Available
8. Suppose we have been given the following data set for a Queue: 37524. What will be the
resultant Queue if we call a front() method?
524
7524
37524 ✅
75243
💎Agr complete handling krwatey hain 1 subject ki with all activities= Rs 500 (Half
Semester) 💎