Chapter 6 Exercises

For Exercises 1- 10 , match the activity with the phase of the object-oriented
methodology. A. Brainstorming ... What translates a Java program into Bytecode?
C. 13. ... For Exercises 25?46, match the language paradigm and the language
or the language description. A. Procedural. B. Functional. C. Logic. D. Object
oriented.

Part of the document


Chapter 9 Exercises and Answers
Answers are in blue.

For Exercises 1- 10 , match the activity with the phase of the object-
oriented methodology.
A. Brainstorming
B. Filtering
C. Scenarios
D. Responsibility algorithms


|1. |Reviewing a list of possible classes, looking for duplicates or|
| |missing classes. |
| |B |
|2. |Asking "what if" questions. |
| |C |
|3. |Assigning responsibilities to classes. |
| |C |
|4. |Generating first approximation to the list of classes in a |
| |problem. |
| |A |
|5. |Assigning collaborators to a responsibility. |
| |C |
|6. |Developing algorithms for the responsibilities listed on a CRC |
| |card. |
| |D |
|7. |Output from this phase is a fully developed CRC card for all |
| |classes. |
| |C |
|8. |Output from this phase is the design ready to be translated |
| |into a program. |
| |D |
|9. |During this phase, inheritance relationships are explored. |
| |B |
|10. |Phase in which functional programming techniques are |
| |appropriate. |
| |D |

For Exercises 11-24, match the question with the appropriate translation or
execution system.
A. Interpreter
B. Assembler
C. Compiler
D. Machine code


|11. |What translates a high-level language into machine code? |
| |C |
|12. |What translates a Java program into Bytecode? |
| |C |
|13. |What executes Bytecode? |
| |A |
|14. |What translates an assembly language program? |
| |B |
|15. |What is the output of an assembler? |
| |D |
|16. |What takes input in a high-level language and directs the |
| |computer to perform the actions specified in each statement? |
| |A |
|17. |What executes the Java Virtual Machine? |
| |D |
|18. |What is used to translate a program in ALGOL? |
| |C |
|19. |What is used to translate a program in APL? |
| |A |
|20. |What is used to translate a program in COBOL? |
| |C |
|21. |What is used to translate a program in FORTRAN? |
| |C |
|22. |What is used to translate a program in Lisp? |
| |A |
|23. |What is used to translate a program in PROLOG? |
| |A |
|24. |Which translator runs the most slowly? |
| |A |

For Exercises 25-46, match the language paradigm and the language or the
language description.
A. Procedural
B. Functional
C. Logic
D. Object oriented
E. Procedural language with some object-oriented features
F. Object-oriented language with some procedural features


|25. |Which paradigm most accurately describes FORTRAN? |
| |A |
|26. |Which paradigm most accurately describes C++? |
| |E |
|27. |Which paradigm most accurately describes PASCAL? |
| |A |
|28. |Which paradigm most accurately describes Java? |
| |F |
|29. |Which paradigm most accurately describes Lisp? |
| |B |
|30. |Which paradigm most accurately describes BASIC? |
| |A |
|31. |Which paradigm most accurately describes PROLOG? |
| |C |
|32. |Which paradigm most accurately describes SIMULA? |
| |D |
|33. |Which paradigm most accurately describes ALGOL? |
| |A |
|34. |Which paradigm most accurately describes ML? |
| |B |
|35. |Which paradigm most accurately describes Scheme? |
| |B |
|36. |Which paradigm most accurately describes Python? |
| |D |
|37. |Which paradigm most accurately describes C? |
| |A |
|38. |Which paradigm most accurately describes Smalltalk? |
| |D |
|39. |The dominant languages used in industry throughout the history|
| |of computing software come from which paradigm? |
| |A |
|40. |Which paradigm did the Japanese choose for the |
| |fifth-generation computer? |
| |C |
|41. |Which paradigm allows the programmer to express algorithms as |
| |a hierarchy of objects? |
| |D |
|42. |Which paradigm allows the programmer to express algorithms as |
| |a hierarchy of tasks? |
| |A |
|43. |Which paradigm allows the programmer to express algorithms as |
| |mathematical functions? |
| |B |
|44. |Which paradigm has no assignment statement? |
| |B |
|45. |Which paradigm uses recursion exclusively to express |
| |repetition? |
| |B |
|46. |Which paradigm has no variables? |
| |B |

Exercises 47 - 84 are short answer.


|47. |What is the hallmark of an assembly language? |
| |The hallmark of an assembly language is that each assembly |
| |language instruction is translated into one machine language |
| |instruction. |
|48. |Distinguish between an assembler and a compiler. |
| |An assembler translates assembly-language instructions into |
| |machine code. A compiler translates high-level language |
| |instructions into machine code (or assembly code). The |
| |translation of an assembler is one to one: One statement in |
| |assembly language is translated into one statement in machine |
| |code. The translation of a compiler is one to many: One |
| |high-level language instruction is translated into many |
| |machine language instructions. |
|49. |Distinguish between a compiler and an interpreter. |
| |The output from a compiler is a machine-language program. |
| |That program may be stored for later use or immediately |
| |executed, but the execution is a distinct process from the |
| |translation. An interpreter translates and executes together.|
| |The output from an interpreter is a solution to the original |
| |problem, not a program that when executed gives you the |
| |solution. |
|50. |Compare and contrast an assembler, a compiler, and an |
| |interpreter. |
| |All three are translators. They differ in the complexity of |
| |the languages they translate and in the output from the |
| |translator. Assemblers and compile