0% found this document useful (0 votes)
40 views

Quiz2 Result

This document appears to be a quiz for a compiler construction course. It contains 19 multiple choice questions testing knowledge of topics like the steps in a compiler, semantic analysis, code optimization, memory hierarchies, object oriented programming, and parsing. The questions require understanding of concepts like tokens, lexems, syntax trees, intermediate code representations, and context free grammars.

Uploaded by

api-3812391
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Quiz2 Result

This document appears to be a quiz for a compiler construction course. It contains 19 multiple choice questions testing knowledge of topics like the steps in a compiler, semantic analysis, code optimization, memory hierarchies, object oriented programming, and parsing. The questions require understanding of concepts like tokens, lexems, syntax trees, intermediate code representations, and context free grammars.

Uploaded by

api-3812391
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Quiz 2, Compiler Construction, 10.4.

08 : check one ore more, O: check only one in choice

Name____________________________________________ Number___________________

1) Compiler Construction concerns about (within other):


O Design of programming languages
character stream
O Design of translator systems for languages
x building converter for programs
Lexical analyzer
2) Name steps and intermediate results of a compiler (inc.
token stream
Opt. and Asm.)
Fill up the graphic at the right side. (7p)
Syntax analyzer
3) The compiler does:
syntax tree
O one analysis step, one synthesis step
O two analysis steps, one synthesis step Semantic analyzer
X tree analysis steps, one synthesis step
O one analysis steps, two synthesis steps syntax tree
4) "=" Intermediate Code Generator
O is a token
x is a lexem Intermediate representation
O is a syntax tree fragment
Machine-Independent
5) a token consist of Code Optimizer
O <token-name, attribute-value>
x <token-identifier, attribute > intermediate representation
O <attribute-value pair>
O "<" symbol, symbol name, ">" symbol Code Generator

6) the optimizer target-machine code


x reduces number of temporary variables
x reduces the number of opcodes Machine-Dependent
 improves bubble-sort to quicksort Code Optimizer

7) Ambiguity
x allows more than one meaning of one expression Executable Program
 is well suited together with predicted parsing
x should be avoided

8) a context free grammar consist of


x some terminal symbols
 some start symbols
 only one terminal symbol
 some reduction rules
x some nonterminal symbols
x some production rules

9) The result of the optimizer path should be (first goal)


O a fast program
x a correct program
O calculated in short time
Name____________________________________________ Number___________________

10) semantic sugar


O is enrichment with necessary lexical elements
x means e.g. to have 3 types of loops, even as one is enough
O are comments in programs
O is a cake for computer scientists

11) Memory hierarchy (L1 Cache, L2 Cache, Main memory):


O AMD Athlon64 has no, but Intel Core2Duo has two of them
x is transparent and hidden in the CPU, but some optimizer cares about for optimisation of speed
O it is not possible to do any optimisations regarding caches

12) Object oriented Programming


O supports capsulation into modules
O collection of objects that interact with memory
O 1. Generation: Simula 67, 2. Generation: Smalltalk 80,
x 2G: C++, C#, Java, Ruby

13) Regarding compiling


x some issues are decided at compile time: static aspects
O some issues are decided at compile time: dynamic aspects
O the compiler just does the translation, all decisions about the program are done during execution

14) The semantic analyzer


O does not need to care about scope of variables
x has to care about variable types
O has to report an error if the program contains a variable named "for"

15) assignments
x are right associativ
O are left associativ
O are no associativ at all

16) three-address-code contains of


O operations with tree addresses as parameter
O operations with tree values as parameter
x operations with tree values as parameter referenced by addresses

17) The first function


O returns a set of nonterminals, which can be derived
O returns a set of terminals, which can not be derived from a rule
x can be used to select a rule

18) 1) A->B, 2) B->a 3) B->b, the first function of 1) is


O {a}
O {b}
x {a,b}

19) the grammar from 18


x can be used for predicted parsing
O can not be used for predicted parsing
O can not be modified in order to be used for predicted parsing

You might also like