Indicate all the true statements from the following:
View worked solution
Answer: A;D
Let us analyze each statement individually to determine its correctness:
-
Recursive descent parsing cannot be used for grammar with left recursion.
True: Top-down parsers, including recursive descent, cannot handle left-recursive grammars because a production of the form leads to an infinite loop of function calls for non-terminal without consuming any input. -
The intermediate form for representing expressions which is best suited for code optimization is the postfix form.
False: Postfix notation (reverse Polish notation) is linear and lacks explicit structure, making it difficult to perform optimizations like common subexpression elimination, loop optimization, or register allocation. Three-address code (TAC) or Directed Acyclic Graphs (DAGs) are much better suited for code optimization. -
A programming language not supporting either recursion or pointer type does not need the support of dynamic memory allocation.
False: Even without recursion or pointers, a language may support features like dynamic arrays (where the array size is determined at runtime) or dynamic string manipulation, which require dynamic memory allocation (e.g., on the heap or dynamic stack). -
Although C does not support call-by-name parameter passing, the effect can be correctly simulated in C.
True: Call-by-name can be simulated in C using thunks. A thunk is a parameterless function passed as an argument (via a function pointer) that evaluates the expression in the caller's context whenever the parameter is referenced in the callee. -
No feature of Pascal typing violates strong typing in Pascal.
False: Pascal has variant records (specifically, untagged variant records) which allow different types of data to share the same memory space without runtime type-safety checks. This violates strong typing.
Thus, the true statements are A and D.
Free practice · Your answers on this page are not saved.
