Department of Computer Science
University of Karachi
BSCS- Compiler Construction
Q1) Select true or false of the following.
Q2) Select one from the following- MCQs
1. In C, the term ``white space'' means:
a. A single space, tab or new-line character.
b. Several spaces, tabs or new-line characters.
c. Any combination of spaces, tabs and new-line characters.
d. All of the above.
Your answer: ______
2. What is the value of the integer expression: 1 - 3 * 5 + 6 / 4 % 2
a. 0
b. -6
c. -8
d. -13
Your answer: ______
3. By the rules of short-circuit evaluation, in the following expression,
p || ( n < style="">
a. if p is true, then n <> will not be evaluated.
b. if p is false, then n <> will not be evaluated.
c. if p is true, then n <> will be evaluated.
d. None of the above.
Your answer: ______
4. If p and q are Boolean variables, which expression is equivalent to the following expression?
! ( p || q)
a. !p || !q
b. p || q
c. !p && !q
d. p && q
Your answer: ______
Q3) Give unambiguous grammar of Algebraic expressions that parse +, -, *, / and ^ operators as well as ++ increment and -- decremetn operator.
Q4) Give selection set of the grammar of Q1.
Q5) Give grammar that parse the following patterns.
a) 1n 0n
b) 1n0m1m0n
Q6) Give attributed translation grammar that parse if / else construct and generate appropriate jump, conditional jump and label intermediate instructions.
No comments:
Post a Comment