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

CPSC110 Psets Solution

Rating
-
Sold
-
Pages
5
Grade
A
Uploaded on
16-11-2025
Written in
2025/2026

This is the correct solution for the pset that you are going to be given as a student who is/will be taking cpsc110.

Institution
Course









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

Written for

Institution
Study
Course

Document information

Uploaded on
November 16, 2025
Number of pages
5
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

;​; DO NOT PUT ANYTHING PERSONALLY IDENTIFYING BEYOND YOUR CWL IN THIS​
​FILE.​
​;; YOUR CWLs WILL BE SUFFICIENT TO IDENTIFY YOU.​
​;;​
​(require spd/tags)​
​(require 2htdp/image)​

​(@assignment psets/pset-01);Do not edit or remove this tag​


(​ @problem 1)​
​;;​
​;; Write the BSL expression that most clearly represents the following​
​;; arithmetic 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 equation 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 definitions below (LOWER, UPPER and foo),​
​;; write the step-by-step evaluation of the following expression:​
​;;​
​;; (foo (* 3 4) (+ 0 2))​
​;;​
​;; Be sure to show every intermediate evaluation step, including the original​
​;; expression and the final result. The steps should NOT be in comments.​
​;;​
​;; Stepping questions 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 evaluation 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))​

​(foo 12 2)​

​(if (and (> 12 LOWER) (< 12 UPPER))​
​(- 12 (* 2 2))​
​(+ 12 (* 2 3)))​

​(if (and (> 12 10) (< 12 UPPER))​
​(- 12 (* 2 2))​
​(+ 12 (* 2 3)))​

​(if (and true (< 12 UPPER))​
​(- 12 (* 2 2))​
​(+ 12 (* 2 3)))​

​(if (and true (< 12 20))​
​(- 12 (* 2 2))​
​(+ 12 (* 2 3)))​

​(if (and true true)​
​(- 12 (* 2 2))​
​(+ 12 (* 2 3)))​

​(if true​
​(- 12 (* 2 2))​
​(+ 12 (* 2 3)))​

​(- 12 (* 2 2))​

​(- 12 4)​

​8​




(​ @problem 3)​
​;;​
​;; Skye has written the following expression, and expects it to produce​
$10.06
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
06shyun1211

Get to know the seller

Seller avatar
06shyun1211 University of British Columbia
Follow You need to be logged in order to follow users or courses
Sold
New on Stuvia
Member since
3 weeks
Number of followers
0
Documents
8
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

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