# Programming Language Concepts

Posted: January 19th, 2023

Test 1 – Open Book
Programming Language Concepts
July 1st, 2019
Name:
1
Programming Language Concepts Test 1 July 1st, 2019
1. (10 points) Specify which axioms are used in the following code block. Label each portion of the axiom
that are present, show the parts that can be implied by the code present given the final post condition.
This problem requires you to find a precondition for the code block.
This problem requires you proving the total correctness of the loop.

length = arr.length;
sum = 0;
missing = 0;
for(int i = 0; i < length; i ){
if ( A[i] != null ){
sum = sum arr[i] ;
} else {
missing ;
}
}
length = length – missing;
average = sum / length;
{ average = AVG(arr) for all nonempty elements of arr}
2. (5 points) Write 5 possible strings of size 6 and the way you get there from the starting state S.
S → A | BC | Ca
A → aB | b | cBB
B → aB | c | BBb
C → aaA | b | caB | aB
3. (15 points) Given the following Grammar and the right sentential form draw a parse tree.
S → AbB | bAc
A → Ab | aBB
B → Ac | cBb | c
a) aAccbcBb b) baBcBbbbc c)accbcccbb
4. (5 points) Draw the Von Neumann architecture and detail how each portion affects in the compilations
process?
5. (5 points) Draw, label and describe the processes for compilation and for interpretation, describe the
differences between the two
6. (5 points) Create a visual representation ( Linked List Style ) of how the following program is stored in
LISP:
(defun factorial (N)
“Compute the factorial of N.”
(if (= N 1)
1
(* N (factorial (- N 1)))))
7. (5 points) Show the steps in processing the value of factorial(5)
Page 2 of 3 50 points
Programming Language Concepts Test 1 July 1st, 2019
8. (5 points) Lexically analyze the following code segment. Give the total number of lexemes. State the
token provided for each value ( reserved words, assignment operators, identities, etc. )
int currSum = 0;
int oddCount = 0;
for(int i = 1; currSum i = 0 }
k = n;
f = 1;
while( k > 0 ){
f = f * k–;
}
{ f = n! }
Page 3 of 3 50 points

### Expert paper writers are just a few clicks away

Place an order in 3 easy steps. Takes less than 5 mins.

## Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
\$0.00
You can contact our live agent via WhatsApp! Via + 1 3234125597

Feel free to ask questions, clarifications, or discounts available when placing an order.