100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
CPSC110 problem set 1 solution CA$11.18   Add to cart

Other

CPSC110 problem set 1 solution

 11 views  0 purchase

complete solution for problem set 1

Preview 1 out of 4  pages

  • January 5, 2024
  • 4
  • 2023/2024
  • Other
  • Unknown
All documents for this subject (19)
avatar-seller
skye3
(@problem 1)
;;
;; Write the BSL expression that most clearly represents the following
;; arithme>c expression:
;;
;; 3^2 + 6 * (6 - 10) / 3
;;
;; which equals 1
;;
;; There is a single BSL expression that both produces the correct result,
;; and most closely matches the structure of the equa>on given above.
;; Although 1 is an expression that evaluates to 1, that is not the
;; correct answer, because it doesn't show the structure of the expression
;; above.
;;
(+ (sqr 3)(/ (* 6 (- 6 10)) 3))


(@problem 2)
;;
;; Given the defini>ons below (LOWER, UPPER and foo),
;; write the step-by-step evalua>on of the following expression:
;;
;; (foo (* 3 4) (+ 0 2))
;;
;; Be sure to show every intermediate evalua>on step, including the original
;; expression and the final result. The steps should NOT be in comments.
;;
;; Stepping ques>ons like this one have only one correct answer. The goal
;; of this problem is to assess whether you have learned the exact BSL step
;; by step evalua>on rules; not whether you can figure out the final
;; result of an expression.
;;

(define LOWER 10)
(define UPPER 20)

(define (foo x y)
(if (and (> x LOWER) (< x UPPER))
(- x (* y 2))
(+ x (* y 3))))

(foo (* 3 4) (+ 0 2))
(foo 12 (+ 0 2))

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 skye3. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

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

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

79976 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
CA$11.18
  • (0)
  Add to cart