GATE 2026 (Session 1)
65 questions
MCQ 28 · MSQ 24 · NAT 131-mark 30 · 2-mark 35
Questions 26–30 of 65
Let be a nondeterministic finite automaton (NFA) with states over a finite alphabet.
Which of the following options CANNOT be the number of states in the minimal deterministic finite automaton (DFA) that is equivalent to ?
Which of the following options CANNOT be the number of states in the minimal deterministic finite automaton (DFA) that is equivalent to ?
One or more options are correct.
Answer: (B), (D)
Use the subset construction. An NFA with states gives a DFA with at most states, one for each subset of NFA states. Minimizing can only reduce the number of states. For the minimal DFA has at most states.
- 65 and 128 are more than 64, so they CANNOT be the size of the minimal DFA.
- 1 is possible: a 6-state NFA whose states all accept and loop on every symbol accepts all strings, and its minimal DFA has 1 state.
- 32 is possible: the language "the 5th symbol from the end is a" has a 6-state NFA (stay in the start state on any symbol, guess the 5th-from-last a, then move through 4 more states). Its minimal DFA needs states, because it must remember the last 5 symbols.
Answer: (B), (D)
- 65 and 128 are more than 64, so they CANNOT be the size of the minimal DFA.
- 1 is possible: a 6-state NFA whose states all accept and loop on every symbol accepts all strings, and its minimal DFA has 1 state.
- 32 is possible: the language "the 5th symbol from the end is a" has a 6-state NFA (stay in the start state on any symbol, guess the 5th-from-last a, then move through 4 more states). Its minimal DFA needs states, because it must remember the last 5 symbols.
Answer: (B), (D)
Consider the following C statements:
char *str1 = "Hello; /* Statement S1 */
char *str2 = "Hello;"; /* Statement S2 */
int *str3 = "Hello"; /* Statement S3 */
Which of the following options is/are correct?
char *str1 = "Hello; /* Statement S1 */
char *str2 = "Hello;"; /* Statement S2 */
int *str3 = "Hello"; /* Statement S3 */
Which of the following options is/are correct?
One or more options are correct.
Answer: (C)
— the closing double-quote of the string literal is missing. A string literal that is not closed is a lexical error, because the lexer/scanner cannot build a valid string token.
— this is a valid string literal (it has a semicolon character inside) given to a pointer. There is no error here.
— this is fine lexically and syntactically (a valid string literal and a valid statement form). But it gives a value to a pointer of the wrong type, . This is a type mismatch, so it is a semantic error (found in semantic/type analysis, not in parsing).
Answer: S1 has a lexical error, and S3 has a semantic error.
— this is a valid string literal (it has a semicolon character inside) given to a pointer. There is no error here.
— this is fine lexically and syntactically (a valid string literal and a valid statement form). But it gives a value to a pointer of the wrong type, . This is a type mismatch, so it is a semantic error (found in semantic/type analysis, not in parsing).
Answer: S1 has a lexical error, and S3 has a semantic error.
Which of the following statements is/are true?
One or more options are correct.
Answer: (C)
- (A) "LL(1) parser uses backtracking" — false. LL(1) is a predictive top-down parser and needs no backtracking. It picks the production by reading just one lookahead symbol.
- (B) "For LL(1), the grammar must be left-recursive" — false. It is the opposite. A left-recursive grammar can never be LL(1), because it would cause infinite recursion in the predictive parser. So left recursion must be removed first.
- (C) "For LL(1), the grammar must be left-factored" — true. Suppose two productions of a non-terminal begin with the same prefix. Then the parser cannot choose between them using one lookahead symbol. Left-factoring removes this problem, so a grammar that needs it is not LL(1) until it is done.
- (D) "LL(1) parsers are more powerful than SLR parsers" — false. The two classes of grammars are incomparable, and neither contains the other. Some SLR(1) grammars are not LL(1), for example any left-recursive one such as . Some LL(1) grammars are not SLR(1), for example . So LL(1) is not simply "more powerful".
Answer: (C)
- (B) "For LL(1), the grammar must be left-recursive" — false. It is the opposite. A left-recursive grammar can never be LL(1), because it would cause infinite recursion in the predictive parser. So left recursion must be removed first.
- (C) "For LL(1), the grammar must be left-factored" — true. Suppose two productions of a non-terminal begin with the same prefix. Then the parser cannot choose between them using one lookahead symbol. Left-factoring removes this problem, so a grammar that needs it is not LL(1) until it is done.
- (D) "LL(1) parsers are more powerful than SLR parsers" — false. The two classes of grammars are incomparable, and neither contains the other. Some SLR(1) grammars are not LL(1), for example any left-recursive one such as . Some LL(1) grammars are not SLR(1), for example . So LL(1) is not simply "more powerful".
Answer: (C)
With respect to deadlocks in an operating system, which of the following statements is/are FALSE?
One or more options are correct.
Answer: (A), (C)
Let us check each statement about deadlocks:
- "Banker's algorithm is used to prevent deadlocks" — FALSE. Banker's algorithm is a deadlock-avoidance algorithm. It checks resource requests as they come, so the system stays in a safe state. Deadlock prevention means different techniques. They remove one of the four necessary conditions (mutual exclusion, hold-and-wait, no pre-emption, circular wait).
- "Deadlock formation can be prevented by disallowing hold-and-wait" — true. This is a standard deadlock-prevention technique, because one of the four necessary conditions is removed.
- "An assignment edge in a resource-allocation graph is marked from a process to a resource" — FALSE. It is the other way round. An assignment edge goes from a resource to a process, which means the resource is given to the process. A request edge goes from a process to a resource.
- "A safe state guarantees all processes can finish without deadlock" — true. This is exactly what a safe state means.
Answer (the FALSE statements): "Banker's algorithm prevents deadlocks", and "an assignment edge goes from process to resource."
- "Banker's algorithm is used to prevent deadlocks" — FALSE. Banker's algorithm is a deadlock-avoidance algorithm. It checks resource requests as they come, so the system stays in a safe state. Deadlock prevention means different techniques. They remove one of the four necessary conditions (mutual exclusion, hold-and-wait, no pre-emption, circular wait).
- "Deadlock formation can be prevented by disallowing hold-and-wait" — true. This is a standard deadlock-prevention technique, because one of the four necessary conditions is removed.
- "An assignment edge in a resource-allocation graph is marked from a process to a resource" — FALSE. It is the other way round. An assignment edge goes from a resource to a process, which means the resource is given to the process. A request edge goes from a process to a resource.
- "A safe state guarantees all processes can finish without deadlock" — true. This is exactly what a safe state means.
Answer (the FALSE statements): "Banker's algorithm prevents deadlocks", and "an assignment edge goes from process to resource."
Let and be the attributes of a relation in a relational schema. Let indicate functional dependency in the context of a relational database, where .
Which of the following options is/are always true?
Which of the following options is/are always true?
One or more options are correct.
Answer: (C), (D)
Check each claim with Armstrong's axioms (reflexivity, augmentation, transitivity):
- (A) Given {P,Q}→{R} and {P}→{R}, does {Q}→{R} follow? No. {P}→{R} already gives {P,Q}→{R} by augmentation, so the premises do not force {Q}→{R}. Not always true.
- (B) Given {P,Q}→{R}, does {P}→{R} or {Q}→{R} follow? No. {R} may need P and Q together. For example, R may depend on the pair but on neither attribute alone. Not always true.
- (C) Given {P}→{R} and {Q}→{S}, does {P,Q}→{R,S} follow? Yes. Augment {P}→{R} with Q to get {P,Q}→{R,Q}. Augment {Q}→{S} with P to get {P,Q}→{P,S}. Reflexivity gives {R,Q}→{R} and {P,S}→{S}. With transitivity this gives {P,Q}→{R} and {P,Q}→{S}. The union rule then gives {P,Q}→{R,S}. Always true.
- (D) Given {P}→{R}, does {P,Q}→{R} follow? Yes, directly by the augmentation axiom. Adding Q to the left side of a valid FD keeps it valid. Always true.
Answer: (C), (D)
- (A) Given {P,Q}→{R} and {P}→{R}, does {Q}→{R} follow? No. {P}→{R} already gives {P,Q}→{R} by augmentation, so the premises do not force {Q}→{R}. Not always true.
- (B) Given {P,Q}→{R}, does {P}→{R} or {Q}→{R} follow? No. {R} may need P and Q together. For example, R may depend on the pair but on neither attribute alone. Not always true.
- (C) Given {P}→{R} and {Q}→{S}, does {P,Q}→{R,S} follow? Yes. Augment {P}→{R} with Q to get {P,Q}→{R,Q}. Augment {Q}→{S} with P to get {P,Q}→{P,S}. Reflexivity gives {R,Q}→{R} and {P,S}→{S}. With transitivity this gives {P,Q}→{R} and {P,Q}→{S}. The union rule then gives {P,Q}→{R,S}. Always true.
- (D) Given {P}→{R}, does {P,Q}→{R} follow? Yes, directly by the augmentation axiom. Adding Q to the left side of a valid FD keeps it valid. Always true.
Answer: (C), (D)