Homework 3  September 13

Name __________________________

 

 

1

Which of the following are tokens in Java?

 

 

}

 

mult_op

 

while

 

identifier

 

End of Question 1

 

Question 2

2

Which of the following are lexemes in Java?

 

 

for

 

semicolon

 

int_literal

 

++

 

End of Question 2



Question 3

3

Context-free grammars were devised by

 

 

Peter Naur

 

John Backus

 

Noam Chomsky

 

John McCarthy

 

End of Question 3




Question 4

4

Which of the following are nonterminal symbols in the grammar rule:
<factor> -> (++ | --) ident | (+ | -) (ident | int_literal) | (<expr>)

 

 

<expr>

 

<factor>

 

+

 

ident

 

End of Question 4




Question 5

5

Which of the following are terminal symbols in the grammar rule:
<factor> -> (++ | --) ident | (+ | -) (ident | int_literal) | (<expr>)

 

 

ident

 

<expr>

 

++

 

int_literal

 

End of Question 5




Question 6

6

Which of the following can be sentenial forms?

 

 

a. Non-terminal symbols

 

b. Terminal symbols

 

c. Sentences

 

d. Rules

 

e. a and c

 

f. a, b, and c

 

End of Question 6




Question 7

7

A grammar is ambiguous if it:

 

 

Produces a sentential form that has two distinct parse trees

 

Has ε rules

 

Has two rules that have the same RHSs

 

Has a rule with more than four RHSs

 

End of Question 7




Question 8

8

Which of the following is not a kind of attribute in an attribute grammar?

 

 

Synthesized

 

Intrinsic

 

Inherited

 

Free

 

End of Question 8




Question 9

9

Which of the following need not be true for a loop invariant?

 

 

P => I

 

I => Q

 

{I and B} S {I}

 

{I and (not B)} => Q

 

End of Question 9




Question 10

10

Which of the following sentences cannot be derived using the grammar of Example 3.2?

 

 

A = A * (B + (C * A))

 

A = C * (A * C + B)

 

A = A * (B + ( C ))

 

A = A + (B + C)

 

End of Question 10




Question 11

11

Which of the following is not a part of axiomatic semantics?

 

 

Inference rules

 

Weakest preconditions

 

Assertions

 

Mapping functions

 

End of Question 11




Question 12

12

Which of the following semantic description systems is most mathematical?

 

 

Denotational semantics

 

Static semantics

 

Axiomatic semantics

 

Operational semantics

 

End of Question 12

 

 

13

Which of the following was the primary reason the relative slowness of interpretation of pseudocode programs acceptable in the early 1950s?

 

 

The machines were slow

 

Floating-point arithmetic operations were done in software

 

It was not then known how to write efficient interpreters

 

Memories were too small

 

14

Which of the following features were added to FORTRAN IV to get FORTRAN 77?

 

An else clause

Recursive subprograms

Records

Character string handling

 

15

Which version of FORTRAN was the first to have any sort of dynamic variables?

 

FORTRAN 66

FORTRAN 90

FORTRAN II

FORTRAN 95

 

16

What was the primary application area of computers at the time Fortran was designed?

 

Computer gaming software

Scientific

Artificial intelligence

Business

 

 

 

17

By which of the following approaches were the pseudocodes of the early 1950s implemented?

 

 

Hardware simulation

 

Hybrid systems

 

Pure interpreters

 

Compilers

 

End of Question 3




Question 4

18

Speedcoding was invented to overcome two significant shortcomings of the computer hardware of the early 1950s. Which of the following are these two?

 

No index registers

No floating-point hardware

No floppy disks

No cache memory

 

End of Question 4




Question 6

19

What hardware capability that first appeared in the IBM 704 computer strongly affected the evolution of programming languages?

 

Disk devices

Floating-point hardware

Index registers

Solid state memory

 

End of Question 6




Question 7

20

In what year was the Fortran design project begun?

 

1957

1952

1949

1954

 

End of Question 7