Computer Science 340
Programming Languages

Fall 2023, Siena College

Problem Set 7: Expressions and Assignments
Due: 11:59 PM, Wednesday, November 15, 2023

This problem set consists of several questions, some of which require you to complete relatively short programming tasks. You may work alone or in a group of size 2 or 3 on this assignment.

Getting Set Up

In Canvas, you will find a link to follow to set up your GitHub repository, which will be named expressions-probset-yourgitname, for this problem set. Only one member of the group should follow the link to set up the repository on GitHub, then others should request a link to be granted write access.

All GitHub repositories must be created with all group members having write access and all group member names specified in the README.md file by 11:59 PM, Friday, November 10, 2023. This applies to those who choose to work alone as well!

Questions and Programs

Question 1: Sebesta Chapter 7 Problem Set Exercise 2, p. 325. (2 points)

Question 2: Sebesta Chapter 7 Problem Set Exercise 4, p. 326. (2 points)

Question 3: Sebesta Chapter 7 Problem Set Exercise 7, p. 326. (2 points)

Question 4: Sebesta Chapter 7 Problem Set Exercise 8, p. 326. (2 points)

Question 5: Sebesta Chapter 7 Problem Set Exercise 9, p. 326. (5 points)

Question 6: Sebesta Chapter 7 Problem Set Exercise 10, p. 326. (5 points)

Question 7: Answer Sebesta Chapter 7 Problem Set Exercise 13, p. 327, then do Sebesta Chapter 7 Programming Exercise 1, p. 328. (8 points)

Question 8: Sebesta Chapter 7 Problem Set Exercise 15, p. 328. (2 points)

Question 9: Sebesta Chapter 7 Problem Set Exercise 20, p. 328. (2 points)

Question 10: Sebesta Chapter 7 Programming Exercise 9, p. 328. Include your program in your submission and the actual timing results. (8 points)

Question 11: Write a program in some language that supports both 32- and 64-bit floating point types (e.g., C, C++, Java) that demonstrates the importance of evaulation order. One way to do this is as follows. Add together 10 copies each of the numbers 0.1, 0.01, 0.001, ..., 0.000000001. Do this both in order from largest to smallest and from smallest to largest. Also do it with 32-bit values (floats) and 64-bit values (doubles). Print your results with 15 digits after the decimal point and thoroughly explain what you observe. (12 points)

Submission

Commit and push!

Grading

This assignment will be graded out of 50 points.

Feature

Value Score
Q1: PS 2 2
Q2: PS 4 2
Q3: PS 7 2
Q4: PS 8 2
Q5: PS 9 5
Q6: PS 10 5
Q7: PS 13 and PE 1 8
Q8: PS 15 2
Q9: PS 20 2
Q10: PE 9 8
Q11: Floating-point order 12
Total 50