Computer Science EngineeringHard
In the dangling-else problem, the usual resolution is to associate an else with
- A. the nearest unmatched if
- B. the first if in the statement
- C. the outermost if
- D. no if at all
Correct answer: A. the nearest unmatched if
Most languages bind else to the closest preceding if that does not yet have an else.
Practise more Theory of Computation, Compilers & Digital Logic (ISRO CS) questionsTheory of Computation, Compilers & Digital Logic (ISRO CS): notes and key points
More Theory of Computation, Compilers & Digital Logic (ISRO CS) questions
- A shift-reduce conflict in an LR parser means that in some state the parser
- For a fixed grammar in Chomsky normal form, the CYK algorithm decides membership of a string of length n in time
- The language {a^n b^n c^n | n >= 1} belongs to which smallest class?
- How many strings of length 3 over {a, b} contain 'ab' as a substring?
- Which regular expression over {a, b} is equivalent to (a+b)?
- The minimal complete DFA over {a, b} for strings with no two consecutive a's has how many states (including the dead state)?