C# - C Sharp: CSD203 - PT2


Khóa học qua video:
Lập trình Python All Lập trình C# All SQL Server All Lập trình C All Java PHP HTML5-CSS3-JavaScript
Đăng ký Hội viên
Tất cả các video dành cho hội viên

(nhấn nút 'Result' để biết kết quả)

Q1: In a Binary Search Tree, where are keys greater than the current node stored?
Left subtree
Right subtree
Root only
Both subtrees

Q2: Which traversal of a BST returns the keys in sorted order?
Preorder
Postorder
Inorder
Level-order

Q3: Which Python module provides a dictionary implementation?
math
random
builtins
dict

Q4: What is the height of a tree containing only one root node?
0
1
2
Undefined

Q5: Which AVL tree property must always hold?
Every node has two children
Balance factor is -1, 0, or 1
Leaves are at the same level
Only odd keys are stored

Q6: Which operation may be required after inserting into an AVL tree?
Rotation
Sorting the tree
Linear search
Hashing

Q7: Which Python object automatically removes duplicate elements?
list
tuple
set
str

Q8: Which data structure is commonly used to implement a hash table bucket?
Queue
Linked list
Heap
Stack

Q9: What is the average-case time complexity of searching in a hash table?
O(n)
O(log n)
O(1)
O(n log n)

Q10: Which graph representation is more memory efficient for sparse graphs?
Adjacency matrix
Adjacency list
2D array
Complete table

Q11: Which traversal uses a queue?
DFS
Preorder
BFS
Postorder

Q12: Which sorting algorithm repeatedly selects the smallest remaining element?
Bubble Sort
Selection Sort
Merge Sort
Quick Sort

Q13: Which sorting algorithm repeatedly swaps adjacent elements?
Heap Sort
Bubble Sort
Merge Sort
Shell Sort

Q14: Which sorting algorithm follows the divide-and-conquer strategy?
Insertion Sort
Bubble Sort
Merge Sort
Selection Sort

Q15: Which Python expression creates an empty set?
{}
[]
set()
()

Q16: In a BST, where are duplicate keys usually inserted?
Always left
Always right
Depends on implementation
They are impossible

Q17: What is the root of a tree?
A node with no parent
A node with no children
The deepest node
The largest node

Q18: Which graph traversal is commonly implemented using recursion?
BFS
DFS
Level-order
Topological Sort

Q19: Which hashing issue occurs when two keys map to the same index?
Overflow
Collision
Recursion
Balancing

Q20: Which Python type is most similar to a Map ADT?
list
dict
tuple
set

Q21: In an AVL tree, which rotation fixes a Left-Left (LL) imbalance?
Left rotation
Right rotation
Left-Right rotation
Right-Left rotation

Q22: Which traversal visits the root node before its children?
Inorder
Postorder
Preorder
Reverse inorder

Q23: Which Python statement adds an element to a set?
s.append(10)
s.insert(10)
s.add(10)
s.push(10)

Q24: Which method returns the value associated with a key in a Python dictionary?
value()
find()
get()
search()

Q25: Which graph representation allows checking whether two vertices are adjacent in O(1) time?
Adjacency list
Adjacency matrix
Edge list
Tree

Q26: Which sorting algorithm has the best average-case complexity among the following?
Bubble Sort
Selection Sort
Merge Sort
Insertion Sort

Q27: Which operation removes duplicate values from a Python list most easily?
list(set(data))
tuple(data)
dict(data)
sorted(data)

Q28: What is the balance factor of an AVL node?
Number of children
Height(left) - Height(right)
Height(left) + Height(right)
Depth of the node

Q29: Which collision resolution technique stores collided elements in linked lists?
Double hashing
Separate chaining
Linear probing
Quadratic probing

Q30: Which Python operator checks whether an element exists in a set?
contains
exists
in
has

Q31: In a BST, what is the leftmost node?
Largest key
Median key
Smallest key
Root node

