logo

Octal Integer literal (OIL)

Instructions for regularizing, tokenizing, and scanning the Midterm Test for CST8152 - COMPILERS course at DRACOM.

9 Pages1927 Words21 Views
   

Added on  2022-09-02

Octal Integer literal (OIL)

Instructions for regularizing, tokenizing, and scanning the Midterm Test for CST8152 - COMPILERS course at DRACOM.

   Added on 2022-09-02

ShareRelated Documents
MIDTERM TEST
CST8152 – COMPILERS – Section 10

STUDENT NAME:
__________________________________________________
Please print clearly

STUDENT ID:
__________________________________________________
TEST INSTRUCTIONS:

The Midterm Test consists of 30 questions. At the end of test there are three bonus
questions. You may replace with the bonus question any one of the preceding compulsory
questions.

Every properly answered question is worth 1.0. The test counts for 30% of your final grade.

Read each question carefully before you answer. You have 55 minutes to complete the
test and 5 minutes to submit on Brightspace. Late tests will not be accepted.

Work at a steady pace and you will have ample time to finish. When answering the true-
false and multiple-choice questions you must click on the Answer box under the question
and select the appropriate letter. If the question have a text field, must type your answer
in the text filed. If the question is indicated with an M, it has more than one correct
answer. In the Multiple Answers text field you have to enter the letter which are in front of
the appropriate options (for example: c, d, e).

Save your work time to time.

When you are finished save your document.

Next step is to sign the finished test. If you do not know how to do that,

the SigningMidterm.pdf document (posted on Brightspace) contains instruction how to do
that.

Once you sign the Midterm you have to upload the signed pdf on Brightspace.

Good luck, and do not forget that:

“ THE PROMISE OF THE FUTURE LIES NOT IN TECHNOLOGY BUT IN YOU!”

Professor: Svillen Ranev,

March 2020
Octal Integer literal                                 (OIL)_1
CST8152 Compilers Midterm Test
Page 2 of 9

1. Which one of the following is a list of typical compiler components?

a. lexical analyzer, syntax analyzer, semantic analyzer, code optimizer

b. preprocessor, scanner, semantic analyzer, code generator

c. lexical analyzer, parser, assembler, symbol table

d. lexical analyzer, syntax analyzer, loader/linker, code optimizer

e. all of the above are components

Answer:

2. Here is a T-shaped tombstone diagram, where P, M and C are different languages.

The diagram above represents

a. an interpreter written in language P.

b. a compiler written in language C.

c. a compiler written in language P.

d. an interpreter written in language C.

Answer:

3. The compiler front end includes these parts (phases) of a compiler that depend on the
source language, and are in general independent of the target machine.

a. True b. False

Answer:

4. Several phases of compilation are usually implemented in a single pass consisting of
reading an input file and writing an output file.

a. True b. False

Answer:

5. An interpreter is a compiler that does not produce a target program as a result of the
translation.

a. True b. False

Answer:

P

C

M
Octal Integer literal                                 (OIL)_2
CST8152 Compilers Midterm Test
Page 2 of 9

6. A context free grammar has four components

1. A set of __________, known as ________________ symbols.

2. A set of ____________________________.

3. A set of ____________________________.

4. A designation of one of the ______________ as a _________ symbol.

7. Which of following is not a property of a parse tree?

a. Each leaf represents one production.

b. Each leaf is labeled by a token.

c. Each interior node is labeled by a nonterminal.

e. The root is labeled by the start symbol.

f. all of the above are properties.

Answer:

8. What is an ambiguous grammar?

A grammar that can generate

____________________________________________________________________

____________________________________________________________________

9. Given the grammar

<exp> -> <exp> +< exp> | <exp> * <exp >|< factor>

<factor> -> a | b | c | d | 0 | 1 | 2 | 3

Write at least 5 strings that belong to the language defined by the grammar.

________________________________________________________________

10. When a compiler is written in the language it compiles, the process of writing (building)

the compiler is called _______________________________.

11. How do the parse trees for left-associative and right-associative operators differ?

The parse tree for the right-associative operators grows towards the _________,

whereas the parse tree for the left-associative operators grows toward the _________.
Octal Integer literal                                 (OIL)_3

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Data Type And String in Python Report
|9
|2149
|24

Python Program Structure Analysis
|6
|1191
|28

ECONOMICS 2150b-001 Intermediate Microeconomic Theory 2022
|12
|2748
|18

Secure Software Engineering
|41
|6066
|423

Applied Biostatistics Problem Solving Assignment
|3
|966
|468