HamroCSIT Logo
HAMRO CSIT
  • Course New
  • Entrance
    • Entrance Preparation
    • MCQ Questions
    • Colleges
    • Entrance Class
    • Entrance Books
    • Free Entrance Video Course
  • Semester
    • First Semester
    • Second Semester
    • Third Semester
    • Fourth Semester
    • Fifth Semester
    • Sixth Semester
    • Seventh Semester
    • Eight Semester
  • Questions
  • Subscription Automated
  • Notices
  • Articles
  • More
    • Ask Question
    • College Ambassadors
    • Financial Support Program
    • Contribute
    • Contact Us
Login Register
Hamro CSIT User Account
  • Sign In
  • Create Account


Shape | Hamro CSIT Shape | Hamro CSIT Shape | Hamro CSIT Shape | Hamro CSIT
Subject

Compiler Design and Construction

This course is designed to develop acquaintance with fundamental concepts of compiler design. The course starts with the basic concepts and also includes different phases of compilers like lexical analysis, syntax analysis, syntax-directed translation, type checking etc. in detail.

Subject Image | Hamro CSIT
  • Chapters
  • Syllabus
  • Question Banks
  • Questions
  • Text Book
  • Practical
  • Viva
Page navigation
  • «
  • Current Page 1
  • Page 2
  • Page 3
  • Page 4
  • Last »
  • »
HamroCSIT User
How do you define optimal solution? Does greedy algorithm always guarantee optimal solution? Given the string “SUPER_DUPER_CSIT”, use a Greedy algorithm to build a Huffman tree.
Not Answered Compiler Design and Construction
HamroCSIT User
Explain the role of lexical analyzer in compiler design. What is input buffering? Describe the buffer-pair scheme with sentinels and explain why it is efficient.

Design a lexical analyzer using transition diagram that recognizes:

  • Identifiers (letter followed by letters/digits)
  • Integer constants
  • Operators: +, -, *, /, <, <=, >, >=, ==, =
  • Keywords: if, then, else, while

Show the transition diagram and write pseudocode for the nextToken() function.

Not Answered Compiler Design and Construction
HamroCSIT User
Write short notes on:

a) Type checking: Static vs Dynamic type checking with examples
b) Synthesized vs Inherited attributes with expression evaluation example

Not Answered Compiler Design and Construction
HamroCSIT User
Construct the flow graph for the following code and identify all basic blocks:

  1. read x
  2. i = 1
  3. sum = 0
  4. prod = 1
  5. if i > x goto 13
  6. square = i * i
  7. sum = sum + square  
  8. prod = prod * i
  9. i = i + 1
  10. if i <= x goto 6
  11. write sum
  12. write prod
  13. halt

Identify loop invariant code that can be moved out of the loop, if any.

Not Answered Compiler Design and Construction
HamroCSIT User
What is peephole optimization? Explain the following peephole optimization techniques with examples:

  • Redundant load/store elimination
  • Constant folding
  • Strength reduction
  • Use of machine idioms

Apply these optimizations to the following assembly code:

MOV R0, a

MOV b, R0

MOV R0, b

ADD R0, R0, #0

MUL R0, R0, #2

MOV R1, #10

ADD R1, R1, #5

MOV R2, #0

ADD R2, R2, R1

Not Answered Compiler Design and Construction
HamroCSIT User
Draw and explain the complete structure of an activation record with all components (return value, actual parameters, control link, access link, saved machine status, local data, temporaries).

Show the activation tree and activation record contents for the following code at the point when factorial(1) is executing:

int factorial(int n) {

    if (n <= 1)

        return 1;

    return n * factorial(n-1);

}

int main() {

    int x = factorial(3);

}

Not Answered Compiler Design and Construction
HamroCSIT User
What is a symbol table? Compare different data structures for implementing symbol table:

  • Linear list
  • Hash table
  • Binary search tree

Which is most efficient and why?

Show hash table implementation for storing the following identifiers using hash function h(x) = (sum of ASCII values) mod 7:

Identifiers: {sum, count, avg, total, temp}

Use chaining for collision resolution.

Not Answered Compiler Design and Construction
HamroCSIT User
Construct the operator-precedence relations (⋖, ≐, ⋗) for the following grammar:

E → E + T | T

T → T * F | F

F → (E) | idBuild the complete operator-precedence table. Parse the string id + id * id using this table showing all stack operations.

Not Answered Compiler Design and Construction
HamroCSIT User
What are closure and goto operations in LR parsing? Compute the closure of the following LR(0) item set:

I₀ = {[S’ → •S, $]}

Grammar:

S → AB

A → aA | b

B → c

Then compute GOTO(I₀, a) showing all steps.

Not Answered Compiler Design and Construction
HamroCSIT User
What is a macro? Differentiate between macro and procedure. Explain macro expansion with example.

Show the complete macro expansion for:

#define SQUARE(x) ((x) * (x))

#define MAX(a, b) ((a) > (b) ? (a) : (b))

#define CUBE(x) (SQUARE(x) * (x))

result = MAX(SQUARE(3), CUBE(2));

Not Answered Compiler Design and Construction
Page navigation
  • «
  • Current Page 1
  • Page 2
  • Page 3
  • Page 4
  • Last »
  • »
Question's Answer
Solution Video
Solution
Share

Share this link via

Or copy link

logoHAMROCSIT

Hamro CSIT is a comprehensive web and mobile platform that provides B.Sc. CSIT students with resources like notes, syllabi, question banks, solved past papers, practical files, and free entrance preparation materials — all in one place.

  • [email protected]
Semester
  • First Semester
  • Second Semester
  • Third Semester
  • Fourth Semester
  • Fifth Semester
  • Sixth Semester
  • Seventh Semester
  • Eighth Semester
Links
  • About Us
  • FAQs
  • Sitemap
  • Privacy Policy
  • Terms and Conditions
  • College Ambassadors
  • Financial Support Program
Hits Counter
20230290
Google Play App Store
Follow Us

Copyright 2026 | HAMROCSIT | All Right Reserved

Official Payment Partner Esewa Logo
HAMROCSIT.COM

Copyright 2024 | HAMROCSIT.COM | All Right Reserved - Nymna Technology