Q32: Which sorting algorithm inserts each element into its proper position in the sorted part?
Insertion Sort
Merge Sort
Heap Sort
Quick Sort

Q33: Which graph traversal guarantees the shortest path in an unweighted graph?
DFS
BFS
Preorder
Postorder

Q34: Which hashing technique searches the next available slot sequentially?
Separate chaining
Linear probing
Double hashing
AVL rotation

Q35: Which tree traversal visits the left subtree, root, then right subtree?
Postorder
Preorder
Inorder
Level-order

Q36: Which Python dictionary method removes and returns a value by key?
pop()
delete()
erase()
discard()

Q37: Which type of graph has edges with directions?
Undirected graph
Weighted graph
Directed graph
Complete graph

Q38: Which sorting algorithm chooses a pivot element?
Merge Sort
Selection Sort
Quick Sort
Bubble Sort

Q39: Which Python dictionary method returns all keys?
values()
keys()
items()
get()

Q40: Which property makes AVL trees faster than ordinary BSTs in the worst case?
Nodes are sorted alphabetically
The tree remains balanced
Every node has two children
Leaves are always full

Q41: In a full binary tree, every internal node has how many children?
0 or 1
Exactly 2
Exactly 3
Any number

Q42: Which AVL rotation is used to fix a Right-Right (RR) imbalance?
Left rotation
Right rotation
Left-Right rotation
Right-Left rotation

Q43: Which Python statement creates a dictionary with one key-value pair?
d = {"A":1}
d = {"A",1}
d = ("A":1)
d = ["A":1]

Q44: Which hash table load factor generally increases the probability of collisions?
A higher load factor
A lower load factor
A negative load factor
Load factor has no effect

Q45: Which graph representation stores a list of neighbors for every vertex?
Adjacency list
Adjacency matrix
Incidence table
Binary tree

Q46: Which sorting algorithm is stable by default?
Quick Sort
Heap Sort
Merge Sort
Selection Sort

Q47: Which Python set operation returns elements that exist in both sets?
union()
intersection()
difference()
symmetric_difference()

Q48: Which node in a tree has no children?
Root node
Internal node
Leaf node
Parent node

Q49: Which collision resolution method computes a second hash value?
Separate chaining
Linear probing
Double hashing
Quadratic probing

Q50: Which sorting algorithm builds a heap before sorting?
Bubble Sort
Heap Sort
Insertion Sort
Merge Sort

Q51: In Python, what does len(my_set) return?
Memory size
Number of elements
Hash value
Largest element

Q52: Which BST operation typically has O(log n) time in a balanced tree?
Search
Traversal
Printing all nodes
Counting leaves

Q53: Which graph can contain cycles?
Only trees
General graphs
Only binary trees
Only AVL trees

Q54: Which Python dictionary method returns key-value pairs?
keys()
values()
items()
get()

Q55: Which sorting algorithm repeatedly compares an element with previous sorted elements?
Insertion Sort
Selection Sort
Heap Sort
Quick Sort

Q56: Which Python expression checks whether key "id" exists in a dictionary d?
d.has("id")
"id" in d
d.exists("id")
d.find("id")

Q57: Which tree node has one or more child nodes?
Leaf node
Internal node
External node
Null node

Q58: Which hashing strategy stores all elements directly inside the hash table array?
Open addressing
Separate chaining
Linked hashing
Tree hashing

Q59: Which graph traversal uses a stack when implemented iteratively?
BFS
DFS
Level-order
Shortest path

Q60: Which sorting algorithm has the worst-case time complexity O(n²)?
Bubble Sort
Merge Sort
Heap Sort
Counting Sort

Q61: Which traversal visits nodes level by level from top to bottom?
Inorder
Preorder
Level-order
Postorder

Q62: Which data structure is typically used to perform iterative inorder traversal?
Queue
Stack
Heap
Hash table

Q63: After deleting a node from an AVL tree, what may be required?
Rehashing
Rotations
Sorting all nodes
Graph traversal

Q64: Which tree always has all levels completely filled except possibly the last?
Complete binary tree
AVL tree
BST
General tree

