List of top Computer Science and IT Engineering Questions

Consider the following two syntax-directed definitions SDD1 and SDD2 for type
declarations.
๐ท is the start symbol, and ๐‘–๐‘›๐‘ก, ๐‘“๐‘™๐‘œ๐‘Ž๐‘ก and ๐‘–๐‘‘ are the three terminals. The non-terminal
๐‘‰1 is the same as ๐‘‰ and the non-terminal ๐ท1 is the same as ๐ท. Here, the subscript is
used to differentiate the grammar symbols on the two sides of a production. The
function ๐‘๐‘ข๐‘ก updates the symbol table with the type information for an identifier.
Let P and Q be the languages specified by grammars G1 and G2, respectively.
Which of the following statements is/are true?
SDD1
Grammar
(G1)
Semantic Rules
๐ท โ†’๐‘‡ ๐‘‰
๐ท. ๐‘ก๐‘ฆ๐‘๐‘’ = ๐‘‡. ๐‘ก๐‘ฆ๐‘๐‘’
๐‘‰. ๐‘ก๐‘ฆ๐‘๐‘’ = ๐‘‡. ๐‘ก๐‘ฆ๐‘๐‘’
๐‘‡ โ†’ ๐‘–๐‘›๐‘ก
๐‘‡. ๐‘ก๐‘ฆ๐‘๐‘’ = ๐‘–๐‘›๐‘ก
๐‘‡ โ†’ ๐‘“๐‘™๐‘œ๐‘Ž๐‘ก
๐‘‡. ๐‘ก๐‘ฆ๐‘๐‘’ = ๐‘“๐‘™๐‘œ๐‘Ž๐‘ก
๐‘‰โ†’๐‘‰1 ๐‘–๐‘‘
๐‘‰1. ๐‘ก๐‘ฆ๐‘๐‘’= ๐‘‰. ๐‘ก๐‘ฆ๐‘๐‘’
๐‘๐‘ข๐‘ก(๐‘–๐‘‘. ๐‘’๐‘›๐‘ก๐‘Ÿ๐‘ฆ, ๐‘‰. ๐‘ก๐‘ฆ๐‘๐‘’)
๐‘‰ โ†’ ๐‘–๐‘‘
๐‘๐‘ข๐‘ก(๐‘–๐‘‘. ๐‘’๐‘›๐‘ก๐‘Ÿ๐‘ฆ, ๐‘‰. ๐‘ก๐‘ฆ๐‘๐‘’)
SDD2
Grammar
(G2)
Semantic Rules
๐ทโ†’๐ท1 ๐‘–๐‘‘
๐ท. ๐‘ก๐‘ฆ๐‘๐‘’= ๐ท1. ๐‘ก๐‘ฆ๐‘๐‘’
๐‘๐‘ข๐‘ก(๐‘–๐‘‘. ๐‘’๐‘›๐‘ก๐‘Ÿ๐‘ฆ, ๐ท1. ๐‘ก๐‘ฆ๐‘๐‘’)
๐ท โ†’ ๐‘‡ ๐‘–๐‘‘
๐ท. ๐‘ก๐‘ฆ๐‘๐‘’ = ๐‘‡. ๐‘ก๐‘ฆ๐‘๐‘’
๐‘๐‘ข๐‘ก(๐‘–๐‘‘. ๐‘’๐‘›๐‘ก๐‘Ÿ๐‘ฆ, ๐‘‡. ๐‘ก๐‘ฆ๐‘๐‘’)
๐‘‡ โ†’๐‘–๐‘›๐‘ก
๐‘‡. ๐‘ก๐‘ฆ๐‘๐‘’ = ๐‘–๐‘›๐‘ก
๐‘‡ โ†’ ๐‘“๐‘™๐‘œ๐‘Ž๐‘ก
๐‘‡. ๐‘ก๐‘ฆ๐‘๐‘’ = ๐‘“๐‘™๐‘œ๐‘Ž๐‘ก

Consider the following pseudocode for depth-first search (DFS) algorithm which
takes a directed graph ๐บ(๐‘‰, ๐ธ) as input, where ๐‘‘[๐‘ฃ] and ๐‘“[๐‘ฃ] are the discovery time
and finishing time, respectively, of the vertex ๐‘ฃ โˆˆ๐‘‰.
๐ท๐น๐‘†(๐บ):
๐‘ข๐‘›๐‘š๐‘Ž๐‘Ÿ๐‘˜ ๐‘Ž๐‘™๐‘™ ๐‘ฃโˆˆ๐‘‰
๐‘ก โ†0
๐‘“๐‘œ๐‘Ÿ ๐‘’๐‘Ž๐‘โ„Ž ๐‘ฃโˆˆ๐‘‰
๐‘–๐‘“ ๐‘ฃ ๐‘–๐‘  ๐‘ข๐‘›๐‘š๐‘Ž๐‘Ÿ๐‘˜๐‘’๐‘‘
๐‘กโ†๐ธ๐‘ฅ๐‘๐‘™๐‘œ๐‘Ÿ๐‘’(๐บ, ๐‘ฃ, ๐‘ก)
๐‘’๐‘›๐‘‘ ๐‘–๐‘“
๐‘’๐‘›๐‘‘ ๐‘“๐‘œ๐‘Ÿ
๐ธ๐‘ฅ๐‘๐‘™๐‘œ๐‘Ÿ๐‘’(๐บ, ๐‘ฃ, ๐‘ก):
๐‘š๐‘Ž๐‘Ÿ๐‘˜ ๐‘ฃ
๐‘ก โ†๐‘ก+ 1
๐‘‘[๐‘ฃ] โ†๐‘ก
๐‘“๐‘œ๐‘Ÿ ๐‘’๐‘Ž๐‘โ„Ž (๐‘ฃ, ๐‘ค) โˆˆ๐ธ
๐‘–๐‘“ ๐‘ค ๐‘–๐‘  ๐‘ข๐‘›๐‘š๐‘Ž๐‘Ÿ๐‘˜๐‘’๐‘‘
๐‘กโ†๐ธ๐‘ฅ๐‘๐‘™๐‘œ๐‘Ÿ๐‘’(๐บ, ๐‘ค, ๐‘ก)
๐‘’๐‘›๐‘‘ ๐‘–๐‘“
๐‘’๐‘›๐‘‘ ๐‘“๐‘œ๐‘Ÿ
๐‘ก โ†๐‘ก + 1
๐‘“[๐‘ฃ] โ†๐‘ก
๐‘Ÿ๐‘’๐‘ก๐‘ข๐‘Ÿ๐‘› ๐‘ก
Suppose that the input directed graph ๐บ(๐‘‰, ๐ธ) is a directed acyclic graph (DAG).
For an edge (๐‘ข, ๐‘ฃ) โˆˆ๐ธ, which of the following options will NEVER be correct?