GATE 2016 (Session 2)
65 questions
MCQ 38 · NAT 271-mark 30 · 2-mark 35
Questions 26–30 of 65
The number of states in the minimum sized DFA that accepts the language defined by the regular expression
(0+1)* (0+1)(0+1)*
is _______.
(0+1)* (0+1)(0+1)*
is _______.
Answer: 2
The expression gives every string that is not empty. The minimum DFA needs a start state that is not final (because the empty string is not accepted). It also needs one final state that loops on both 0 and 1.
Answer: 2
Answer: 2
Language L1 is defined by the grammar:
Language L2 is defined by the grammar:
Consider the following statements:
P: L1 is regular
Q: L2 is regular
Which one of the following is TRUE?
Language L2 is defined by the grammar:
Consider the following statements:
P: L1 is regular
Q: L2 is regular
Which one of the following is TRUE?
Answer: (C)
Let us look at each statement in turn:
- : the language must count the letters so it is not regular (P is false).
- it is regular (Q is true).
Answer: P is false and Q is true
- : the language must count the letters so it is not regular (P is false).
- it is regular (Q is true).
Answer: P is false and Q is true
Consider the following types of languages: :Regular, :Context-free, :Recursive, :Recursively enumerable.
Which of the following is/are TRUE?
I. is recursivelyenumerable
II. is recursive
III. is context-free
IV. is context-free
Which of the following is/are TRUE?
I. is recursivelyenumerable
II. is recursive
III. is context-free
IV. is context-free
Answer: (D)
- I: is recursive (recursive languages are closed under complement), so it is also RE. is RE, and RE languages are closed under union, so the union is RE. True.
- II: every CFL is recursive (it has a decider that always halts, such as CYK), so is recursive. Recursive languages are closed under complement, so is recursive, and the union of two recursive languages is recursive. True.
- III: is regular (closed under star), so it is a CFL, and the union of two CFLs is a CFL. True.
- IV: CFLs are not closed under complement, so need not be a CFL. Take (regular) and (a CFL). Then , which is not a CFL. False.
Answer: (D)
- II: every CFL is recursive (it has a decider that always halts, such as CYK), so is recursive. Recursive languages are closed under complement, so is recursive, and the union of two recursive languages is recursive. True.
- III: is regular (closed under star), so it is a CFL, and the union of two CFLs is a CFL. True.
- IV: CFLs are not closed under complement, so need not be a CFL. Take (regular) and (a CFL). Then , which is not a CFL. False.
Answer: (D)
Match thefollowing:
Answer: (B)
- P. Lexical analysis (iii) regular expressions. Token patterns are written as regular expressions.
- Q. Top-down parsing (i) leftmost derivation. A top-down parser expands the leftmost non-terminal first, so it traces a leftmost derivation.
- R. Semantic analysis (ii) type checking. Type checking is a main part of semantic analysis.
- S. Runtime environments (iv) activation records. The runtime environment keeps an activation record for each procedure call.
This is P-iii, Q-i, R-ii, S-iv.
Answer: (B)
- Q. Top-down parsing (i) leftmost derivation. A top-down parser expands the leftmost non-terminal first, so it traces a leftmost derivation.
- R. Semantic analysis (ii) type checking. Type checking is a main part of semantic analysis.
- S. Runtime environments (iv) activation records. The runtime environment keeps an activation record for each procedure call.
This is P-iii, Q-i, R-ii, S-iv.
Answer: (B)
In which one of the following page replacement algorithms it is possible for the page fault rate to increase even when the number of allocated frames increases?
Answer: (D)
This effect is called Belady's anomaly, and it occurs with FIFO. LRU, OPT and MRU are stack algorithms. When the frames increase, the set of pages kept in memory only becomes larger, so the faults never go up.
Answer: FIFO
Answer: FIFO