CMPSC 461
Pennsylvania State University - All Campuses
Hier vind je de beste samenvattingen om te slagen voor CMPSC 461. Er zijn o.a. samenvattingen, aantekeningen en oefenvragen beschikbaar.
Alle 10 resultaten
Sorteer op:
-
Tentamen (uitwerkingen)
15–312: Principles of Programming Languages Midterm Examination (Sample Solutions)
-
---10september 20232023/2024A+
- 15–312: Principles of Programming Languages 
Midterm Examination 
(Sample Solutions)
-
$8.49 Meer Info
ExamsConnoisseur
-
Tentamen (uitwerkingen)
CMPSC 461: Programming Language Concepts Assignment 6 Solution
-
---4september 20232023/2024A+
- 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
-
$8.49 Meer Info
ExamsConnoisseur
-
Tentamen (uitwerkingen)
CMPSC 461: Programming Language Concepts Assignment 1 Solutions
-
---3september 20232023/2024A+
- 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 ...
-
$8.49 Meer Info
ExamsConnoisseur
-
Tentamen (uitwerkingen)
CMPSC 461: Programming Language Concepts Assignment 4 Solutions
-
---4september 20232023/2024A+
- 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(...
-
$8.49 Meer Info
ExamsConnoisseur
-
Tentamen (uitwerkingen)
CMPSC 461: Programming Language Concepts Assignment 5 Solutions
-
---3september 20232023/2024A+
- 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...
-
$8.49 Meer Info
ExamsConnoisseur
-
Tentamen (uitwerkingen)
Programming Language Concepts CMPSC 461, FALL 2018 Midterm #1 Solutions
-
---5september 20232023/2024A+
- 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...
-
$10.49 Meer Info
ExamsConnoisseur
-
Tentamen (uitwerkingen)
CMPSC 461: Programming Language Concepts Assignment 6 Solution
-
---3september 20232023/2024A+
- 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 ...
-
$8.49 Meer Info
ExamsConnoisseur
-
Tentamen (uitwerkingen)
Programming Language Concepts CMPSC 461, FALL 2018 Midterm #2 Solutions
-
---6september 20232023/2024A+
- 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...
-
$10.49 Meer Info
ExamsConnoisseur
-
Tentamen (uitwerkingen)
Programming Languages Concepts CMPSC 461, FALL 2016 Midterm #1 Solutions
-
---7september 20232023/2024A+
- 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...
-
$10.49 Meer Info
ExamsConnoisseur