



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Midterm Exam CMSC 330 Sections 0201, 0202 14 October 1999 Point total: 100 NAME__ ''__ ,.._ (please print)
The point value for each question is indicated (in parentheses). Do your own work; use your time wisely.
(24) 1. On the line provided, write the letter corresponding to each statement belov/ that is TRUE. o>-, <2., o ,
a. COBOL is an extremely successful early programming language. b. ALGOL is an example of a commercially successful early programming language. c. FORTRAN is a business language. d. C was developed for artificial intelligence applications. e. One advantage of compiled languages (as contrasted to interpreted languages) is that data structures are only interpreted once during program execution, f. ML is a compiled language. g. The binding of a variable to its value happens at execution time. h. The binding of real numbers to the selection of how real numbers will be stored happens at execution time. i. ML is an example of imperative, or procedural, languages, j. The semantics of a programming language describe the sequence of symbols that make up valid programs. k. Enumerated variables are an example of structured data types.
(8) 2. Give the regular expression that corresponds to the following FSA.
Regular Expression
(8) 3. Draw the finite state automaton that corresponds to the grammar given below.
FSA A -> aA I bB I c
B -> a I bB I c
(8) 4. Indicate which of the following strings would be recognized by the indicated regular expression by placing YES or NO in the space provided-
Regular expression: (ab) V (abaa*)
ba
/' ' ° abab
(8) 5. Given the following grammar, develop the parse tree for aabaacaac.
A -> aA I bB I c
B -> aB I cA I b
. Ti-
a a
(Ignore blanks; they are inserted to facilitate drawing the parse tree)
i -\ *.
Use the following Pascal-like declaration for problems 8 and 9.
Var A: array [-1 .. 1, 1 .. 3] of complex;
Assume the following:
(10) 8. Complete the following:
(a). Provide specific numeric values for each of the following for A:
virtual origin rvQ __________ ', 0 ~ ^
lower bound for i ________________ "-;".-
upper bound for i ___________________
,, r^ multiplier for i J ________________
lower bound for j _____________________
upper bound for j __•___________
multiplier for j __;___________
(b) Complete the access formula for A[i, j]
1-value (A[i, j]) = 'ov-»-v '* • '• :..
(c) Provide the spectfic numeric value for the following:
l-value(A[0, 2]) = ' -"" 3 " " ''• • ' ' :' 3
(8) 9. Complete the following:
(a). Provide specific numeric values for each of the following for A[*, 2]
nb? virtual origin /^ /2~________ J •'-•'''• A. i // lower bound for i -
jXpper bound for i ____ 7 / multiplier for i
Mb) Complete the access formula: 1-value (A[i, 2]) =
(c) Provide the specific numeric value: l-value(A[0, 2]) = /o(~Z- I V
(10) 10. The following types, declarations, and statements are from a fictitious programming language. Indicate which of the statements would be valid, and which would be invalid, if the language implemented name equivalence and if the language implemented structural equivalence.
Type A: array [0..9] of integer; B: record Scores: A; Avg: real; end; C: record ExamScores: A; Mean: real; end; r /• ^ - , , -^. <^^ var: a, b: A; c,d:B, e: C; f: array [0..9] of integer & ° r * , r^por--^
name equivalence structural equivalence A 5 a := c.Scores; [//) ^ / 7) V fit-it)
f := e.ExamScores; Q^ fT3] :=e.ExamScores[4]; ;. __ c.Avg := e.Mean;