Problems for Lesson 3

You will use DrRacket for these problems.

Be sure to choose the Beginning Student language in DrRacket.

To use functions that work with images, add (require 2htdp/image) in DrRacket’s definitions area and then click Run. Afterward, the image functions should work in DrRacket’s interactions area.

Problem 3.1 – Arithmetic Expressions

Evaluate the expression (+ 1 2) in DrRacket’s interaction window. What does it produce?

Problem 3.2 – Boolean Expressions

Evaluate the expression (>= 1 2) in DrRacket’s interaction window. What does it produce?

Problem 3.3 – Image Expressions

Here’s an image of a duck:

Use DrRacket to determine the height of the image in pixels. Copy the image, paste it into DrRacket’s interactions area, and use the image as an argument to the image-height function. Write the height below:

Problem 3.4 – Another Image Expression

Use DrRacket to determine the width of the duck image in pixels. If you can’t guess the function that gets an image’s width, check the documentation. Write the height below: