Q1: What is recursion in Java?
A class inheriting itself
A loop that never ends
A method calling itself
A static method calling another class
Q2: Which condition is essential for recursion to terminate?
Infinite loop
Base case
Static method
Private constructor
Q3: Which data structure is used by recursion internally?
Queue
LinkedList
Array
Stack
Q4: What will happen if a recursive function lacks a base case?
StackOverflowError
NullPointerException
SyntaxError
FileNotFoundException
Q5: Which traversal is recursive by nature?
Sorting
Tree traversal
Hashing
Searching
Q6: What is the time complexity of binary search using recursion?
O(n)
O(n²)
O(1)
O(log n)
Q7: In a binary tree, how many children can each node have?
Two
One
Three
Unlimited
Q8: What is the height of a tree with only a root node?
0
-1
1
Depends on children count
Q9: What is an inorder traversal sequence?
Root, Left, Right
Left, Root, Right
Left, Right, Root
Right, Left, Root
Q10: Which data structure is used for level-order traversal?
Queue
Stack
Heap
ArrayList
Q11: Which traversal visits the root node last?
Preorder
Inorder
Postorder
Level order
Q12: Which of these is not a type of binary tree?
Full binary tree
Complete binary tree
Perfect binary tree
Circular binary tree
Q13: What is the maximum number of nodes in a binary tree of height h?
h²
2^(h+1) - 1
2h
h³
Q14: What is a leaf node?
A node with one child
Root node
A node with no children
Parent node
Q15: Which algorithm is used for finding shortest path in graphs?
Dijkstra’s algorithm
Kruskal’s algorithm
Prim’s algorithm
Bellman’s equation
Q16: What is a graph with no cycles called?
Cyclic graph
Tree graph
Null graph
Acyclic graph
Q17: Which traversal uses a stack or recursion for visiting nodes?
Breadth First Search
Depth First Search
Level order
Random traversal
Q18: Which traversal uses a queue for visiting nodes?
Depth First Search
Inorder traversal
Breadth First Search
Postorder traversal
Q19: What is the time complexity of DFS?
O(V²)
O(E²)
O(log V)
O(V + E)
Q20: Which algorithm is used for Minimum Spanning Tree?
Kruskal’s algorithm
Binary search
Heap sort
Merge sort
Q21: Which sorting algorithm has the best average-case complexity?
Bubble Sort
Selection Sort
Insertion Sort
Merge Sort
Q22: Which sorting algorithm is based on divide and conquer?
Bubble Sort
Counting Sort
Quick Sort
Selection Sort
Q23: Which sorting algorithm is stable?
Merge Sort
Heap Sort
Quick Sort
Shell Sort
Q24: What is the best-case time complexity of Bubble Sort?
O(n log n)
O(n²)
O(1)
O(n)
Q25: Which sorting algorithm has the worst-case complexity of O(n log n)?
Quick Sort
Heap Sort
Merge Sort
Bubble Sort
Q26: What is hashing used for?
Sorting data
Compressing files
Efficient data retrieval
Encrypting passwords only
Q27: What is a hash collision?
Two keys having the same hash value
When hash table is empty
When hash code is zero
When data is sorted
Q28: Which technique resolves collisions by linking elements?
Linear probing
Rehashing
Double hashing
Chaining
Q29: Which probing technique uses a fixed interval to find next empty slot?
Chaining
Quadratic probing
Linear probing
Separate chaining
Q30: What does the load factor in a hash table represent?
Table size / Number of elements
Number of elements / Table size
Average hash value
Maximum collisions
Q31: Which tree traversal uses recursion naturally?
Inorder traversal
Level order traversal
Breadth First traversal
Queue traversal
Q32: What is the time complexity of inserting into a binary search tree (BST)?
O(1)
O(n)
O(log n)
O(h)
Q33: What is a balanced binary tree?
A tree with equal number of nodes
A tree where left and right subtrees differ in height by at most one
A tree with all leaves at same level
A tree with one child per node
Q34: Which traversal can reconstruct a tree when combined with inorder traversal?
Postorder
Level order
Preorder
Breadth order
Q35: What is the height of an empty binary tree?
1
Undefined
-1
0
Q36: Which traversal is used in expression trees to get postfix expression?
Preorder
Postorder
Inorder
Level order
Q37: Which sorting algorithm is in-place and not stable?
Heap Sort
Merge Sort
Bubble Sort
Insertion Sort
Q38: Which data structure is used in HashMap internally?
Queue
Stack
Binary tree
Array of LinkedLists
Q39: Which hashing method multiplies the key by a constant A?
Division method
Mid-square method
Multiplication method
Folding method
Q40: What is the advantage of open addressing in hashing?
Supports linked storage
Uses less extra memory
Reduces collisions
Slower retrieval
Q41: What is the purpose of recursion in programming?
To solve problems by breaking them into smaller subproblems
To loop infinitely
To allocate memory dynamically
To store variables globally
Q42: What is the base case in recursion?
Condition to start recursion
A loop iteration
A recursive variable
Condition to stop recursion
Q43: What happens if a recursive method has no base case?
Compilation error
Null pointer
Stack overflow
No effect
Q44: Which data structure supports recursion implementation?
Stack
Queue
Array
Tree
Q45: Which traversal technique is naturally recursive?
Level order
Inorder
Breadth First
Queue order
Q46: Which algorithm is a recursive sorting method?
Bubble Sort
Selection Sort
Insertion Sort
Merge Sort
Q47: Which graph traversal algorithm uses recursion?
Depth First Search
Breadth First Search
Dijkstra
Kruskal
Q48: What is the time complexity of DFS in an adjacency list?
O(V²)
O(E²)
O(VE)
O(V + E)
Q49: Which traversal algorithm uses a queue?
Depth First Search
Prim’s Algorithm
Breadth First Search
Topological Sort
Q50: Which algorithm finds shortest paths in weighted graphs?
DFS
BFS
Kruskal
Dijkstra’s Algorithm
Q51: Which algorithm is used to find a Minimum Spanning Tree?
Kruskal’s Algorithm
Dijkstra’s Algorithm
Floyd Warshall
Bellman Ford
Q52: Which algorithm is also used to find MST?
DFS
Floyd Warshall
Prim’s Algorithm
Topological Sort
Q53: What is a leaf node in a binary tree?
Node with one child
Node with no children
Root node
Parent node
Q54: What is the maximum number of nodes at level ‘l’ in a binary tree?
l²
l
2*l
2^l
Q55: What is the space complexity of recursive Fibonacci?
O(n)
O(1)
O(n²)
O(log n)
Q56: What is the best case for Quick Sort?
Pivot at end
Pivot divides array into two equal halves
Sorted input
All duplicates
Q57: What is the worst case for Quick Sort?
Random pivot
All unique elements
When pivot is always smallest or largest element
Half sorted
Q58: Which sorting algorithm is not comparison-based?
Quick Sort
Merge Sort
Heap Sort
Counting Sort
Q59: Which hash collision technique uses secondary hash function?
Chaining
Double Hashing
Linear Probing
Rehashing
Q60: What is the typical time complexity for hash table insertion?
O(1)
O(n)
O(log n)
O(n log n)
Q61: Which sorting algorithm uses a binary heap as its primary data structure?
Quick Sort
Heap Sort
Merge Sort
Shell Sort
Q62: Which sorting algorithm is commonly used for sorting integers with a fixed number of digits?
Merge Sort
Radix Sort
Selection Sort
Heap Sort
Q63: Which sorting algorithm assumes that input values fall within a limited range?
Quick Sort
Counting Sort
Merge Sort
Shell Sort
Q64: Which sorting algorithm distributes elements into buckets before sorting each bucket?
Bucket Sort
Heap Sort
Insertion Sort
Selection Sort
Q65: Which property describes a sorting algorithm that takes advantage of partially sorted input?
Stable
Adaptive
Recursive
In-place
Q66: Which sorting algorithm repeatedly sorts elements that are a certain gap apart?
Shell Sort
Merge Sort
Quick Sort
Bubble Sort
Q67: Which sorting algorithm is typically preferred for very large datasets stored on external storage?
External Merge Sort
Bubble Sort
Selection Sort
Insertion Sort
Q68: Which sorting algorithm is used internally by many programming languages for object sorting because it is stable and adaptive?
TimSort
Heap Sort
Selection Sort
Shell Sort
Q69: Which sorting algorithm combines Quick Sort, Heap Sort, and Insertion Sort?
IntroSort
Radix Sort
Bucket Sort
Counting Sort
Q70: Which sorting algorithm has a time complexity that does not depend on the initial order of elements?
Heap Sort
Insertion Sort
Bubble Sort
Shell Sort
Q71: Which graph algorithm is specifically designed for Directed Acyclic Graphs (DAGs)?
Topological Sort
Breadth First Search
Depth First Search
Prim's Algorithm
Q72: Which shortest-path algorithm can correctly handle negative edge weights?
Bellman-Ford Algorithm
Dijkstra's Algorithm
Prim's Algorithm
Kruskal's Algorithm
Q73: Which algorithm computes the shortest paths between every pair of vertices?
Floyd-Warshall Algorithm
Breadth First Search
Depth First Search
Union-Find
Q74: Which data structure is commonly used to detect cycles in Kruskal's algorithm?
Union-Find
Queue
Binary Heap
Stack
Q75: A graph that can be divided into two disjoint vertex sets with no edges inside the same set is called:
Complete graph
Bipartite graph
Weighted graph
Cyclic graph
Q76: Which graph representation is generally more memory-efficient for sparse graphs?
Adjacency List
Adjacency Matrix
Incidence Matrix
Edge Matrix
Q77: Which graph representation allows checking whether an edge exists between two vertices in O(1) time?
Adjacency Matrix
Adjacency List
Edge List
Linked Graph
Q78: Which graph concept refers to a path that visits every edge exactly once?
Euler Path
Hamiltonian Path
Shortest Path
Simple Path
Q79: Which graph concept refers to a path that visits every vertex exactly once?
Euler Path
Hamiltonian Path
Minimum Path
Cycle Tree
Q80: Which algorithm is commonly used to find Strongly Connected Components in a directed graph?
Kosaraju's Algorithm
Binary Search
Heap Sort
Linear Search
Q81: Which self-balancing binary search tree guarantees that the heights of two child subtrees differ by at most one?
Red-Black Tree
AVL Tree
B-Tree
Trie
Q82: Which rotation is performed when a node becomes unbalanced due to insertion into the left subtree of its left child?
Left Rotation
Right Rotation
Left-Right Rotation
Right-Left Rotation
Q83: Which data structure is specifically optimized for storing and searching strings by their prefixes?
Trie
Binary Heap
AVL Tree
Segment Tree
Q84: Which tree is widely used in database indexing because each node can have many children?
Binary Search Tree
AVL Tree
B-Tree
Expression Tree
Q85: In a B+ Tree, where are the actual data records typically stored?
Internal nodes only
Root node only
Leaf nodes
Every node
Q86: Which tree data structure efficiently supports range sum queries and point updates?
Trie
Segment Tree
AVL Tree
General Tree
Q87: Which data structure is also known as a Binary Indexed Tree?
Fenwick Tree
Threaded Tree
Red-Black Tree
Suffix Tree
Q88: Which tree stores arithmetic expressions where internal nodes are operators and leaves are operands?
AVL Tree
Expression Tree
Trie
B+ Tree
Q89: Which balancing technique is characteristic of Red-Black Trees?
Height balancing only
Node coloring
Weight balancing
Random balancing
Q90: Which tree traversal is commonly used to evaluate an expression tree?
Postorder Traversal
Level Order Traversal
Preorder Traversal
Inorder Traversal
Q91: Which hashing technique places colliding keys into one of two possible hash table locations?
Cuckoo Hashing
Linear Probing
Quadratic Probing
Separate Chaining
Q92: Which collision resolution strategy attempts to minimize probe sequence length by moving keys with shorter probe distances?
Robin Hood Hashing
Double Hashing
Chaining
Linear Hashing
Q93: Which hashing concept aims to eliminate collisions for a fixed set of keys?
Perfect Hashing
Open Addressing
Quadratic Probing
Rehashing
Q94: Which probabilistic data structure is used to test whether an element may exist in a set?
Bloom Filter
Trie
AVL Tree
Binary Heap
Q95: What is the primary disadvantage of a Bloom Filter?
False positives are possible
Requires sorting
Cannot store strings
Consumes excessive memory
Q96: Which type of hash function attempts to distribute keys as uniformly as possible?
Good Hash Function
Recursive Function
Greedy Function
Dynamic Function
Q97: When is rehashing typically performed in a hash table?
When the load factor exceeds a threshold
After every insertion
After every deletion
Only when collisions never occur
Q98: Which hashing method computes the table index using two different hash functions?
Double Hashing
Separate Chaining
Linear Probing
Bucket Hashing
Q99: Which hashing approach stores all elements with the same hash value in a linked structure?
Separate Chaining
Cuckoo Hashing
Robin Hood Hashing
Double Hashing
Q100: Which characteristic is most desirable for a hash function?
Uniform key distribution
Produces sorted values
Always returns even numbers
Depends on insertion order
Q101: Which self-adjusting binary search tree moves an accessed node to the root using rotations?
AVL Tree
Splay Tree
B+ Tree
Trie
Q102: Which tree data structure combines the properties of a binary search tree and a heap?
Treap
Segment Tree
Fenwick Tree
Expression Tree
Q103: Which tree data structure is specifically designed for efficient interval overlap queries?
AVL Tree
Interval Tree
Trie
Red-Black Tree
Q104: Which multidimensional tree is commonly used for nearest-neighbor searching?
KD-Tree
B-Tree
Heap
Trie
Q105: Which tree is mainly used for fast substring searching in a long text?
Suffix Tree
AVL Tree
Binary Heap
General Tree
Q106: Which tree stores all suffixes of a string in compressed form?
Segment Tree
Trie
Suffix Tree
Fenwick Tree
Q107: Which data structure provides average O(log n) search, insertion, and deletion using multiple linked levels?
Skip List
Queue
Stack
Hash Set
Q108: Which type of tree is frequently used in game AI to represent possible moves?
Game Tree
Trie
Fenwick Tree
B+ Tree
Q109: Which graph algorithm finds articulation points in an undirected graph?
Tarjan's Algorithm
Prim's Algorithm
Bellman-Ford Algorithm
Floyd-Warshall Algorithm
Q110: In graph theory, a bridge is:
An edge whose removal increases the number of connected components
A vertex connected to every other vertex
A cycle with four vertices
An edge with the maximum weight
Q111: Which maximum-flow algorithm repeatedly uses BFS to find augmenting paths?
Edmonds-Karp Algorithm
Kruskal's Algorithm
Prim's Algorithm
Warshall Algorithm
Q112: Which shortest-path algorithm combines Bellman-Ford and Dijkstra to handle sparse graphs with negative edges?
Johnson's Algorithm
DFS
BFS
Kahn's Algorithm
Q113: Which graph algorithm is commonly used to identify strongly connected components in a single DFS traversal?
Tarjan's SCC Algorithm
Binary Search
Insertion Sort
Prim's Algorithm
Q114: Which graph property guarantees that every pair of vertices is connected by at least one path?
Connectivity
Bipartiteness
Planarity
Acyclicity
Q115: Which hashing technique is especially useful in distributed systems when servers are frequently added or removed?
Consistent Hashing
Linear Probing
Quadratic Probing
Separate Chaining
Q116: Which hashing scheme expands the directory dynamically instead of rebuilding the entire hash table?
Extendible Hashing
Perfect Hashing
Open Addressing
Bucket Sort
Q117: Which hashing method organizes buckets using a tree structure after excessive collisions?
Tree-based Hashing
Linear Probing
Double Hashing
Quadratic Probing
Q118: Which type of perfect hashing minimizes the memory required while guaranteeing no collisions?
Minimal Perfect Hashing
Universal Hashing
Double Hashing
Linear Hashing
Q119: Universal hashing is primarily designed to:
Reduce the probability of collisions
Sort keys automatically
Compress data
Encrypt passwords
Q120: Which property indicates that a hash function produces nearly equal numbers of keys in each bucket?
Uniform Distribution
Recursion
Heap Property
Transitivity
Bản quyền thuộc về V1Study.com. Cấm sao chép dưới mọi hình thức!