100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Exam (elaborations)

COP 4020 Programming Language Concepts Final Exam Review 2025 (Qns & Ans

Rating
-
Sold
-
Pages
35
Uploaded on
06-05-2025
Written in
2024/2025

COP 4020 Programming Language Concepts Final Exam Review 2025 (Qns & AnsCOP 4020 Programming Language Concepts Final Exam Review 2025 (Qns & AnsCOP 4020 Programming Language Concepts Final Exam Review 2025 (Qns & AnsCOP 4020 Programming Language Concepts Final Exam Review 2025 (Qns & Ans

Show more Read less











Whoops! We can’t load your doc right now. Try again or contact support.

Document information

Uploaded on
May 6, 2025
Number of pages
35
Written in
2024/2025
Type
Exam (elaborations)
Contains
Unknown

Subjects

Content preview

COP 4020

Programming Language Concepts

4.0 Credits

Final Exam Review (Qns & Ans)

2025




Case Context for Questions 1-5
©2025

,Consider a new programming language, XenLang, designed with
features such as lazy evaluation, dependent types, and advanced
polymorphism. XenLang supports both eager and lazy evaluation
modes, dependent typing for enhanced type safety, and
polymorphic type inference.

1. (MCQ)
In XenLang, lazy evaluation is primarily beneficial because:
A) It increases memory consumption by creating many thunks.
B) It delays computation until the result is needed, which can
improve performance in some cases.
C) It eliminates the need for garbage collection.
D) It makes the language purely functional without side effects.

ANS: B
Rationale: Lazy evaluation defers computation until its value is
actually needed, which can avoid unnecessary calculations and
improve performance. It may increase memory use due to thunks,
but the main benefit is avoiding wasted computation.

2. (FIB)
Dependent types in XenLang allow types to depend on
__________, enabling more expressive type constraints checked at
compile time.

ANS: values
Rationale: Dependent types can depend on program values,
allowing the type system to express precise properties such as
array length or numerical invariants checked during compilation.

3. (T/F)
The polymorphic type inference in XenLang means every
polymorphic function must have explicit type annotations to be
correctly typed.

ANS: False
Rationale: Polymorphic type inference generally allows the
compiler to deduce types automatically without requiring explicit
©2025

,annotations, although annotations can improve readability or
resolve ambiguities.

4. (MR)
Which of the following features are typically associated with lazy
evaluation languages? (Select all that apply)
A) Thunks
B) Call-by-value parameter passing
C) Memoization of computed values
D) Eager infinite loop evaluation

ANS: A, C
Rationale: Thunks implement delayed computation, and
memoization avoids recomputing thunks once evaluated. Call-by-
value is eager evaluation, and eager infinite loop evaluation would
not terminate.

5. (MCQ)
Dependent types improve:
A) Run-time performance
B) Static program verification
C) Dynamic typing flexibility
D) Garbage collection optimization

ANS: B
Rationale: Dependent types mainly help prove program correctness
at compile time by encoding invariants into types, hence improving
static verification.

Case Context for Questions 6-10
You are analyzing the semantics of a concurrent programming
language called ConcurLang that supports message passing
concurrency and weak memory models.

6. (MCQ)
In ConcurLang’s weak memory model, which of the following
behaviors is allowed?
A) Reading stale values due to reordering by the hardware
©2025

, B) Sequential consistency across all threads always guaranteed
C) Atomic reads and writes to shared variables without
synchronization
D) No race conditions can occur

ANS: A
Rationale: Weak memory models permit hardware or compilers to
reorder instructions leading to visibility of stale values between
threads, unlike sequential consistency.

7. (FIB)
In the context of message passing concurrency, __________ is a
communication pattern where processes synchronize by sending
and receiving messages directly.

ANS: synchronous communication
Rationale: Synchronous message passing requires sender and
receiver to rendezvous for communication, as opposed to
asynchronous message passing.

8. (T/F)
In ConcurLang, the use of locks is unnecessary if all shared state is
encapsulated within message-passing processes.

ANS: True
Rationale: Encapsulating shared state inside message-passing
reduces the need for explicit locks by avoiding shared mutable
memory accessed concurrently.

9. (MR)
Which of the following are typical problems faced when
implementing concurrency under weak memory models? (Select
all)
A) Data races
B) Deadlocks due to improper locks
C) Memory visibility issues
D) Overflow errors in arithmetic operations
©2025

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Bankart Chamberlain College of Nursing
View profile
Follow You need to be logged in order to follow users or courses
Sold
150
Member since
2 year
Number of followers
31
Documents
4512
Last sold
1 week ago

3.6

21 reviews

5
9
4
0
3
9
2
1
1
2

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions