CMSI 386 Practice Exam
Name: (ENTER YOUR NAME HERE)
Problem 1: Forcing Keyword Arguments
Suppose the boss demanded a function to compute the area of a rectangle. The boss says the function MUST have four parameters,
y2 where (
y1) is one of the corner points and (
y2) is the other corner point. But since our users can never remember what order the four parameters go in (Is it
y2?), we will make our function REQUIRE that the four arguments in the call be “named.” Note that I said required. The function is not supposed to work if the arguments are not named. In fact, it should be an error to make a call without “naming” the arguments.