100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
CSCI-2041: Advanced Programming Principles 2024 – 2025 CSCI-2041 Final Exam 1 Review Questions with Verified Solutions | 100% Pass Guaranteed | Graded A+ $14.99   Add to cart

Exam (elaborations)

CSCI-2041: Advanced Programming Principles 2024 – 2025 CSCI-2041 Final Exam 1 Review Questions with Verified Solutions | 100% Pass Guaranteed | Graded A+

 1 view  0 purchase

CSCI-2041: Advanced Programming Principles 2024 – 2025 CSCI-2041 Final Exam 1 Review Questions with Verified Solutions | 100% Pass Guaranteed | Graded A+

Preview 2 out of 7  pages

  • October 19, 2024
  • 7
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
All documents for this subject (6)
avatar-seller
YourAssignmentHandlers01
CSCI-2041: Advanced Programming
Principles 2024 – 2025 CSCI-2041
Final Exam 1 Review Questions with
Verified Solutions | 100% Pass
Guaranteed | Graded A+ |




Administrator
[COMPANY NAME] [Company address]

, # Final Exam Practice Questions

*CSci 2041: Advanced Programming Principles, Fall 2015*

These are some examples of questions similar to those that will
appear on the final exam. Since the final is comprehensive, you
should start by taking a look at the example questions for
[midterm 1](midterm1-practice.md) and [midterm 2](midterm2-practice.md).


##1. Values and types

Since defining and using data types as a method of structuring your
programs is a central concept in functional programming and OCaml, you
should be able to infer the types of OCaml expressions, and identify
type errors when they occur. For each of the following expressions
you should be able to:

- Identify whether the expression contains a type error, or if it is
well-typed, what its type is.
- If the expression contains a type error, you should be able to
explain the type error; if it is well-typed you should be able to
give the result of evaluating the expression. Since OCaml has
first-class functions, some expressions might evaluate to functional
values, in which case you should explain briefly what the function
computes.

The midterm 1 examples cover much of the basics, but here are some
examples focusing on some of the OCaml features we've learned since
then:

```
open Lwt
let t = Lwt.return 17 >>= fun i -> Lwt.return string_of_int i
>>= fun s -> Lwt_io.printl s
```

```
open Lwt
let t = Lwt_unix.sleep 1.5 >>= fun () -> print_endline "Great nap!"
```

```
let a = ref [] in
a := 32::!a ; a := ["stringlist!"]
```

```
let a = ref 14 in
let f r = begin r := !r+1 end in
f a; f a
```

```
type 'a mlist = Nil or L of 'a mcell
and 'a mcell = { hd: 'a ; mutable tl : 'a mlist}

let update_hd v lst = match lst with
| Nil -> L {hd=v, tl=Nil}
| L c -> c.hd <- v
```

```
let rec defer f x = lazy(f x)

This study source was downloaded by 100000873818132 from CourseHero.com on 10-18-2024 17:15:16 GMT -05:00


https://www.coursehero.com/file/13271011/final-exam-practicemd/

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

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!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

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.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller YourAssignmentHandlers01. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $14.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

80630 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$14.99
  • (0)
  Add to cart