GATE — Computer Science & Data Science / Artificial Intelligence (GATE CS & DA)

High-yield GATE CS & GATE DA flashcards covering Master Theorem, Graph Algorithms, NP-Completeness, OS (Scheduling, Semaphores, Banker's, TLB/Paging), DBMS (3NF/BCNF, Serializability, B+ Trees), Computer Networks (CIDR, TCP Congestion, Flow Control), TOC/Compilers (LL/LR, Pumping Lemma), and Machine Learning.

Category
India Professional, Engineering & Banking Flagships — ICAI Chartered Accountancy (CA New Scheme), GATE, IBPS/SBI PO & RBI Grade B, and UGC-NET Paper 1
Level
advanced
Languages
en → en
Cards
32
Markdown
GATE — Computer Science & Data Science / Artificial Intelligence (GATE CS & DA) (.md)

Flashcards (32)

#Front (Term / Question)Back (Definition / Answer)ExampleMultiple-Choice Options
1In Operating Systems, how do FCFS, SJF/SRTF, and Round Robin CPU scheduling algorithms behave regarding convoy effect, optimal waiting time, and starvation?FCFS: convoy effect; SJF/SRTF: minimum average waiting time (risk of starvation, solved by aging); Round Robin: time-quantum preemptive fairnessStarvation in Priority or SJF scheduling is solved by 'Aging' — gradually increasing the priority of processes that wait in the ready queue for a long time.
  • FCFS: convoy effect; SJF/SRTF: minimum average waiting time (risk of starvation, solved by aging); Round Robin: time-quantum preemptive fairness
  • FCFS is non-preemptive and suffers from the Convoy Effect; Preemptive SJF (SRTF) is provably optimal for minimum average waiting time (can starve long jobs); Round Robin uses a time quantum for fairness.
2In Ethernet CSMA/CD, what is the minimum frame size formula L_min and the Binary Exponential Backoff contention policy?Collision detection requires T_trans >= 2*T_prop, giving Minimum Frame Size L_min = 2dB/v; after c collisions, Binary Exponential Backoff picks random slot in [0, 2^c-1].For a 100 Mbps CSMA/CD LAN of length 2 km with signal speed 2×10^8 m/s, propagation time T_p = 10 microseconds and minimum frame size L_min = 2,000 bits (250 bytes).
  • T_trans >= 2 * T_prop => L_min = 2 * d * B / v; after c collisions, backoff waits random k in [0, 2^c - 1] time slots
  • Collision detection requires T_trans >= 2*T_prop, giving Minimum Frame Size L_min = 2dB/v; after c collisions, Binary Exponential Backoff picks random slot in [0, 2^c-1].
3In Syntax-Directed Translation (Compiler Design), how do S-attributed and L-attributed definitions differ?S-attributed: only synthesized attributes (bottom-up LR evaluation); L-attributed: synthesized + inherited from parent or left siblings only (top-down LL/DFS evaluation)Every S-attributed Syntax-Directed Definition (SDD) is automatically L-attributed, because it has zero inherited attributes and therefore trivially satisfies the left-sibling dependency restriction.
  • An S-attributed definition uses ONLY Synthesized attributes (evaluated bottom-up in LR parsers); an L-attributed definition allows inherited attributes from parent or left siblings only (LL/DFS).
  • S-attributed: only synthesized attributes (bottom-up LR evaluation); L-attributed: synthesized + inherited from parent or left siblings only (top-down LL/DFS evaluation)
4How do you calculate Effective Memory Access Time (EMAT) with a Translation Lookaside Buffer (TLB) and a Page Fault rate in Operating Systems?For 1-level paging with TLB hit ratio alpha, EMAT = alpha(t_TLB+m) + (1-alpha)(t_TLB+2m); for k-level paging, a TLB miss takes t_TLB + (k+1)m.If TLB lookup takes 10 ns, main memory takes 100 ns, and TLB hit ratio is 90% (sequential lookup), EMAT = 0.90*(10 + 100) + 0.10*(10 + 200) = 99 + 21 = 120 ns.
  • EMAT (TLB hit alpha) = alpha*(t_TLB + m) + (1 - alpha)*(t_TLB + 2m) for 1-level page table; with k-level page table, miss takes t_TLB + (k + 1)m
  • For 1-level paging with TLB hit ratio alpha, EMAT = alpha(t_TLB+m) + (1-alpha)(t_TLB+2m); for k-level paging, a TLB miss takes t_TLB + (k+1)m.
5In Compiler Design, what is the expressive power hierarchy of LL and LR parsers, and how do SLR(1), LALR(1), and CLR(1) compare in state count and conflicts?Power hierarchy: LR(0) < SLR(1) < LALR(1) < CLR(1); LR(0)/SLR(1)/LALR(1) have equal state counts, and merging CLR(1) into LALR(1) causes only Reduce-Reduce conflicts.No ambiguous grammar can EVER be LL(k) or LR(k) for any k; furthermore, a grammar with left recursion or common prefixes cannot be LL(1) because FIRST/FOLLOW sets in the predictive parsing table will collide.
  • LR(0) < SLR(1) < LALR(1) < CLR(1); |States(LR0)| = |States(SLR1)| = |States(LALR1)| <= |States(CLR1)|; merging CLR1 to LALR1 can create only R-R conflicts, never S-R conflicts
  • Power hierarchy: LR(0) < SLR(1) < LALR(1) < CLR(1); LR(0)/SLR(1)/LALR(1) have equal state counts, and merging CLR(1) into LALR(1) causes only Reduce-Reduce conflicts.
6What are the link utilization (efficiency) and sequence number requirements for Stop-and-Wait, Go-Back-N (GBN), and Selective Repeat (SR) sliding-window protocols?Efficiency eta = min(1, W/(1+2a)) where a = T_prop/T_trans; with k-bit sequence numbers, Go-Back-N max window is 2^k-1 and Selective Repeat is 2^(k-1).To achieve 100% link utilization (eta = 1), the sender window must satisfy W >= 1 + 2a (the Bandwidth-Delay Product in frames), determining the minimum sequence number bits k.
  • eta = W / (1 + 2a) where a = Tp/Tt; k-bit seq numbers: Stop-and-Wait W=1 (k=1), Go-Back-N max W = 2^k - 1, Selective Repeat max W_s = W_r = 2^(k-1)
  • Efficiency eta = min(1, W/(1+2a)) where a = T_prop/T_trans; with k-bit sequence numbers, Go-Back-N max window is 2^k-1 and Selective Repeat is 2^(k-1).
7How do Bagging (Random Forests) and Boosting (AdaBoost / Gradient Boosting) differ in ensemble training and their impact on Bias vs. Variance?Bagging / Random Forest: parallel bootstrap models -> reduces Variance (~36.8% Out-of-Bag); Boosting (AdaBoost/GBM): sequential error/residual focus -> reduces BiasIn a bootstrap sample of size N drawn with replacement from N items, the probability that an observation is left Out-of-Bag (OOB) approaches (1 - 1/N)^N -> 1/e = 36.8%.
  • Bagging trains deep, low-bias base learners in parallel on bootstrap samples to reduce Variance (Random Forest also subsamples random feature subsets); Boosting trains sequentially to reduce Bias.
  • Bagging / Random Forest: parallel bootstrap models -> reduces Variance (~36.8% Out-of-Bag); Boosting (AdaBoost/GBM): sequential error/residual focus -> reduces Bias
8In Digital Logic & Computer Organization, what is the speedup formula for a k-stage instruction pipeline and Amdahl's Law?A k-stage pipeline executes n instructions in (k+n-1) cycles; Effective CPI = 1 + Stall_Cycles_per_Instruction; Amdahl's Speedup = 1 / ((1-f) + f/S).In a 5-stage RISC pipeline where 20% of instructions are branches incurring a 2-cycle stall penalty, the effective CPI is 1 + 0.20 * 2 = 1.4 cycles per instruction.
  • A k-stage pipeline executes n instructions in (k+n-1) cycles; Effective CPI = 1 + Stall_Cycles_per_Instruction; Amdahl's Speedup = 1 / ((1-f) + f/S).
  • Pipeline cycles for n instructions = k + (n - 1); Effective CPI = 1 + Stall_Cycles_per_Instruction; Amdahl's Speedup = 1 / ((1 - f) + f/S)
9How does Principal Component Analysis (PCA) perform dimensionality reduction, and how is the proportion of variance explained by the top k principal components calculated?Top k eigenvectors of covariance matrix S maximize projected variance (and minimize orthogonal reconstruction MSE); Variance Explained Ratio = sum_(i=1..k) lambda_i / Trace(S)If a 3D dataset has covariance matrix eigenvalues {6, 3, 1}, projecting onto the top two principal components retains (6 + 3) / (6 + 3 + 1) = 90% of total variance.
  • Given mean-centred data X with covariance matrix S = (1/(n-1))*X^T*X, the k Principal Components are the orthonormal eigenvectors v_1, ..., v_k corresponding to the k largest eigenvalues of S.
  • Top k eigenvectors of covariance matrix S maximize projected variance (and minimize orthogonal reconstruction MSE); Variance Explained Ratio = sum_(i=1..k) lambda_i / Trace(S)
10In Database Management Systems (DBMS), how are 2NF, 3NF, and Boyce-Codd Normal Form (BCNF) defined using Functional Dependencies?2NF: no partial dependency; 3NF: X is superkey or A is prime (lossless + dependency-preserving); BCNF: X must be superkey (lossless, may lose FD preservation)Every relation can always be decomposed into 3NF with BOTH Lossless-Join AND Dependency Preservation, whereas BCNF decomposition is always Lossless-Join but NOT always Dependency-Preserving.
  • 2NF: no partial dependency; 3NF: X is superkey or A is prime (lossless + dependency-preserving); BCNF: X must be superkey (lossless, may lose FD preservation)
  • 2NF: no non-prime attribute is partially dependent on any candidate key; 3NF: for every non-trivial FD X -> A, either X is a superkey OR A is prime; BCNF: for every non-trivial FD X -> A, X is a superkey.
11In Classification Evaluation (GATE DA), how are Precision, Recall (Sensitivity), Specificity, F1-Score, and the ROC Curve defined from the Confusion Matrix?Precision = TP/(TP+FP); Recall (TPR) = TP/(TP+FN); FPR = FP/(FP+TN); F1 = 2PR/(P+R); ROC curve plots TPR (y-axis) vs. FPR (x-axis)Given TP = 40, FP = 10, FN = 30, and TN = 120, Precision = 40/50 = 0.80, Recall = 40/70 = 4/7, and F1-Score = 2(40)/(80 + 10 + 30) = 2/3.
  • Precision = TP / (TP + FP); Recall (TPR) = TP / (TP + FN); Specificity (TNR) = TN / (TN + FP); FPR = 1 - Specificity = FP / (FP + TN); F1-Score = 2*Precision*Recall / (Precision + Recall).
  • Precision = TP/(TP+FP); Recall (TPR) = TP/(TP+FN); FPR = FP/(FP+TN); F1 = 2PR/(P+R); ROC curve plots TPR (y-axis) vs. FPR (x-axis)
12How does a B+ Tree index differ structurally from a B-Tree in DBMS, and how is the maximum order p calculated for a disk block?B+ Tree: internal nodes hold only keys + child pointers (higher fan-out); all records/data pointers in linked leaf nodes (efficient range scans)Because B+ Tree internal nodes omit data pointers, they achieve a higher branching factor (fan-out p) and shallower tree height than B-Trees, and linked leaf nodes support O(log_p N + K) range queries.
  • B+ Tree: internal nodes hold only keys + child pointers (higher fan-out); all records/data pointers in linked leaf nodes (efficient range scans)
  • In a B+ Tree, internal nodes store only routing search keys and child block pointers (no data records), while ALL data record pointers reside in leaf nodes linked sequentially for fast range scans.
13What is Belady's Anomaly in page replacement, and why are LRU and Optimal page replacement immune to it?More physical frames -> more page faults (occurs in FIFO); LRU and Optimal satisfy the inclusion/stack property and are immune to Belady's AnomalyOptimal (Belady's MIN) replaces the page that will not be used for the longest period in the future (lowest page faults, non-implementable online), while LRU replaces the page least recently used in the past.
  • More physical frames -> more page faults (occurs in FIFO); LRU and Optimal satisfy the inclusion/stack property and are immune to Belady's Anomaly
  • Belady's Anomaly occurs when increasing allocated physical page frames increases page faults; FIFO suffers from Belady's Anomaly, whereas stack algorithms (LRU and Optimal) never suffer from it.
14What is the test for Lossless-Join Decomposition of R into R_1 and R_2, and how is Conflict Serializability tested in DBMS transactions?Lossless binary split: (R1 intersect R2) is a superkey of R1 or R2; Conflict Serializable <=> Precedence Graph has NO cycles (DAG)Two operations in different transactions conflict if they access the same data item X and at least one of them is a Write(X); topological sort of the acyclic precedence graph gives the equivalent serial order.
  • Decomposition of R into R_1 and R_2 is lossless iff (R_1 intersect R_2) is a superkey of R_1 or R_2; a schedule S is Conflict Serializable iff its Precedence (Serialization) Graph is acyclic (a DAG).
  • Lossless binary split: (R1 intersect R2) is a superkey of R1 or R2; Conflict Serializable <=> Precedence Graph has NO cycles (DAG)
15In Artificial Intelligence (GATE DA), when is a heuristic function h(n) Admissible vs. Consistent (Monotonic), and what does this guarantee for A* Search?Admissible: h(n) <= h*(n) (A* tree-search optimal); Consistent: h(n) <= c(n,n') + h(n') (A* graph-search optimal; Consistency => Admissibility)Every Consistent heuristic (with h(goal) = 0) is automatically Admissible by induction along the shortest path, and if h_1(n) and h_2(n) are admissible, then h(n) = max(h_1(n), h_2(n)) is also admissible and dominates both.
  • Admissible: h(n) <= h*(n) (A* tree-search optimal); Consistent: h(n) <= c(n,n') + h(n') (A* graph-search optimal; Consistency => Admissibility)
  • Using f(n) = g(n) + h(n), heuristic h(n) is Admissible if 0 <= h(n) <= h*(n) (never overestimates true optimal cost, guaranteeing A* Tree-Search optimality), and Consistent if h(n) <= c(n,n') + h(n').
16In Computer Networks, how do you compute usable hosts, subnet mask, and broadcast address in CIDR (Classless Inter-Domain Routing), and what is the Longest Prefix Match rule?/n prefix has h = 32 - n host bits -> 2^h - 2 usable hosts; routers select matching route with longest subnet mask (/n)Subdividing a /22 block into 8 equal subnets adds 3 prefix bits to produce eight /25 subnets, each having 32 - 25 = 7 host bits and 2^7 - 2 = 126 usable host addresses.
  • A /n CIDR block (n network bits, h = 32 - n host bits) provides 2^h total IPv4 addresses and (2^h - 2) usable hosts; routers resolve multiple matching prefixes using Longest Prefix Match.
  • /n prefix has h = 32 - n host bits -> 2^h - 2 usable hosts; routers select matching route with longest subnet mask (/n)
17How do Deterministic Context-Free Languages (DCFLs) differ from general CFLs, and what are canonical examples of Regular, DCFL, CFL-not-DCFL, and CSL languages?a^n b^n is DCFL; w w^R and {i=j or j=k} are CFL but not DCFL; a^n b^n c^n and {w w} are Context-Sensitive (not CFL).Unlike general CFLs, DCFLs are closed under Complement (by swapping accepting and non-accepting states of a loop-free DPDA), but DCFLs are NOT closed under Union, Intersection, or Kleene Star.
  • a^n b^n is DCFL; w w^R and {i=j or j=k} are CFL but not DCFL; a^n b^n c^n and {w w} are Context-Sensitive (not CFL).
  • a^n b^n is DCFL; w w^R and {i=j or j=k} are CFL but not DCFL; a^n b^n c^n and {ww} are Context-Sensitive (not CFL); every Regular language is DCFL
18How do Dijkstra's, Bellman-Ford, and Floyd-Warshall shortest-path algorithms compare in time complexity, design paradigm, and negative edge weight handling?Dijkstra: O((V+E)log V) greedy (no negative weights); Bellman-Ford: O(VE) DP (handles negative weights/detects negative cycles); Floyd-Warshall: O(V^3) all-pairs DPFor an unweighted graph (or equal positive edge weights), Breadth-First Search (BFS) computes single-source shortest paths in optimal O(V + E) linear time.
  • Dijkstra: O((V+E)log V) greedy (no negative weights); Bellman-Ford: O(VE) DP (handles negative weights/detects negative cycles); Floyd-Warshall: O(V^3) all-pairs DP
  • Dijkstra (Greedy): O((V + E) log V) with binary heap, fails on negative weight edges; Bellman-Ford (DP): O(V*E) single-source, handles negative weights and detects negative cycles; Floyd-Warshall: O(V^3).
19State the three cases of the Master Theorem for solving divide-and-conquer recurrences T(n) = a*T(n/b) + f(n) with a >= 1, b > 1.Let c = log_b(a): f(n) << n^c -> Theta(n^c); f(n) = Theta(n^c log^k n) -> Theta(n^c log^(k+1) n); f(n) >> n^c -> Theta(f(n))For MergeSort T(n)=2T(n/2)+n, n^(log_2 2)=n matches f(n)=n (Case 2, k=0), giving T(n)=Theta(n log n); Binary Search T(n)=T(n/2)+1 gives Theta(log n).
  • Let c = log_b(a): f(n) << n^c -> Theta(n^c); f(n) = Theta(n^c log^k n) -> Theta(n^c log^(k+1) n); f(n) >> n^c -> Theta(f(n))
  • Compare f(n) with n^(log_b a): Case 1: if f(n) = O(n^(log_b a - eps)), T(n) = Theta(n^(log_b a)); Case 2: if f(n) = Theta(n^(log_b a) * log^k n), T(n) = Theta(n^(log_b a) * log^(k+1) n); Case 3: Theta(f(n)).
20What is the relationship between complexity classes P, NP, NP-Hard, and NP-Complete, and how does polynomial-time reduction (A <=_p B) prove NP-Completeness?NP-Complete = NP intersect NP-Hard; to prove B is NP-Hard, reduce a known NP-Complete problem A to B in polynomial time (A <=_p B).3-SAT, Clique, Vertex Cover, Subset Sum, 0/1 Knapsack, Hamiltonian Cycle, and Graph 3-Colouring are NP-Complete, whereas 2-SAT, MST, Fractional Knapsack, and Eulerian Circuit are in P.
  • NP-Complete = NP intersect NP-Hard; to prove B is NP-Hard, reduce a known NP-Complete problem A to B in polynomial time (A <=_p B).
  • NP-Complete = NP intersect NP-Hard; to prove B is NP-Hard, reduce a known NP-Complete problem A to B in polynomial time (A <=_p B, never B <=_p A)
21In Theory of Computation, what is the Chomsky Hierarchy of formal languages, their recognizing automata, and key closure properties?Regular (DFA, closed under all) subset DCFL (closed under complement) subset CFL (PDA, not closed under intersection/complement) subset Recursive (closed under complement) subset RE (TM).A language L is Recursive (Decidable) if and only if BOTH L and its complement L_bar are Recursively Enumerable (Turing-Recognizable); also, the intersection of a Context-Free Language and a Regular Language is ALWAYS Context-Free.
  • Regular (closed under all) < DCFL (closed under complement, not union/intersection) < CFL (not closed under intersection/complement) < Recursive (closed under all) < RE (not closed under complement)
  • Regular (DFA, closed under all) subset DCFL (closed under complement) subset CFL (PDA, not closed under intersection/complement) subset Recursive (closed under complement) subset RE (TM).
22In Machine Learning (GATE DA), what is the Bias-Variance Decomposition of Expected Mean Squared Error (MSE), and how does model complexity affect Bias and Variance?MSE = Bias^2 + Variance + Irreducible Error; Underfitting = High Bias / Low Variance; Overfitting = Low Bias / High VarianceIn k-Nearest Neighbours (k-NN), increasing k from 1 to N increases Bias and decreases Variance (smoothing the boundary), whereas k = 1 yields zero training error and high variance.
  • MSE = Bias^2 + Variance + Irreducible Error; Underfitting = High Bias / Low Variance; Overfitting = Low Bias / High Variance
  • Expected Test Error E[(y - f_hat(x))^2] = Bias^2 + Variance + sigma_eps^2 (irreducible noise); underfitting produces High Bias / Low Variance, whereas overfitting produces Low Bias / High Variance.
23How do Ordinary Least Squares (OLS), Ridge Regression (L2), and Lasso Regression (L1) differ in objective function, closed-form solution, and feature selection?OLS: (X^T X)^(-1) X^T y; Ridge (L2): (X^T X + lambda*I)^(-1) X^T y (handles multicollinearity, no zeroing); Lasso (L1): sparse feature selection (exact zero weights)When predictors in X are highly collinear (X^T*X is singular or ill-conditioned), adding lambda*I in Ridge Regression shifts all eigenvalues of X^T*X by +lambda > 0, guaranteeing invertibility and numerical stability.
  • OLS minimizes ||y - X*beta||_2^2 with beta_hat = (X^T*X)^(-1)*X^T*y; Ridge adds L2 penalty lambda*||beta||_2^2 with beta_ridge = (X^T*X + lambda*I)^(-1)*X^T*y; Lasso adds L1 penalty for sparsity.
  • OLS: (X^T X)^(-1) X^T y; Ridge (L2): (X^T X + lambda*I)^(-1) X^T y (handles multicollinearity, no zeroing); Lasso (L1): sparse feature selection (exact zero weights)
24In Support Vector Machines (SVM), what is the geometric margin width between the supporting hyperplanes w^T*x + b = +1 and w^T*x + b = -1, and what role do Support Vectors and the Kernel Trick play?Geometric margin between w^T x + b = ±1 is 2/||w||_2; only Support Vectors have Lagrange multipliers alpha_i>0, and Mercer kernels compute high-dimensional inner products.Moving any non-support vector (where y_i*(w^T*x_i + b) > 1 and alpha_i = 0) arbitrarily far away without crossing the margin boundary leaves the optimal SVM hyperplane w* and b* completely unchanged.
  • Geometric margin between w^T x + b = ±1 is 2/||w||_2; only Support Vectors have Lagrange multipliers alpha_i>0, and Mercer kernels compute high-dimensional inner products.
  • Margin width = 2 / ||w||; primal minimizes (1/2)||w||^2 + C*sum(xi_i); only Support Vectors have alpha_i > 0; RBF Kernel K(x,z) = exp(-gamma*||x-z||^2) maps to infinite dimensions
25How do QuickSort, MergeSort, and HeapSort compare in worst-case time complexity, auxiliary space complexity, and stability?MergeSort: O(n log n) time, O(n) space, stable; HeapSort: O(n log n) time, O(1) space, unstable (build-heap O(n)); QuickSort: O(n^2) worst, O(n log n) avgQuickSort hits its O(n^2) worst case when the pivot repeatedly splits an n-element array into sizes (n - 1) and 0 (e.g., sorted input with first-element pivot), giving T(n) = T(n - 1) + O(n).
  • MergeSort: O(n log n) time, O(n) space, stable; HeapSort: O(n log n) time, O(1) space, unstable (build-heap O(n)); QuickSort: O(n^2) worst, O(n log n) avg
  • MergeSort: O(n log n) worst-case time, O(n) auxiliary space, Stable; HeapSort: O(n log n) time, O(1) in-place space, Unstable (Build-Max-Heap is O(n)); QuickSort: O(n log n) average, O(n^2) worst-case.
26What are the three requirements of the Critical Section Problem, and how do Counting Semaphores (wait/P and signal/V) track blocked processes?Mutual Exclusion + Progress + Bounded Waiting; Semaphore value S = S_0 - wait_count + signal_count (negative value -k means k processes blocked in queue)Peterson's two-process software solution satisfies all three requirements (Mutual Exclusion, Progress, and Bounded Waiting) under sequential consistency.
  • Critical Section requires: 1. Mutual Exclusion (always), 2. Progress (no deadlock when CS is free), and 3. Bounded Waiting (no starvation); Counting Semaphore S = S_0 - P(wait) + V(signal).
  • Mutual Exclusion + Progress + Bounded Waiting; Semaphore value S = S_0 - wait_count + signal_count (negative value -k means k processes blocked in queue)
27In Deep Learning & Optimization (GATE DA), why does the Sigmoid activation sigma(z) = 1/(1 + e^(-z)) cause the Vanishing Gradient Problem, and how does ReLU(z) = max(0, z) resolve it?Sigmoid derivative sigma(z)(1-sigma(z)) <= 0.25 shrinks deep backpropagation gradients exponentially, whereas ReLU(z)=max(0,z) maintains a constant gradient of 1 for all z>0.For Binary Logistic Regression with sigmoid output y_hat = sigma(w^T x + b), minimizing Binary Cross-Entropy Loss L = -[y ln(y_hat) + (1 - y) ln(1 - y_hat)] is strictly convex.
  • Sigmoid derivative sigma(z)(1-sigma(z)) <= 0.25 shrinks deep backpropagation gradients; ReLU(z) = max(0, z) has gradient 1 for z > 0; Cross-Entropy loss is convex for logistic regression
  • Sigmoid derivative sigma(z)(1-sigma(z)) <= 0.25 shrinks deep backpropagation gradients exponentially, whereas ReLU(z)=max(0,z) maintains a constant gradient of 1 for all z>0.
28What are the four necessary Coffman conditions for Deadlock, and what is the minimum number of resources needed to guarantee deadlock-free execution?Coffman: Mutual Exclusion, Hold & Wait, No Preemption, Circular Wait; Deadlock-free condition: R >= sum(Max_i - 1) + 1 (Deadlock Avoidance uses Banker's Algorithm)If 4 processes each need at most 3 tape drives, the maximum number of drives that can still deadlock is 4(3 - 1) = 8, and 8 + 1 = 9 drives guarantee deadlock freedom.
  • 1. Mutual Exclusion, 2. Hold and Wait, 3. No Preemption, and 4. Circular Wait; if n processes each require at most k_i instances of a single resource type, deadlock is impossible iff R >= sum(k_i - 1) + 1.
  • Coffman: Mutual Exclusion, Hold & Wait, No Preemption, Circular Wait; Deadlock-free condition: R >= sum(Max_i - 1) + 1 (Deadlock Avoidance uses Banker's Algorithm)
29How do Strict Two-Phase Locking (Strict 2PL), Basic 2PL, and Timestamp Ordering behave regarding Serializability, Cascading Rollbacks, and Deadlock?2PL: conflict serializable (can deadlock); Strict 2PL: holds X-locks till commit -> conflict serializable + cascadeless + recoverable; Timestamp Ordering: deadlock-freeRigorous 2PL holds BOTH Shared (read) and Exclusive (write) locks until transaction commit, producing a schedule where commit order matches serialization order.
  • 2PL: conflict serializable (can deadlock); Strict 2PL: holds X-locks till commit -> conflict serializable + cascadeless + recoverable; Timestamp Ordering: deadlock-free
  • Basic 2PL guarantees Conflict Serializability but suffers from Deadlock and Cascading Rollbacks; Strict 2PL holds all Exclusive (write) locks until Commit/Abort, guaranteeing Cascadeless & Recoverable schedules.
30How is a physical memory address partitioned into Tag, Index, and Block Offset bits in Direct-Mapped, k-Way Set-Associative, and Fully Associative Caches?Block Offset b=log_2(Block_Size); Set Index s=log_2(Cache_Lines/k); Tag = Address_Bits - s - b; Tag Directory = Cache_Lines × (Tag + status bits).For a 32-bit address, 64 KB 4-way set-associative cache, and 64-byte block: Offset b=6 bits, Sets S=1024/4=256 (Index s=8 bits), and Tag = 32-8-6 = 18 bits.
  • Block Offset b=log_2(Block_Size); Set Index s=log_2(Cache_Lines/k); Tag = Address_Bits - s - b; Tag Directory = Cache_Lines × (Tag + status bits).
  • Offset b = log2(Block_Size); Index s = log2(Cache_Lines / k); Tag = Address_Bits - s - b; Total Tag Directory Size = Cache_Lines x (Tag_Bits + Valid/Dirty_Bits)
31How do Decision Trees select splitting attributes using Shannon Entropy (Information Gain) vs. Gini Impurity?Shannon Entropy H = -sum p_i*log_2(p_i) (max 1 bit for binary at p=0.5) and Gini Impurity = 1 - sum(p_i^2) (max 0.5 at p=0.5).For a binary node with 4 positive and 4 negative examples (p = 0.5), Shannon Entropy H = -2(0.5 log_2 0.5) = 1.0 bit, and Gini Impurity = 1 - (0.25 + 0.25) = 0.50.
  • Entropy H = -sum p_i log2(p_i) (binary max = 1 bit at p=0.5); Gini = 1 - sum(p_i^2) (binary max = 0.5 at p=0.5); split chooses attribute maximizing impurity reduction
  • Shannon Entropy H = -sum p_i*log_2(p_i) (max 1 bit for binary at p=0.5) and Gini Impurity = 1 - sum(p_i^2) (max 0.5 at p=0.5).
32How does TCP Congestion Control adjust Congestion Window (cwnd) and Slow-Start Threshold (ssthresh) during Slow Start, Congestion Avoidance, 3 Duplicate ACKs, and Timeout?Slow Start doubles cwnd per RTT; Congestion Avoidance adds +1 MSS per RTT; Timeout resets cwnd=1 MSS (ssthresh=cwnd/2); 3 Duplicate ACKs halve cwnd to ssthresh.If cwnd = 32 MSS and a Timeout occurs, ssthresh becomes 16 MSS and cwnd resets to 1 MSS; if 3 Duplicate ACKs occur at 32 MSS, cwnd halves directly to 16 MSS.
  • Slow Start: exponential (x2 per RTT); Congestion Avoidance: linear (+1 MSS per RTT); Timeout -> ssthresh = cwnd/2, cwnd = 1 MSS; 3 Dup ACKs -> ssthresh = cwnd/2, cwnd = cwnd/2
  • Slow Start doubles cwnd per RTT; Congestion Avoidance adds +1 MSS per RTT; Timeout resets cwnd=1 MSS (ssthresh=cwnd/2); 3 Duplicate ACKs halve cwnd to ssthresh.