Package deal
CMPSC 461 FULL COURSE PACKAGE
CMPSC 461 FULL COURSE PACKAGE
[Show more]CMPSC 461 FULL COURSE PACKAGE
[Show more]Programming Languages Concepts 
CMPSC 461, FALL 2016 
Midterm #1 Solution 
This exam is closed book, closed notes. You may not use any additional materials during the exam. 
All electronic devices must be put away. You may have nothing on your desk except this exam and 
writing instruments. 
The exa...
Preview 2 out of 7 pages
Add to cartProgramming Languages Concepts 
CMPSC 461, FALL 2016 
Midterm #1 Solution 
This exam is closed book, closed notes. You may not use any additional materials during the exam. 
All electronic devices must be put away. You may have nothing on your desk except this exam and 
writing instruments. 
The exa...
Programming Language Concepts 
CMPSC 461, FALL 2018 
Midterm #2 Solution 
P# Possible Score 
1 8 
2 10 
3 16 
4 8 
5 24 
6 16 
7 10 
8 8 
Bonus 10 
Total 110 
This exam is closed book, closed notes. You may not use any additional materials during the 
exam. All electronic devices must be put away. Y...
Preview 2 out of 6 pages
Add to cartProgramming Language Concepts 
CMPSC 461, FALL 2018 
Midterm #2 Solution 
P# Possible Score 
1 8 
2 10 
3 16 
4 8 
5 24 
6 16 
7 10 
8 8 
Bonus 10 
Total 110 
This exam is closed book, closed notes. You may not use any additional materials during the 
exam. All electronic devices must be put away. Y...
CMPSC 461: Programming Language Concepts 
Assignment 6 Solution 
Problem 1 [6pt] Assume that integers are stored using one byte in memory. What are the binaries for 8 and 
-10 in two’s complement format? What is the result of (8-10) in two’s complement format? 
Solution: 
binary for 8: 
binary ...
Preview 1 out of 3 pages
Add to cartCMPSC 461: Programming Language Concepts 
Assignment 6 Solution 
Problem 1 [6pt] Assume that integers are stored using one byte in memory. What are the binaries for 8 and 
-10 in two’s complement format? What is the result of (8-10) in two’s complement format? 
Solution: 
binary for 8: 
binary ...
Programming Language Concepts 
CMPSC 461, FALL 2018 
Midterm #1 Solution 
This exam is closed book, closed notes. You may not use any additional materials during the exam. 
All electronic devices must be put away. You may have nothing on your desk except this exam and 
writing instruments. 
The exam...
Preview 2 out of 5 pages
Add to cartProgramming Language Concepts 
CMPSC 461, FALL 2018 
Midterm #1 Solution 
This exam is closed book, closed notes. You may not use any additional materials during the exam. 
All electronic devices must be put away. You may have nothing on your desk except this exam and 
writing instruments. 
The exam...
CMPSC 461: Programming Language Concepts 
Assignment 5 Solution 
Problem 1 [9pt] Consider the following C program: 
int SumOfSquares(int n) { 
if (n <= 0) 
return 0; 
else 
return n*n+SumOfSquares(n-1); 
} 
a) (5pt) Write down a tail recursive implementation of function SumOfSquares in C language...
Preview 1 out of 3 pages
Add to cartCMPSC 461: Programming Language Concepts 
Assignment 5 Solution 
Problem 1 [9pt] Consider the following C program: 
int SumOfSquares(int n) { 
if (n <= 0) 
return 0; 
else 
return n*n+SumOfSquares(n-1); 
} 
a) (5pt) Write down a tail recursive implementation of function SumOfSquares in C language...
CMPSC 461: Programming Language Concepts 
Assignment 4 Solution 
Problem 1 [5pt] Give an example in a programming language that you’re familiar with in which a variable 
is alive but not in scope. 
Solution: 
One example in C. After the function exists, the object that C links to is no longer in s...
Preview 1 out of 4 pages
Add to cartCMPSC 461: Programming Language Concepts 
Assignment 4 Solution 
Problem 1 [5pt] Give an example in a programming language that you’re familiar with in which a variable 
is alive but not in scope. 
Solution: 
One example in C. After the function exists, the object that C links to is no longer in s...
CMPSC 461: Programming Language Concepts 
Assignment 1 Solution 
Problem 1 [6pt] Add parentheses to the following lambda terms so that the grouping of sub-terms becomes 
explicit. For example, the term λx. x λy. y with parentheses is λx. (x (λy. y)). 
a) (3pt) λx. λy. x y z 
Solution: λx. (λ...
Preview 1 out of 3 pages
Add to cartCMPSC 461: Programming Language Concepts 
Assignment 1 Solution 
Problem 1 [6pt] Add parentheses to the following lambda terms so that the grouping of sub-terms becomes 
explicit. For example, the term λx. x λy. y with parentheses is λx. (x (λy. y)). 
a) (3pt) λx. λy. x y z 
Solution: λx. (λ...
CMPSC 461: Programming Language Concepts 
Assignment 6 Solution 
Problem 1 [8pt] Prove that the following two Hoare triples are valid. (Hint: in predicate logic P1 ⇒ P2 is 
equivalent to ¬P1 ∨ P2). 
a) (4pt) 
{x > −1} 
y := x * 2; 
y := y + 3; 
{y > 0} 
Solution: 
wp(y:=x*2;y:=y+3, y &g...
Preview 1 out of 4 pages
Add to cartCMPSC 461: Programming Language Concepts 
Assignment 6 Solution 
Problem 1 [8pt] Prove that the following two Hoare triples are valid. (Hint: in predicate logic P1 ⇒ P2 is 
equivalent to ¬P1 ∨ P2). 
a) (4pt) 
{x > −1} 
y := x * 2; 
y := y + 3; 
{y > 0} 
Solution: 
wp(y:=x*2;y:=y+3, y &g...
15–312: Principles of Programming Languages 
Midterm Examination 
(Sample Solutions)
Preview 2 out of 10 pages
Add to cart15–312: Principles of Programming Languages 
Midterm Examination 
(Sample Solutions)
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Stuvia is a marketplace, so you are not buying this document from us, but from seller ExamsConnoisseur. Stuvia facilitates payment to the seller.
No, you only buy these notes for $19.99. You're not tied to anything after your purchase.
4.6 stars on Google & Trustpilot (+1000 reviews)
79373 documents were sold in the last 30 days
Founded in 2010, the go-to place to buy study notes for 14 years now