CS606 Current FinalTerm Paper 28 August 2016


CS606 Current FinalTerm Paper 28 August 2016

  1. A tree was given, In-order traversal was required.

  2. What are characteristics of Live Variables?

  3. What does the compiler need to consider when applying optimization?

  4. In main memory what type of information is stored in data segment?

  5. How can compiler transformation improve program?

  6. What is the use of Address descriptor in Code Generation algorithm?

  7. A table with left column filled with terms, and right column filled with meanings of terms was given. It was required to match the term in the left column to its meaning on the right.

  8. Bottom-Up parsing of "abbcbcde" was required. The grammar was as follows...
    S → aABe
    A → ABc | b
    B → d
  9. Identify the error in the following code…
    main()
    {
    int *p;
    p = error();
    }
    int *error()
    {
    int I=23;
    return & I;
    }

  10. Consider the following grammar productions. Suppose you have an attribute E.type which can be set to either INT or BOOL. Assume that the type of an expression is set to INT if an error is detected and you have a routine msg() similar to printf() that can be used to print error message.
    E → CONST   {E.type=??}
      | ID     {E.type =getType(ID.name);}
      | E1+E2   {E.type=??}
      | E1<E2   {E.type=??}
      | E1==E2  {E.type=??}
      | (E1)    {E.type=??}
    Provide the parse tree for the expression (5<2) == (4+x).

  11. Write syntax-directed definition to determine the type of each sub-expression by considering the following grammar. Assign an attribute “type”.  The given grammar can generate expressions as when two operands are added, result of the expression will be int; otherwise, it will be float. If expression has no operator, resultant expression will have same type as constant on right side have.
    E → E + E | T
    T → num . num | num

Welcome to Our WebSite! - | Virtual Ning | Pakistan NO # 1 . Website for the Students of Virtual University.

Next
Previous
Click here for Comments

0 comments: