πŸ“š

GATE CS - Previous Year Questions

Previous-year GATE CS prompts for practice β€” options only until official keys are verified

142 questions15 pages~213 min

Practice with previous-year prompts and options. Official answer keys are not shown here yet β€” mark your choice, then verify against the IIT key PDF.

Use this track for exam reading speed and elimination practice until verified keys are linked.

Progress: 0 / 1420%
Page 15 of 15 β€’ Questions 141-142 of 142
Practice mode: questions and options only. Official IIT answer keys are not linked here yet β€” mark your choice, then cross-check the official key yourself.
Q141medium

[GATE CS 2024 Set-2 Q41] Let 𝑀 be the 5-state NFA with πœ–-transitions shown in the diagram below. Which one of the following regular expressions represents the language accepted by 𝑀 ?

Q142medium

[GATE CS 2024 Set-2 Q42] Consider an array X that contains n positive integers. A subarray of X is defined to be a sequence of array locations with consecutive indices. The C code snippet given below has been written to compute the length of the longest subarray of X that contains at most two distinct integers. The code has two missing expressions labelled (P) and (Q). int first=0, second=0, len1=0, len2=0, maxlen=0; for (int i=0; i < n; i++) { if (X[i] == first) { len2++; len1++; } else if (X[i] == second) { len2++; len1 = (P); second = first; } else { len2 = (Q); len1 = 1; second = first; } if (len2 > maxlen) { maxlen = len2; } first = X[i]; } Which of the following options correctly fills (P) and (Q)?