What does it mean when we say a programmer using a function should be able to treat the function like a black box?
a. This is meaningless. One must know how a function does its job to effectively use it.
b. One must be able to rely on the description of the preconditions (requirements for use of the function) and the postconditions (promise of behavior to use the function).
c. If one codes an application that uses a function with a knowledge of the internal mechanism of that function, then when the function’s maintainer changes its internal mechanism, the application programmer could be faced with changing the application code extensively.
d. The most efficient programs are the ones that each function is designed to maximally use the internal behavior of every other function to speed up the code.
b) and c) are the correct answers.
Explanation: a) and c) are foils, explicit non-sense. Code that is written to exploit the internals of other functions is strongly coupled, and is nearly impossible to maintain. It may be fast, but there will be no way to replace one algorithm with another and retain well behaved code.
You might also like to view...
What happens if you omit the word break in a switch statement?
What will be an ideal response?
Critical Thinking QuestionsCase 5-1You have written the code below and you want to step through it with some actual values to make sure that it is working in practice the way you expect it to work.If decGPA > 3.5 Then If intSatScore > 1000 Then lblAdmissionsStatus.Text = "You have earned admission" Else lblAdmissionsStatus.Text = "Retake the SAT exam" EndIfElse If intSatScore > 1200 Then lblAdmissionsStatus.Text = "You have earned probationary admission" Else lblAdmissionStatus.Text = "You have been denied admission" End IfEnd IfAssuming that an applicant has a GPA of 3.55, what is the value of lblAdmissionsStatus.Text if the applicant's SAT score
is 1000? a. Retake the SAT examc. You have earned probationary admissionb. You have earned admission d. You have been denied admission What will be an ideal response?
Assembly language uses ____________________ as assembly commands that are then turned into machine-specific commands.
Fill in the blank(s) with the appropriate word(s).
The Digital Millennium Copyright Act is controversial, in part, because
a. it lengthens copyright protection to 1,000 years. b. it makes it illegal for consumers to circumvent encryption placed on digital media. c. it adds a new federal tax to all CDs and DVDs. d. it requires music streaming services to register with the US Copyright Office. e. All of the above