Self Studies

Compiler Design...

TIME LEFT -
  • Question 1
    2 / -0.33

    Consider the following syntax directed definition:

    Production

    Semantic Rule

    T →  FT’

    T’.val = F.val

    T’ * FT’1

    T’.val = T’1.val  * F.val

     

    The above SDD is

  • Question 2
    2 / -0.33

    Consider the following grammar where capital letter is non-terminal and smaller letter are terminal

    X → P Q R | y z Q | Q x | Q

    P → ax | PQ

    Q → b | ϵ

    R → c | ϵ

    What is the number of terminals in the FIRST of X?

    (if epsilon is present include it)

  • Question 3
    2 / -0.33

    What will be the result of following code after constant propagation?

    int x =4;

    int y = x * 2;

    int z = a[y];

  • Question 4
    2 / -0.33

    Consider the grammar given below

    → TE’

    E' → +TE' | ϵ

    → FT'

    T' → *FT' | ϵ

    → (E) | id

    Which of the following terminal symbol will be present in FOLLOW(F)?

  • Question 5
    2 / -0.33

    Match all items in Group 1 correct option from those given in Group 2.

    Group 1

    Group 2

    P. Intermediate representation

    1. Activation records

    Q. Top-down parsing

    2. Code generation

    R. Runtime environments

    3. Leftmost derivation

    S. Register allocation

    4. Graph coloring

  • Question 6
    2 / -0.33

    The number of tokens in the following C statement is

    int i  = 10;

    float b = 12.0;

    printf("x = %i, y = %f", i++, ++b);

  • Question 7
    2 / -0.33

    Find the Left factoring of a grammar

    S → iEtS | iEtSeS | a  

    E → b

  • Question 8
    2 / -0.33

    Consider the following grammar:

    S → aS'

    S' → aS' | ϵ 

    Which of the following is/are true for the above grammar?

  • Question 9
    2 / -0.33

    Consider the following code segment:

    p = q – r

    s = r + t

    p = s + p

    s = a + s

    What it the minimum number of total variables required to convert the above code segment to static single assignment?

  • Question 10
    2 / -0.33

    Look at the below given code in C – program.

    int main()

    {

    int i  = 10;

    whlie(i--)

    printf(“TESTBOOK\n”);

    }

    Identity the compiler’s response about the above given code while creating the object- module

  • Question 11
    2 / -0.33

    Consider the below given grammar

    S → L | M

    L → c | b

    M → b | a

    where S is the start symbol also S, L, and M are non-terminal while x, y, z is terminal symbol.

    Consider the predictive parsing table find the production for R1 and R2 respectively

     

    a

    b

    c

    $

    S

    S → M

    R1

    S → L

     

    L

     

    L → b

    R2

     

    M

    M → a

    B → b

     

     

  • Question 12
    2 / -0.33

    Which of the following statement about peephole optimization is/are correct?

  • Question 13
    2 / -0.33

    Consider the following grammar:
    S → pAS | r
    A → q

    Find the number of reduction steps taken by a bottom-up parser while accepting the string "pqpqpqpqr"?

  • Question 14
    2 / -0.33

    Consider the following statements, which of the following is/are TRUE?

  • Question 15
    2 / -0.33

    Consider the following statements in the C language –

    for( i = 7 ; i ≤ 923 ; i++ )

    {

          x = a + b × c;

    }

    Here, 3 address code for the above code is given.

    1000:  i=7

    1001:  if i ≤ 923 goto   

    1002:  goto  Q

    1003:  t1 = b × c

    1004:  t2 = a + t1

    1005:  x = t2

    1006:  i = i + 1

    1007:  goto   R

    1008:  end

    Find the value of P, Q and R in the given 3 address code.

  • Question 16
    2 / -0.33

    Consider the following grammar and the semantic actions to support the L-attributed declaration attributes. Let A1, A2, A3, A4, A5 be the placeholders for the non- terminals S, X, Y or Z in the following table:

    Production rule

    Semantic action

    S → X Y

    A1.val = A2.val

    X.val → +

    Y.val = +

    X.val → -

    Y.val = -

    Y → Z,id

    A3.val = A4.val

    Z → id

    addType(id.entry, A5.val)


    Which one of the following is the appropriate choices for A1, A2, A3, A4, and A5?

Submit Test
Self Studies
User
Question Analysis
  • Answered - 0

  • Unanswered - 16

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
Submit Test
Self Studies Get latest Exam Updates
& Study Material Alerts!
No, Thanks
Self Studies
Click on Allow to receive notifications
Allow Notification
Self Studies
Self Studies Self Studies
To enable notifications follow this 2 steps:
  • First Click on Secure Icon Self Studies
  • Second click on the toggle icon
Allow Notification
Get latest Exam Updates & FREE Study Material Alerts!
Self Studies ×
Open Now