Q65: In a perfect binary tree, every internal node has _____.
One child
Exactly two children
Three children
No children

Q66: Which graph algorithm is commonly used to find the shortest path with non-negative edge weights?
Prim's algorithm
Kruskal's algorithm
Dijkstra's algorithm
DFS

Q67: Which graph algorithm is used to find a Minimum Spanning Tree?
Binary Search
Merge Sort
Prim's algorithm
BFS

Q68: Topological sorting can only be applied to which type of graph?
Undirected graph
Directed Acyclic Graph (DAG)
Complete graph
Weighted graph

Q69: Which data structure is used in Union-Find?
Parent array
Queue
Stack
Heap

Q70: Which hashing technique checks positions h(k), h(k)+1, h(k)+2, ...?
Double hashing
Linear probing
Separate chaining
AVL balancing

Q71: Which sorting algorithm uses recursion in its standard implementation?
Selection Sort
Merge Sort
Insertion Sort
Bubble Sort

Q72: Which sorting algorithm partitions the array around a pivot?
Heap Sort
Quick Sort
Selection Sort
Bubble Sort

Q73: Which Python dictionary method removes all key-value pairs?
clear()
remove()
delete()
discard()

Q74: Which operation returns all unique elements from two sets?
intersection()
union()
difference()
issubset()

Q75: Which graph traversal is suitable for exploring all reachable vertices?
DFS
Both BFS and DFS
Quick Sort
Heap Sort

Q76: Which Python expression creates an empty dictionary?
{}
set()
[]
()

Q77: Which BST node replacement is commonly used when deleting a node with two children?
Its parent
Its inorder successor
Any leaf
The root

Q78: Which AVL imbalance requires a Left-Right (LR) rotation?
Left subtree is right-heavy
Right subtree is left-heavy
Right subtree is right-heavy
Tree is complete

Q79: Which collision resolution strategy keeps all elements inside the hash table array?
Separate chaining
Open addressing
Linked list
AVL tree

Q80: Which sorting algorithm has average-case time complexity O(n log n)?
Merge Sort
Bubble Sort
Insertion Sort
Selection Sort

Q81: In a BST, which node replaces a deleted node with two children if using the predecessor method?
Largest node in the left subtree
Smallest node in the right subtree
Root node
Any leaf node

Q82: What is the balance factor of a leaf node in an AVL tree?
-1
0
1
2

Q83: Which Python statement correctly checks whether key 10 exists in dictionary d?
10 in d.keys()
d.contains(10)
d.has_key(10)
exists(d,10)

Q84: Which graph algorithm uses a priority queue in its efficient implementation?
Breadth-First Search
Depth-First Search
Dijkstra's Algorithm
Topological Sort

Q85: Which sorting algorithm is NOT comparison-based?
Merge Sort
Heap Sort
Counting Sort
Quick Sort

Q86: What is the maximum number of children of a node in a binary tree?
1
2
3
Unlimited

Q87: Which hashing method usually reduces clustering better than linear probing?
Quadratic probing
Separate chaining
Bubble hashing
Tree hashing

Q88: Which graph property guarantees that exactly one simple path exists between any two vertices?
Complete graph
Tree
Cycle graph
Directed graph

Q89: Which Python expression computes the intersection of sets a and b?
a+b
a&b
a|b
a-b

Q90: Which traversal visits children before their parent?
Inorder
Preorder
Postorder
Level-order

Q91: Which sorting algorithm is commonly used as the final stage of TimSort?
Insertion Sort
Selection Sort
Heap Sort
Shell Sort

Q92: Which operation is typically O(1) average time for Python's dict?
Lookup by key
Sorting keys
Finding minimum value
Traversing all entries

Q93: Which graph algorithm can detect connected components?
DFS
Quick Sort
Heap Sort
Binary Search

Q94: Which AVL rotation consists of two single rotations?
LL
RR
LR
None

Q95: Which Python dictionary view updates automatically when the dictionary changes?
keys()
Both keys() and values()
items()
All of the above

