On this page:
7.1 Language
7.2 Reading
7.3 Design Recipe
7.4 Library
7.5 File Format
7.6 Programming Tasks
7.7 Math Tasks
7.8 Grading Standards
7.9 Turnin

7 Placement 2🔗

7.1 Language🔗

For the following assignment, you must use Racket’s Beginning Student language. Go to the Language menu, select Choose Language, and pick the language from the Teaching Languages section.

7.2 Reading🔗

Read Part 2 of HtDP 2/e, specifically chapters 8 and 9 through 9.1 (you don’t need to go further).

If you find something unfamiliar (e.g., the material references if), note that we skipped reading Part 1 so you may need to peek in there to look it up.

7.3 Design Recipe🔗

The book emphasizes a design recipe for writing and presenting programs. The design recipe is designed to help students in three ways: to (a) offer structure to those having trouble writing the program; (b) give a sense of what it means to write functional, clean, maintainable, and reliable code (i.e., the kinds that professional programmers have to produce); and (c) provide a structure for seeking help from course staff.

The book’s recipe is quite detailed. Here are the parts that we care about in the placement and in the subsequent course. For every function, we expect to see:
  • a clear and correct signature;

  • a crisp and correct purpose statement; and

  • a good suite of examples and tests.

in addition to the function definition.

You will be graded on all of these. If you have programmed before, you’re especially likely to neglect everything but the function definition. You will then get an especially poor grade.

You do not need to provide data definitions of lists, since these are already in the book.

7.4 Library🔗

To do these assignments, make sure you add the following line at the top of your program:
(require 2htdp/image)

You may also find some string functions useful.

7.5 File Format🔗

For this assignment onward, we ask that you not use DrRacket’s fancy editor features like embedded images, embedded comment boxes, fractions written in repeating-decimal form, etc. While these are all really nice, Gradescope does not understand any of them, making it much more complicated for us to read your code. This is really Gradescope’s fault, but we’re stuck with it.

7.6 Programming Tasks🔗

Define the following functions. Even if you think they correspond to a function that already exists, write it yourself. We’re testing your ability to program, not to read documentation!

Some of the problems refer to “words”. Unless the problem explicitly says otherwise, you may assume every string represents a word, irrespective of its content (e.g., it may contain spaces inside it; that’s not your problem).

7.7 Math Tasks🔗

Please also answer the following math questions.

  1. Find the numerical value of: \[\sum_{n=1}^{100}(4n -3)\]

  2. Let \(f(x) = x + 1\) and let \(g(x) = 2x - 4\). Is there a number \(C\) with the property that for all \(x > C\), we have \(g(x) > f(x)\)? If so, what is it, and if not, why not?

Don’t just write the answer: also show us why your solution is correct (e.g., show your steps).

You can do this on a computer or on paper, whichever is most comfortable. You are welcome to write (whether on the computer or paper), but if you do, please make sure your handwriting and the image upload are legible. The Turnin section discusses file formats.

7.8 Grading Standards🔗

This assignment onward will be graded.

From this assignment onward, for the rest of the placement and the course, you will be graded on both the quality of your code and the correctness of your answers:
  • The latter will be (mostly) graded by computer, so it’s vital you follow the problem specification exactly. If you do not, the grading software will almost certainly assign you a zero. We will not fix these mistakes by hand. If, from prior computing courses, you are accustomed to your instructor fixing these problems for you, please be aware that that won’t happen here.

  • The former will be (mostly) graded by hand, and we will look for how well you have presented the parts expected by the Design Recipe mentioned above.

Both parts are equally important. (For the math, we will similarly check both the correctness of your answer and the soundness of your reasoning. Be sure to show all your steps!)

When writing tests, imagine that you aren’t just testing your own implementation. Suppose you are instead being asked to write tests to grade someone else’s work. What cases do you need to cover? What are some ways they might have gotten the problem wrong?

7.9 Turnin🔗

For the programming portion, create a single file that contains the five functions named above (it can contain any other helper definitions you like as well). The functions must be named exactly as above and must take parameters of exactly the same type and order as above. Please name your file p2-code.rkt.

For the math portion, there will be a separate turnin section on Gradescope. Gradescope accepts only images or PDF files. Call this file p2-math; the filename would have a suffix that reflects the file type.

Concrete instructions on how to upload your work will be posted to EdStem.

Failure to follow any of these instructions may result in zero credit. If you have prior computing experience and are used to your teachers fixing things for you, please know that that doesn’t happen here.

Be sure to read and follow the instructions in Placement AFQ and Anticipated Frequent Questions as well (e.g., note the requirement of anonymity) for this and all subsequent assignments.