Chapter 4 Quiz A

The first quiz on Chapter 4, based on Chapter 4 Discussion III and similar CodingBat problems.
  • You may ask for help with “red error messages”.
  • No internet sources.
  • No help from other students.
  • No notes.
  1. nearTen Logic-1. Given a positive Integer n, return True if n is within two of a multiple of ten.
  2. matchUp Array-2. Given two lists of the same number of Int, consider the each pair of elements with the same index (same position in the list when lined up). Return the count of the number of times that the two elements differ by two or less, but are not equal.

Periods are short today.

Extra credit. Write a signature using class constraints:

f x a y = if x == a then sqrt(y) else y
Last modified August 18, 2023: 2022-2023 End State (7352e87)