Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
34 views
5 pages
Compiler Construction
Compiler construction. Learning NDF DFA
Uploaded by
HOME OF TRADERS
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save Compiler construction For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
34 views
5 pages
Compiler Construction
Compiler construction. Learning NDF DFA
Uploaded by
HOME OF TRADERS
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save Compiler construction For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 5
Search
Fullscreen
Y ABA COLLEGE OF TECHNOLOGY { SCHOOL OF TECHNOLOGY COMPUTER TECHNOLOGY DEPARTMENT - 2022/2023 SESSION FIRST SEMESTER (FULL TIME) EXAMINATION I CLASS: HND Il (Computer Science) Time Allowed: 3:90 Hours” | | Paper Code: COM 414 Title: Compiler Construction | | INSTRUCTION: There should be no jotting, writing or any inscription on the question paper, except the candidate's name and registration number where applicable. It is exam malpractice to bring phone — | into the examination venue. “ATTEMPT QUESTIONS 3,5 AND ANY OTHER THREE QUESTIONS | QUBSTION ONE ' | (@) Describe the compilation process | () Briefly describe the various types of translators | © Highlight any Five () good qualities of a compiler | | QUESTION TWO |. a) Enumerate the components that make up the syntax of a grammar b) List and describe the types of grammars ©) Given the grammar G with following production rules j S-a | aS | bS, : | Determine whether the following strings can be generated, the grammar E |. i) babaab y | i) aaabbbab : ‘ () Ina compiler, keywords of a languagje'are recognized during (A) _ parsing of the program ».;(B) the code generation (©) the lexical analysisofthe program | (D) _ data-flow analysi | (i) The lexical analysis for'a mddern computer language such as Java needs the power of | i | | ( | QUESTION THREE which one of the fSllwing machine models is necessary and sufficient sense (A); Finite stdte automata (B) Deterministic pushdown automata | | (© | Non-Détérministic pushdown automata (0) Tanne Mate | 8). How many tokens willbe generated bythe scanner fof the following statemen? @b 2 @® 1 fG.10. Onade |. Gv) Whiff Bitise‘of compiler generates stream of atoms? { posSyntax Analysis (B) Lexical Analysis (“Code Generation (D) Code Optimization | ty \Wwhith data structure in a-compiler is used for managing information about variables and j ~“ their attributes? (A) Abstract syntax tree (B) Symbol tree. | | (©) Semantic stack (D) Symbol table | | vi) Symbol table can be used for: “ { (A) Checking type compatibility a | (B) Suppressing duplication of error message (C) Storage allocation (D) Alllof these { \ (A) parsing of the program {B) the code generation | (i) Ina compiler, keywords of a language are recognized during 1 Page 1 0f 5 |[ (©) the lexical analysis of the program (D)_ data flow analysis (vii) Consider the following statements: (Q). The output of a lexical analyzer is groups of characters. (Q) Total number of tokens in printf("ir%d,4i=%x",iéei); arel. (HD _ Symbol table can be implemented by using array and hash table but not tree. Which of the above staterent(s) is/are correct? (A) Only) @) Only(jand() (©) AN(),(M1),and(l) (D) None of these (&) Consider the grammar defined by the following production rules, with two operators +and + S->T*P Fe>u| TU P->Q+P|Q / - Q-> ld | U->ld + ‘ | Which one of the following is TRUE? | (A) _ +is left associative, while «is right associative (B) + is right associative, while tis left associative eS (©) Both +and sare right associative : (D) Both + and sare left associative ‘ (x) The grammar A> AA | (A) | €is not suitable for predictive-parsing because the grammar is? (A) ambiguous (B)__left-recursive(Ch.\ riglit-recursive (D)- Aand B (xi) Whatis the output of the lexical analyser? (A) aparse tree (B) list of tokens (C)/ihtertiediate code (D) machine code }) The action of parsing the source program inte proper syntactic classes is called (A) General syntax analysis (B) Interpretation analysis (©) Syntax analysis (D) Lexical'analysis : ) A compiler which allows only the modified section of the source code to be recompiled is called (A) Subjective compiter (8) Dynamic compiler (CY Re-configurable compiler (D) Incremental compiler aco | (xiv) A top-down parser generates : | | (A) Left-most derivation in reverse (B) Left-most derivation | (C) Right-most derivation in reverse (D) Right -most derivation | (xv) The most general phase structured grammar (A) Context sensitive (B) Context free (C) Regular (D) None of these (xvi) Which of the following class of statement usually produces no executable code i when compiled? ‘ (A) Assignment statement (B) Structural statements (C) Input and output statements (D) Declaration (xvii) Interpreter is preferred over a compiler is (A) During program development phase . (B) When storage space is to be minimized Page 2 of 5(C) When efficient use of computer resources is the consideration (D) All of these Which of the following is used for grouping of characters into tokens? (A) Scanner (B) Code generator (©) Code optimizer () Parser | (xix) _____ is considered as a sequence of characters in a token. | (A) Pattern (B) Texeme (C) Lexeme (D) Mexeme | 60) —_ or scanning is the process, where the stream of characters making, up the | source program is read from left to right and grouped into tokens |. (a) Modeting (B) Diversion | (C) Lexical analysis (D) All of these { & | beciell r | QUESTION FOUR | @) Describe briefly the formal definition of context free grammed | (b) Define each of the following terminologies: 2 | 1 (i) Derivation (ii) Leftmost Derivation (iii) Rightmost Derivation (iv) Parse Tree 2 , | © Explain the following types of errors in compiler. 1 @ Lexical error (i) Syntax error 5 | Gil) Semantic error (iv) Logical error e | QUESTION FIVE ( {| @ | Choose from letter options A-D, the one which bgt ‘answered questions 1 - 20 | ki | @ __Which is the correct NFA for the following mentioned expression? (ab)* | (a f | | Pot C I | ‘d) None of the mentioned } | | if | | (i) A System program that combines separately compiled modules of a program into | i | | | form suitable for execution is a) Assembler_b) Linking loader c) Cross compiler d) None of the mentioned ii) A compiler for a high-level language that runs on one machine and produces code for a | different machine is called a) Optimizing compiler b) One pass compiler ©) Cross compiler d) Multipass compiler (iv) Which of these does not belong to CFG? a) Terminal Symbol b} Non terminal Symbol c) Start symbol ) End Symbol Page 3 ofrc (@) The output of lexical analyzer is _a) A set of RE) Syntax Tree ¢) Set of Tokens 4) String Character (vi) Another Name for Lexical Analyser is ____ a) Linear Phase b) Linear Analysis c) Scanner) Allof the mentioned (wil) Regular expression x/y denotes the set ___ 2) (xy! ) fy} «) tx) ) 9) (viii) The symbol table implementation is based on the property of locality of reference is 4) Linear list b) Search tree ¢) Hash Table d) Self Organization {WA bottom up parser generates _ a a) Right most derivation b) Rightmost derivation in reverse ¢) Leftmostderivation d) Leftmost derivation in reverse (09 Object program is a ____ a) Program written in machirie language by-Fregram © be tgenslated to machine language c) Translation of high-level language into:machiné language 4) None of the mentioned (xi) Which of the following pairs of regular expressions are equivalent? 2) 101)" and (10)*1. b) x (xx)" and (ex)*x c) x* and x* x) d) All of tHechehtioned (xii) The lexical analyzer takes ‘as input and produces a strearof > __as putput. 2) Source program, tokens b) Token, source program ¢) Eittieeithe two d) None of the ‘mentioned (aii) Which of the following is not feature of compiler?_a) Scan the entire program first and translate into machine code b) To remove syntax eprors_c) Slow for debugging 4) Execution time is more : ? (xiv) Which of the following is NOT the set of regularexpression R = (ab + abb)* bheb? 32) ababbbbab b) abbbab c)ababbabbbab d) abababab fv) Consider the production of the grammar SAA Aaa Ac>bb Describe the language ‘specified by the 7 production grammar. a) L= [aaaaaabb,bbaa,bbbb} b) L =.{abe ‘Byala aaab,baaa}_c) L = {aaab,baba,bbaa,bbbo} faaaa,ababbbaa,aaab} > (xvi) $-> aSa| bSb| a| b; the language generated by the above grammar is the set of 1a) All paliridromes. b) All odd Jength palindromes c) Strings ‘beginning and ending with the same symbol d) All everrfength palindromes (xvii) Match the following: Group 1 < Group 2 P, Regular expressions “1. Syntax analysis Q.Pushdownautomaté 2, Code generation R Dataflow analysis 3. Lexical analysis 5, Registérallocation _4. Code optimization a}P4,QTR2,53 b)P-3,Q1,R4S2 0) P3,Q4,R4,S-2 d)P-2,Q-1,R4,S-3 (wvilil{ Which one is a type of Lexeme___a) Identifiers._b) Constants ¢) Keywords ) All of the mentioned : (xix) When expression sum=3+2 is tokenized then what is the token category of 3 7 ') Identifier b) Assignment operator c) Integer Literal d) Addition Operator (02) A grammar for a programming language is a formal description of : ‘a)Syntax b)Semantics. c) Structure d) Library “Question SIX (a) Describe the following compiler terms: Page 4 of 5 —(i Token (i) Lexeme (iii) Pattern (iv) Recognizer (b) What are the basic steps required to design Lexical Analyzer manually? (© Given the grammar production, (1) $+ Xd | rZd, (2) Z— ea Joa, (3) X — ai; describe the backtracking behavior of a top-down parser with respect to the input string: “road” QUESTION SEVEN (a) Convert the NFA with ¢ into its equivalent DFA. | () (i) What are the five basic operations mostly performed by the synfibol+table in a compiler? (b) (il) What is a parse tree? > .QUESTION EIGHT @) Consider the Grammar, G: > TE >+TE* |e | SPT, Cw Do 4ET' fe ; F-->id] (E) : | +e denotes epsilon | | @_ Compote FIRST and fOLLOW/or each of the non-terminals of the above grammar. | (i) Construct a parsing’table-for G above (b) Explain the role ofemntic analyzer in a compiler ‘ : : | 1 Page § of 5
You might also like
UGRD-CS6207 Programming Languages With Compiler
PDF
No ratings yet
UGRD-CS6207 Programming Languages With Compiler
9 pages
22uai22 DL Mid I 125 Bits
PDF
No ratings yet
22uai22 DL Mid I 125 Bits
40 pages
CD Bits
PDF
No ratings yet
CD Bits
13 pages
Compiler Construction MCQs-1
PDF
31% (13)
Compiler Construction MCQs-1
12 pages
Compiler Design Pyqs
PDF
No ratings yet
Compiler Design Pyqs
20 pages
Compiler MCQ (MCA 504A)
PDF
No ratings yet
Compiler MCQ (MCA 504A)
23 pages
One Mark
PDF
No ratings yet
One Mark
18 pages
Compiler Choice Chap 1 - 2
PDF
No ratings yet
Compiler Choice Chap 1 - 2
5 pages
Compilers Theory
PDF
No ratings yet
Compilers Theory
16 pages
N MN (M+N)
PDF
No ratings yet
N MN (M+N)
13 pages
Complier Design
PDF
No ratings yet
Complier Design
7 pages
MCQ - CD
PDF
No ratings yet
MCQ - CD
8 pages
ECS-603 Put 13-14 Sol
PDF
No ratings yet
ECS-603 Put 13-14 Sol
24 pages
BIT - R - 5 - Comp and Design Const - Sept 2022
PDF
No ratings yet
BIT - R - 5 - Comp and Design Const - Sept 2022
8 pages
CD QB
PDF
No ratings yet
CD QB
9 pages
Quiz With Answers
PDF
No ratings yet
Quiz With Answers
12 pages
Compiler Mcqs
PDF
No ratings yet
Compiler Mcqs
10 pages
Quiz 1-V1-Solution
PDF
No ratings yet
Quiz 1-V1-Solution
4 pages
Branch:Cse Sem:6 Faculty:A.K.Rout
PDF
No ratings yet
Branch:Cse Sem:6 Faculty:A.K.Rout
36 pages
CD Mcqs
PDF
No ratings yet
CD Mcqs
36 pages
CD Objectives
PDF
No ratings yet
CD Objectives
3 pages
Btcoc601 Y20
PDF
No ratings yet
Btcoc601 Y20
3 pages
Tabish Ali 3045
PDF
No ratings yet
Tabish Ali 3045
8 pages
Compiler Construction Tools & Introduction To LA
PDF
No ratings yet
Compiler Construction Tools & Introduction To LA
5 pages
CS3501 CD Qb-Unit 1
PDF
No ratings yet
CS3501 CD Qb-Unit 1
6 pages
Cs1352 Principles of Compiler Design
PDF
No ratings yet
Cs1352 Principles of Compiler Design
33 pages
CS606 FinalTerm 2016 MCQs
PDF
No ratings yet
CS606 FinalTerm 2016 MCQs
38 pages
Review Questions
PDF
No ratings yet
Review Questions
5 pages
Question Bank Part A, Part B&C
PDF
No ratings yet
Question Bank Part A, Part B&C
15 pages
CD Question Bank - docx-DESKTOP-QNU354E-1
PDF
No ratings yet
CD Question Bank - docx-DESKTOP-QNU354E-1
16 pages
Principles of Compiler Design
PDF
No ratings yet
Principles of Compiler Design
36 pages
CS606 FinalTerm MCQs With Reference Solved by Arslan
PDF
100% (1)
CS606 FinalTerm MCQs With Reference Solved by Arslan
37 pages
CD Question Bank Unit 1
PDF
No ratings yet
CD Question Bank Unit 1
6 pages
Compiler Counstruction MCQ Question Bank PDF
PDF
No ratings yet
Compiler Counstruction MCQ Question Bank PDF
14 pages
CS 6660 Compiler Design
PDF
No ratings yet
CS 6660 Compiler Design
7 pages
CD Quiz-I
PDF
No ratings yet
CD Quiz-I
2 pages
2 3 Marks
PDF
No ratings yet
2 3 Marks
24 pages
2A English File
PDF
No ratings yet
2A English File
2 pages
CC QB
PDF
No ratings yet
CC QB
7 pages
VMKV Engineering College Department of Computer Science & Engineering Principles of Compiler Design Unit I Part-A
PDF
No ratings yet
VMKV Engineering College Department of Computer Science & Engineering Principles of Compiler Design Unit I Part-A
80 pages
Model Question Answer Compiler Design
PDF
No ratings yet
Model Question Answer Compiler Design
8 pages
Compiler Design Question Bank - Unit I
PDF
No ratings yet
Compiler Design Question Bank - Unit I
8 pages
CC MCQs
PDF
No ratings yet
CC MCQs
22 pages
Compiler Mcqs (Org)
PDF
No ratings yet
Compiler Mcqs (Org)
39 pages
Complier Design Gate Question
PDF
No ratings yet
Complier Design Gate Question
22 pages
Compiler Gold
PDF
No ratings yet
Compiler Gold
46 pages
Compiler Contruction QB PDF
PDF
No ratings yet
Compiler Contruction QB PDF
7 pages
Compiler Design
PDF
No ratings yet
Compiler Design
9 pages
6062 Question Paper
PDF
No ratings yet
6062 Question Paper
2 pages
Compiler Design QB - UNIT1
PDF
No ratings yet
Compiler Design QB - UNIT1
14 pages
Compiler Exam Sample Questions
PDF
No ratings yet
Compiler Exam Sample Questions
17 pages
CS6660 Compiler Design Question Bank
PDF
100% (3)
CS6660 Compiler Design Question Bank
10 pages
V - Cse - CS3501 - CD - QB - Unit 1
PDF
No ratings yet
V - Cse - CS3501 - CD - QB - Unit 1
5 pages
Compiler Mcqs Last Updated Solved Complete
PDF
No ratings yet
Compiler Mcqs Last Updated Solved Complete
57 pages
PB CD Sem-VI 2024
PDF
No ratings yet
PB CD Sem-VI 2024
37 pages
Workbook CD, CN & OS
PDF
No ratings yet
Workbook CD, CN & OS
119 pages