Q96: Which sorting algorithm repeatedly shrinks the unsorted region from the end?
Bubble Sort
Selection Sort
Merge Sort
Quick Sort

Q97: Which graph algorithm requires the graph to have no cycles?
DFS
BFS
Topological Sort
Dijkstra

Q98: Which data structure is internally used for recursive DFS?
Queue
Call stack
Hash table
Priority queue

Q99: Which BST traversal is most suitable for creating a sorted list?
Inorder
Preorder
Postorder
Level-order

Q100: Which sorting algorithm is the default algorithm used by Python's sorted() function?
Quick Sort
Merge Sort
TimSort
Heap Sort

Q101: In a binary tree, what is the maximum number of nodes at level k (root is level 0)?
2k
2^k
k+1

Q102: Which Python expression checks whether set A is a subset of set B?
A <= B
A >= B
A == B
A <> B

Q103: In a BST, which operation is needed before deleting a leaf node?
Tree rotation
No replacement is needed
Find inorder successor
Rebuild the tree

Q104: Which graph representation is usually easier to iterate over all outgoing neighbors of a vertex?
Adjacency list
Adjacency matrix
Incidence matrix
Edge weight table

Q105: Which property is required for a function to be a good hash function?
Produces evenly distributed hash values
Always returns consecutive integers
Depends only on table size
Always produces unique values

Q106: Which sorting algorithm performs particularly well on nearly sorted data?
Insertion Sort
Selection Sort
Heap Sort
Quick Sort

Q107: Which Python dictionary method returns a default value when the key does not exist?
find()
lookup()
get()
value()

Q108: What is the minimum possible height of a BST containing 31 nodes?
4
5
30
15

Q109: Which graph algorithm repeatedly selects the edge with the smallest weight while avoiding cycles?
Dijkstra's Algorithm
Kruskal's Algorithm
DFS
BFS

Q110: Which Python operator computes the union of two sets?
&
|
^
-

Q111: Which traversal is useful for deleting an entire binary tree safely?
Preorder
Inorder
Postorder
Level-order

Q112: Which probing method may examine positions h(k)+1², h(k)+2², h(k)+3², ...?
Separate chaining
Quadratic probing
Double hashing
Linear probing

Q113: Which graph algorithm can be implemented using a stack instead of recursion?
DFS
Prim's Algorithm
Kruskal's Algorithm
Dijkstra's Algorithm

Q114: Which binary tree property is always true?
Every node has exactly two children
Each node has at most two children
All leaves are at the same level
The tree is always balanced

Q115: Which sorting algorithm always divides the input into two halves before recursively sorting?
Quick Sort
Merge Sort
Heap Sort
Shell Sort

Q116: Which Python dictionary method removes and returns the last inserted key-value pair?
pop()
popitem()
clear()
discard()

Q117: Which condition indicates that an undirected graph is a tree?
Connected and has exactly V-1 edges
Contains at least one cycle
Every vertex has degree 2
Has more edges than vertices

Q118: Which operation on a Python set removes an element without raising an error if it does not exist?
remove()
delete()
discard()
erase()

Q119: Which tree property helps guarantee logarithmic search time in an AVL tree?
Nodes are inserted randomly
The tree remains height-balanced
Leaves are sorted
Root is always the median

Q120: Which sorting algorithm repeatedly extracts the maximum (or minimum) element from a heap?
Heap Sort
Insertion Sort
Merge Sort
Bubble Sort

(Ghi chú: Phần câu hỏi Qi có màu Green thể hiện đáp án đúng)

(Ghi chú: Phần câu hỏi Qi có màu Green thể hiện đáp án đúng)
» Tiếp: CSD201 - PT2
« Trước: Practical 12: Books Management System
Khóa học qua video:
Lập trình Python All Lập trình C# All SQL Server All Lập trình C All Java PHP HTML5-CSS3-JavaScript
Đăng ký Hội viên
Tất cả các video dành cho hội viên
Copied !!!