CPSC Quiz 5-7 Flashcards

1
Q

A binding is an association between an attribute and an entity. Identify which is a binding category.

A

Static, Explicit heap-dynamic, Stack-dynamic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is an attribute?

A

An attribute is any quantity associated with a programming construct.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

True or False: A variable is a three tuple V = (T, L, C) where T = token, L = lexeme, and C = class.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a semantic rule?

A

A semantic rule is a specification declaring which attributes to associate with a given nonterminal.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

True or False: An explicitly typed language may also be dynamically typed.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which IR are linear?

A

TAC, IL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which IR are graphical?

A

DAG, CST

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

True or False: A name is a string of characters used to identify an entity in a program.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the jobs of the semantic analysis phase?

A

Type checking, Access control and Scope Checking, Function Parameter Count and Consistency

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

The edges of a control flow graph represent

A

Control flow changes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The nodes of a control flow graph represent

A

Basic Blocks

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

A language that requires variables to have a declared type in the source code is called

A

Explicitly Typed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

True or False: Side effects don’t impact the order that the operands are evaluated in

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which of the following are common primitive types?

A

Integer Types, Character Types

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the difference between a pointer and a reference type?

A

A pointer is when a variable has a range of values that consists of memory addresses and nil. A reference type is a value of object in memory that can’t be changed to refer to a different variable once initialized.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

A language that allows operators to work with operands of different types is said to contain

A

Mixed-mode Expressions

17
Q

True or False: A side effect is when an operation, expression, or function has any observable effect other than its primary effect of reading the values of its operands and returning a value to the invoker.

A

True

18
Q

True or False: An expression is an syntactic entity in a programming language that may be evaluated to determine its value

A

True

19
Q

True or False: The creation of basic blocks from the input code forms a partition over the code

A

True

20
Q

What is a partition?

A

Dividing the set of code into smaller, distinct sections based on specific criteria

21
Q

When performing local optimization, which form are the TAC instructions inside the basic blocks converted into?

A

DAG

22
Q

True or False: Local optimization is performed on the code contained within a basic block.

A

True

23
Q

Data flow equations allow us to identify which of the following?

A

If an expression is available, has been killed, or is live on exit from the block

24
Q

What are the two primary forms of data-flow analysis?

A

Forward flow analysis and backward flow analysis

25
Q

Three optimization techniques:

A

Constant folding, strength reduction, common subexpression elimination

26
Q

For which intermediate representations does our basic block identification algorithm operate on?

A

Three Address Code

27
Q

How are basic blocks identified?

A

We define a leader to be the first instruction of the block. After leaders are assigned then basic block will consist of that and the instructions after until there is a new leader or a jump.

28
Q

True or False: The dominance relation among nodes in a control flow graph is partial ordering.

A

True

29
Q

True or False: A control flow graph is a DAG

A

False

30
Q

True or False: Global optimization isn’t performed on the control flow graph

A

False