T4Tutorials .PK

VU Past Papers CS301 – Midterm Quiz 1 & 2 Answers

CS301

Q1: When an executable program runs, it is loaded in memory and becomes a
Answer: Process

Q2: A kind of expression where the operator is present between two operands is called
Answer: Infix

Q3: Which of the following operations returns top value of the stack?
Answer: top

Q4: To create a ___ we link the last node with the first node in the list.
Answer: Circularly-linked list

Q5: In the calling function, after the execution of the function called, the program continues its execution from the ___ after the function call.
Answer: Next line

Q6: Doubly Linked List always has one NULL pointer.
Answer: False

Q7: ___ only removes items in reverse order as they were entered.
Answer: Stack

Q8: In linked list implementation of stack, push places the new entry:
Answer: At the head

Q9: Which of the following is known as “Last-In, First-Out” (LIFO) Data Structure?
Answer: Stack

Q10: Boolean expression indicating whether numbers in two nodes (p and q) are the same:
Answer: p.data == q.data

Q11: Local variables of a function are stored in:
Answer: Stack

Q12: Compiler uses ___ in function calls.
Answer: Stack

Q13: Stack and Queue can be implemented using:
Answer: Singly Linked List

Q14: TRUE about recursion:
Answer: Recursion extensively uses stack memory

Q15: Whenever we call a function, the compiler makes a stack, the top element of the stack is:
Answer: Return address

Q16: Stack characteristic but ___ implemented because of size limitation of array:
Answer: push(), pop()

Q17: Each operator in a postfix expression refers to the previous ___ operand(s).
Answer: two

Q18: The next field in the last node in a singly-linked list is set to:
Answer: NULL

Q19: The ___ method of list positions currentNode and lastCurrentNode at the start of the list.
Answer: Start

Q20: Maximum number of nodes in a stack-linked list:
Answer: Any Number

Q21: A queue is a ___ data structure, whereas a stack is a ___ data structure.
Answer: FIFO, LIFO

Q22: Principal benefit of linked list over conventional array:
Answer: Different (order in memory may differ from logical order)

Q23: Can be used to reverse a string:
Answer: Stack

Q24: Each node in doubly linked list has:
Answer: 2 pointers

Q25: ‘next’ returns false at last node because next field is:
Answer: NULL

Q26: Removes items in reverse order as entered:
Answer: Stack

Q27: Template is a function or class written with ___ data type:
Answer: Generic

Binary Tree, Heap, Threaded Tree Questions

Q28: If N external nodes in a binary tree, internal nodes =
Answer: N – 1

Q29: Expression tree will always be a:
Answer: Complete binary tree

Q30: In min heap, parent node has key smaller than or equal to:
Answer: Both children

Q31: Build heap time complexity:
Answer: Linear

Q32: Number of edges in tree with 50 nodes:
Answer: 49

Q33: Max heap array after inserting 35:
Answer: 40, 35, 20, 10, 30, 16, 17, 8, 4, 15

Q34: Threaded Binary Tree, NULL pointers replaced by:
Answer: Inorder successor or predecessor

Q35: Complete Binary Tree is filled except possibly at bottom level:
Answer: Left to right

Q36: If bottom level not completely filled → not a:
Answer: Complete Binary Tree

Q37: Expression tree root should have:
Answer: Operator

Q38: Dummy node in threaded binary tree:
Answer: Left pointer points to root, right pointer points to itself

Q39: Parent nodes key ≥ both children in:
Answer: Max heap

Q40: External nodes in tree with 45 internal nodes:
Answer: 46

Q41: Iteration vs recursion:
Answer: Iteration is more memory-efficient

Exit mobile version