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) | Example | Multiple-Choice Options |
|---|---|---|---|---|
| 1 | In 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 fairness | Starvation 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. |
|
| 2 | In 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). |
|
| 3 | In 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. |
|
| 4 | How 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. |
|
| 5 | In 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. |
|
| 6 | What 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. |
|
| 7 | How 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 Bias | In 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%. |
|
| 8 | In 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. |
|
| 9 | How 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. |
|
| 10 | In 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. |
|
| 11 | In 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. |
|
| 12 | How 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. |
|
| 13 | What 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 Anomaly | Optimal (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. |
|
| 14 | What 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. |
|
| 15 | In 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. |
|
| 16 | In 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. |
|
| 17 | How 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. |
|
| 18 | How 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 DP | For an unweighted graph (or equal positive edge weights), Breadth-First Search (BFS) computes single-source shortest paths in optimal O(V + E) linear time. |
|
| 19 | State 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). |
|
| 20 | What 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. |
|
| 21 | In 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. |
|
| 22 | In 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 Variance | In 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. |
|
| 23 | How 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. |
|
| 24 | In 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. |
|
| 25 | How 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) avg | QuickSort 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). |
|
| 26 | What 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. |
|
| 27 | In 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. |
|
| 28 | What 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. |
|
| 29 | How 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-free | Rigorous 2PL holds BOTH Shared (read) and Exclusive (write) locks until transaction commit, producing a schedule where commit order matches serialization order. |
|
| 30 | How 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. |
|
| 31 | How 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. |
|
| 32 | How 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. |
|