CMPSC 461
Pennsylvania State University - All Campuses
All 10 results
Sort by
-
CMPSC 131 design document
- Class notes • 5 pages • 2024
-
- $10.49
- + learn more
It is in-depth CMPSC 131 design documents
-
15–312: Principles of Programming Languages Midterm Examination (Sample Solutions)
- Exam (elaborations) • 10 pages • 2023
-
Available in package deal
-
- $7.99
- + learn more
15–312: Principles of Programming Languages 
Midterm Examination 
(Sample Solutions)
-
CMPSC 461: Programming Language Concepts Assignment 6 Solution
- Exam (elaborations) • 4 pages • 2023
-
Available in package deal
-
- $7.99
- + learn more
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 > 0) = wp(y:=x*2, wp(y:=y+3, y > 0)) 
= wp(y:=x*2, y + 3 > 0) 
= x ∗ 2 + 3 > 0 
Moreover, the precondition
-
CMPSC 461: Programming Language Concepts Assignment 1 Solutions
- Exam (elaborations) • 3 pages • 2023
-
Available in package deal
-
- $7.99
- + learn more
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. (λy. ((x y) z)) 
b) (3pt) λx. λy. (λx. x x) y λz. x z 
Solution: λx. (λy. (((λx. (x x)) y) (λz. (x z)))) 
Problem 2 [6pt] Fully evaluate the following λ-term so that no further β-reduction is ...
-
CMPSC 461: Programming Language Concepts Assignment 4 Solutions
- Exam (elaborations) • 4 pages • 2023
-
Available in package deal
-
- $7.99
- + learn more
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 scope, but it is alive. 
1 void foo() 
2 { 
3 myClass* C = new myClass(); 
4 return; 
5 } 
Problem 2 [10pt] Consider the following class instances in a C++ program: 
1 static myClass A; 
2 
3 int main(...
Want to regain your expenses?
-
CMPSC 461: Programming Language Concepts Assignment 5 Solutions
- Exam (elaborations) • 3 pages • 2023
-
Available in package deal
-
- $7.99
- + learn more
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. You can 
use helper function in your solution. 
Solution: 
int SumOfSquares(int n) { 
return SumOfSquaresHelp(0, n); 
} 
int SumOfSquaresHelp(int a, int n) { 
if (n <= 0) 
return a; 
else 
return...
-
Programming Language Concepts CMPSC 461, FALL 2018 Midterm #1 Solutions
- Exam (elaborations) • 5 pages • 2023
-
Available in package deal
-
- $9.99
- + learn more
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 consists of 8 questions and 1 bonus question on 4 pages, totaling 100 points + 10 
bonus points. Read each question carefully and use your time judiciously. The problems are not 
ordered by their dif...
-
CMPSC 461: Programming Language Concepts Assignment 6 Solution
- Exam (elaborations) • 3 pages • 2023
-
Available in package deal
-
- $7.99
- + learn more
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 for -10: 
result of (8-10): 
Problem 2 [10pt] Consider the following C declaration: 
union U1 {int a; float b;}; 
union U2 {char a; double b;}; 
struct S { 
union U1 u1; 
union U2 u2; 
} s; 
Assume ...
-
Programming Language Concepts CMPSC 461, FALL 2018 Midterm #2 Solutions
- Exam (elaborations) • 6 pages • 2023
-
Available in package deal
-
- $9.99
- + learn more
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. You may have nothing on your desk except this 
exam and writing instruments. 
The exam consists of 8 questions and 1 bonus question on 5 pages, totaling 100 points + 10 
bonus points. Read each questio...
-
Programming Languages Concepts CMPSC 461, FALL 2016 Midterm #1 Solutions
- Exam (elaborations) • 7 pages • 2023
-
Available in package deal
-
- $9.99
- + learn 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 exam consists of 8 questions and 1 bonus question on 6 pages, totaling 100 points + 10 
bonus points. Read each question carefully and use your time judiciously. The problems are not 
ordered by their di...
How much did you already spend on Stuvia? Imagine there are plenty more of you out there paying for study notes, but this time YOU are the seller. Ka-ching! Discover all about earning on Stuvia