Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Midterm Exam
CSCI524 Principles of Programming Languages
Prof. E. Chen
b)
c)
d)
b)
Multiplicity means having more than one way to accomplish a particular operation.
c)
d)
Lexeme.
c)
Variables.
d)
Parse Tree.
b)
Dynamic arrays
SP2010
Midterm Exam
CSCI524 Principles of Programming Languages
Prof. E. Chen
c)
Floating-point
d)
None of above
It is a compling system
b)
c)
d)
All of above
<term>
<expr> - <term>
<factor>
<id>
Return the answer in a different paper, scan or picture them, and send back
with the answers.
6.
B := (A + B ) * (B C)
SP2010
Midterm Exam
CSCI524 Principles of Programming Languages
Prof. E. Chen
7.
C := A B * C + A * (B + C)
8.
A := A * (C A + B) * (A B)
9.
B := B C * A + B
10.
C := (B C * A) * (B C)
<term>
<expr> - <term>
This grammar does not give the precedence over the multiplication operator and
parenthese operator.
b)
c)
This grammar does not give the precedence over the multiplication operator and
addition/subtraction operator.
d)
None of above.
SP2010
Midterm Exam
CSCI524 Principles of Programming Languages
Prof. E. Chen
It will always generate more than one parse tree in an ambiguity grammar.
b)
If a grammar can not tell the operator precedence, it is then an ambiguity grammar.
c)
If a grammar can not tell the operator associativity, it is then an ambiguity grammar.
d)
All of above.
a)
b)
This grammar defines that between a then and its matching else, an if
statement without an else is not allowed.
c)
This grammar defines an unmatched statement is always placed after else clause.
d)
None of above.
b)
SP2010
Midterm Exam
CSCI524 Principles of Programming Languages
Prof. E. Chen
c)
d)
b)
c)
d)
None of above
b)
c)
Data type defines the set of operations that are defined for values of the type.
d)
All of above
b)
c)
A binding must happen during run time and remain unchanged throughout program
execution.
d)
None of above.
SP2010
Midterm Exam
CSCI524 Principles of Programming Languages
Prof. E. Chen
b)
execution.
c)
d)
b)
c)
d)
None of above
a static variable
b)
a global variable
c)
d)
All of above
22. Base on the characteristics of variables, which variables are the most
memory efficiency?
University of Northern Virginia
6/13
SP2010
Midterm Exam
CSCI524 Principles of Programming Languages
Prof. E. Chen
a) Static variables.
b)
c)
d) None of above.
23. Base on the characteristics of variables, which variables are the most
addressing efficiency?
a) Static variables.
b)
c)
d) None of above.
24. Base on the characteristics of variables, which variables are both the most
memory and addressing efficiency?
a) Static variables.
b)
c)
d) None of above.
It is often used for dynamic structures, such as linked lists and trees, that need to
grow and/or shrink during execution.
SP2010
Midterm Exam
CSCI524 Principles of Programming Languages
Prof. E. Chen
b)
c)
d)
b)
To ensure that the variable is large enough to hold the value assigned.
c)
d)
To ensure that the memory allocation is compatible with the data type.
b)
c)
To make sure the type checking is enforced during the program execution.
d)
b)
c)
d)
The scope of a variable can be determined prior to execution and during execution.
b)
SP2010
Midterm Exam
CSCI524 Principles of Programming Languages
Prof. E. Chen
c)
All variables data type binding must be static in Static Scope programming
languages.
d)
None of above
End ;
SP2010
Midterm Exam
CSCI524 Principles of Programming Languages
Prof. E. Chen
30. Which variable does not exist in the referencing environment for #1
a)
e of sub1
b) d of sub1
c)
x, y of sub2
d) a, b, c, d of example
a, b, c, d of example
b)
a, c, d, g, x, y of sub2, d, e, f, g of sub1,
c)
d, e, f, g of sub1,
d) d, e, f, g of sub1,
a, b, c of example
a, b, c of example
b of example,
x, g, y, c of sub4,
d) x, g, y, c of sub4,
a, b, c, d of example
a, b, d of example
d, e, f, g of sub1,
z of sub3,
a, d of sub2, z of sub3,
b, d of example
b, d of example
a, b, c, d of example
SP2010
Midterm Exam
CSCI524 Principles of Programming Languages
Prof. E. Chen
b)
x, g, y, c of sub4, z of sub3,
b, d of example
c)
x, y, z of sub3, d, e, f, g of sub1,
d) x, y, z of sub3, d, e, f, g of sub1,
a, b, c of example
a, b, c, d of example
sub1
b) sub2
c)
sub3
d) None of above
sub1
b) sub2
c)
example
d) None of above
SP2010
Midterm Exam
CSCI524 Principles of Programming Languages
Prof. E. Chen
sub3
}
Void sub2 ( ) {
int b, c, d ;
sub1
}
Void sub3 ( ) {
int c, d ;
.
}
Void sub4 ( ) {
int x, y, z, d ;
sub2
}
Void main ( ) {
int x, a
sub4
}
c, d of sub3,
a, b of sub1,
b of sub2, x, y, z of sub4
b)
c, d of sub3,
a, b of sub1,
x, y, z of sub4
c)
c, d of sub3,
d) None of above
University of Northern Virginia
12/13
SP2010
Midterm Exam
CSCI524 Principles of Programming Languages
Prof. E. Chen
x, y, z, d of sub4, a of main
d) None of above
sub1
b)
sub2
c)
sub3
d) sub4
If the variable is statically bound to storage, binding and initialization occur before
run time.
b)
c)
d)