Operating System Exam paper, Exams of Operating Systems

This was university exam and assignments

Typology: Exams

2021/2022

Uploaded on 12/04/2022

shariar-parvez-tonmoy
shariar-parvez-tonmoy 🇨🇳

5 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Volume A
2021 2022 Final exam for the first semester
The Principles of Compiler
For 19lc 软工 1,18lq 软工 1 Open book
题号
题分
20
10
30
10
30
得分
Note: If the student number, name and class are not written, not all written or
written outside the sealing line, the test paper will be invalidated.
一、 Fill in the blanks (2 points for each sub-question, 20 points in total)
1 In analysis phase, an intermediate representation is created from the given source
program. Lexical Analyzer , Syntax Analyzer and Semantic Analyzer are the
parts of this phase.
2 identifiers, operators, keywords, numbers, delimiters and so on are used to
describe tokens (lexical constructs)
3 A parse tree describes a syntactic structure.In a parse tree, all terminals are at
leaves.All inner nodes are non-terminals in a context free grammar.
4 When programming in a high-level language, target program and
error messages of the source program can be found by compiler.
5 Top-Down Parsing:Construction of the parse tree starts at the at the root and
proceeds towards the the leaves. .
name
PARVEZ 朴维
线
number
1911562106
Student Class
19lc 软工 1
注意
pf3
pf4
pf5

Partial preview of the text

Download Operating System Exam paper and more Exams Operating Systems in PDF only on Docsity!

Volume :A

2021 — 2022 Final exam for the first semester

The Principles of Compiler

(For 19 lc 软工 1,1 8 lq 软工 1 ) Open book

Note: If the student number, name and class are not written, not all written or written outside the sealing line, the test paper will be invalidated.

一、 Fill in the blanks (2 points for each sub-question, 20 points in total)

1 、 In analysis phase, an intermediate representation is created from the given source

program. Lexical Analyzer , Syntax Analyzer and Semantic Analyzer are the

parts of this phase.

2 、 identifiers, operators, keywords, numbers, delimiters and so on are used to

describe tokens (lexical constructs)

3 、 A parse tree describes a syntactic structure.In a parse tree, all terminals are at

leaves.All inner nodes are non-terminals in a context free grammar.

4 、 When programming in a high-level language, target program and

error messages of the source program can be found by compiler.

5 、 Top-Down Parsing:Construction of the parse tree starts at the at the root and

proceeds towards the the leaves..

Total score

Verifying person

name

PARVEZ 朴维

number

Student Class

19 lc 软工 1

二、 Choice Questions (2 points for each sub-question, 1 0 points in total)

1 、 The purpose of dividing the compilation process into several "passes" is to

( C )。

A、Improving the efficiency of program execution

B、Make the organization of the program clearer

C、Make use of limited machine memory and improve machine execution efficiency

D、Use limited machine memory but reduce machine execution efficiency.

2 、 The input to the lexical analyzer is( B )。

A、Word string

B、source program

C、Grammatical unit

D、Target program

3 、 Compilers spend most of their time on( B )。

A、Error handling; B、lexical analysis;

C、Target code generation; D、Table management

4 、 Any operator precedence grammar ( D ) precedence function。

A、 there is one

B、 No

C、 There are several

D、 there may be several

5 、 The following is an incorrect description of the grammar tree( C )。

A、The root node is marked with the beginning S of the grammar G [S].

B、Each node is marked with a terminator or non-terminator of G[S].

C、If a node is marked as ε it must be a leaf node.

D、Internal nodes can be non-terminators

3 、Grammar:string-->string + string | string – string | 0 | 1 | …| 9

It is proved that this method has ambiguity. answer:Because there are two grammar trees in the sentence pattern 9 - 5 + 2 of this grammar:

四、Given the regular expression : (a (b*c)) | (a (b | c+)?)

Find a transition diagram NFA that recognizes it.(10 points)

Answer:

五、The following grammar G : E->TE’

E’->+E| ε

T->FT’

T' - >*FT’| ε

F-> (E)|id

(1) how to construct id+id*id, use parsing table M for grammar? (10 points)

(2) moves made by predictive parser on input id+id*id.Prove that this method is LL(1)。

(10points)

(3) The leftmost derivation for the id+id*id。(10 points)

Answer: 1

  • Answer
  • Answer