Test Bank

Problem Solving and Programming Concepts, 9th Ed.

Authors: Maureen Sprankle and Jim Hubbard

Unit One: Introduction to Problem Solving and Programming

Chapter 1: General Problem-Solving Concepts

True or False:

1.1. A heuristic and an algorithmic solution require the same type of problem solving to develop a step by step solution to a problem.

Answer: F

1.2. Identifying the problem is the first step in problem solving.

Answer: T

1.3. Defining the knowledge base is part of understanding the problem.

Answer: T

1.4. The result of a problem is a set of step by step instructions.

Answer: F

1.5. All problems can be solved by writing a set of step by step instructions for a computer.

Answer: F

1.6 It is not important to evaluate a solution.

Answer: F

1.7 The more alternative solutions that are identified, the better chance you have of a good solution.

Answer: T

1.8 Any solution should be considered when solving a problem.

Answer: F

1.9 You can find a step-by-step solution for any problem as long as you understand the problem.

Answer: F

1.10 Problems that require a heuristic solution cannot be solved through a set of step by step instructions.

Answer: T

Multiple Choice:

1.11. Step 3 in problem solving is to identify alternative ways to solve the problem. This means:

a. To define the knowledge base of all participants.

b. To write a list of pros and cons for each solution.

c. To identify as many solutions as possible to the problem.

d. To identify a few solutions to the problem.

Answer: C

1.12. The last step in problem solving is to evaluate the solution. This means:

a. To check if the knowledge base for errors.

b. To check if the set of step by step instructions developed in step 5, list instructions that enable you to solve the problem, solve the problem identified in step 1.

c. To check is the solution solves a problem.

d. To test for understanding of the identified problem.

Answer: B

1.13. An algorithm is:

a. A solution that can not be reached through a set of step by step instructions.

b. The results of the problem.

c. The set of step by step instructions to solve the problem.

d. The knowledge base of a solution.

Answer: C

1.14. Step 4 is to select the best way to solve the problem. This means:

a. To weed out unacceptable solutions.

b. To specify pros and cons of each valid solution.

c. Select one solution after weighing the pros and cons.

d. All of the above.

Answer: D

1.15. A problem that requires a heuristic solution might be:

a. Balancing your checkbook.

b. Choosing stock on the stock market.

c. A calculus problem.

d. Baking a cake.

Answer: B

1.16 The solution to a problem is

a. The set of step-by-step instructions to solve the problem.

b. The program

c. The results.

d. All of the above.

Answer: A

1.17. After you have identified alternative solutions

a. You are ready to evaluate the solution(s).

b. You are ready to select the best solution.

c. You are ready to write the algorithm.

d. You are ready to identify the knowledge base.

Answer: B

1.18. To select the best solution, you should

a. Identify and list the pros and cons of each alternative solution.

b. Develop an algorithm for each solution.

c. Develop the knowledge base for each solution.

d. Identify the problem.

Answer: A

1.19. To create a set of instructions to make Otto walk in a figure other than a square, the following instruction(s) would need to be added to the instruction set:

a. Turn 1 degree, turn is always right.

b. Turn x degrees, where x is a given number of degrees in an angle, turn is always right.

c. Turn x degrees, where x is a given number of degrees in an angle, turn is always left.

d. Any of the above.

Answer: D

1.20. A set of step-by-step instructions is processed:

a. In the order they are presented and processed.

b. Can skip around to other instructions.

c. Can return to a previously processed instruction.

d. In random order.

Answer: A

1.21. The set of step-by-step instructions written for the solution to a problem must:

a. Be within the knowledge base of the problem.

b. Can use any instruction, regardless of the user or the machine.

c. Does not have to be in order of processing.

d. All of the above.

Answer: A

1.22. To identify the best alternative solutions you should:

a. Use other people’s ideas as well as your own.

b. Use only your own ideas.

c. Use any solution, no matter how unacceptable it is.

d. Identify only the first few that you think about.

Answer: A

1.23. When writing a set of instructions for the computer:

a. The instructions must be in proper order.

b. The instructions must be complete.

c. The instructions assume the computer knows nothing.

d. All of the above.

Answer: D

1.24. A problem that would require an algorithmic solution is:

a. Playing a game of chess.

b. Making a cup of cocoa.

c. Deciding which stock to buy.

d. All of the above.

Answer: B

1.25. Computers can best deal with problems that require:

a. Large amounts of calculations.

b. Reasoning.

c. Trial and error.

d. All of the above.

Answer: A

Chapter 2: Beginning Problem-Solving Concepts for the Computer

True or False:

2.1. Numerical data includes all integer numbers and all real numbers.

Answer: T

2.2. Character data includes all numerical data.

Answer: F

2.3. True (T, y, or yes) and False (F, n, or no) are the only values in the logical data set.

Answer: T

2.4. An equation and an expression are the same thing.

Answer: F

2.5. A function is a set of instructions to input data into the computer.

Answer: F

2.6. The hierarchy of operations identifies the order in which the operators are executed.

Answer: T

2.7. The NOT operator reverses the operand.

Answer: T

2.8. The = operator is mathematical operator.

Answer: F

2.9 The = sign is an operator as well as part of an assignment statement.

Answer: T

2.10. A parameter is the data required to process an assignment statement.

Answer: F

Multiple Choice:

2.11. A variable:

a. Is stored in a named memory location.

b. Can be changed while a solution is being executed.

c. Is given a specific data type.

d. All of the above.

Answer: D

2.12. String data:

a. Is group of characters.

b. Can be used to calculate expressions.

c. Contains all other data types.

d. Does not use quotes around the characters.

Answer: A

2.13. In the following expression, what is the order of execution of the operators and the result, given A = 4, B = 5, E = 3, G = True, F = True?

A * B + 7 > E ^ 3 OR NOT G AND F

a. *, +, >, ^, NOT, AND : Result is True

b. AND, NOT, >, ^, *, +, : Result is False

c. ^, *, +, >, NOT, AND, OR : Result is True

d. ^, *, +, >, NOT, AND, OR : Result is False

Answer: C

2.14. Evaluate the following equation for R, given A = 4, B = 5, C = 8 is:

R = A + B * 2 – (C + 4) / A

a. 11

b. 10

c. 12

d. 15

Answer: A

2.15. In the equation: R = A + B * 2 – (C + 4) / A, the operands are:

a. +, *, -, /

b. A, B, C

c. R

d. =

Answer: B

2.16. An ideal variable name for a client name is:

a. C

b. Cli

c. Client_name

d. CN

Answer: c

2.17. The concatenation of “4” and “10” is:

a. 410.

b. “410”

c. 40.

d. “40”.

Answer: B

2.18. The data type of a parameter may be:

a. a constant.

b. a variable.

c. an expression.

d. all of the above.

Answer: D

2.19. In the expression 4 + 10, the operand(s)

a. are the 4 and the 10.

b. is the +.

c. is 14.

d. none of the above.

Answer: A

2.20. In the function LEFT(S,3), the parameter(s):

a. Is LEFT.

b. Are S and 3.

c. Is S.

d. Is 3.

Answer: B

2.21. Mathematical operators include among others:

a. +, -, =

b. >, *, /

c. NOT, MOD, \

d. MOD, *, ^

Answer: D

2.22. The resultant of A OR B

a. Is always true.

b. Is always false.

c. Is always true except when A and B are both false.

d. Is always false except when A and B are both false.

Answer: C

2.23. If the operands are both numerical, and the operator is relational, the data type of the resultant is:

a. Numerical.

b. Relational.

c. Logical.

d. None of the above.

Answer: B

2.24. In the following equation under what conditions would PriorityUse be True?

PriorityUse = (ValidCard AND TimeNoted) OR (Computer AND GuestCard)

a. ValidCard is True, TimeNoted is True, Computer is True, GuestCard is False.

b. ValidCard is False, TimeNoted is True, Computer is False, GuestCard is True.

c. ValidCard is True, TimeNoted is False, Computer is True, GuestCard is False.

d. All of the above.

Answer: D.

2.25. The data type of ZipCodes:

a. Must always be numeric data.

b. Must always be string data.

c. Can be either numeric or string data.

d. None of the above.

Answer: B

Chapter 3: Planning Your Solution

True or False:

3.1. UML (Unified Modeling Language) is a basic tool when using ObjectOriented Programming stucture.

Answer: T

3.2. The problem analysis chart is used to glean needed information and data from a problem.

Answer: T

3.3. An Interactivity chart shows the order that the instructions are executed.

Answer: F

3.4. A flowchart is a graphical representation of an algorithm.

Answer: T

3.5. Internal documentation is written for the user of the program.

Answer: F

3.6. Syntax refers to how many errors are found in a solution.

Answer: F

3.7. Debugging refers to the process of finding and correcting the errors in a solution.

Answer: T

3.8. A module is a set of instructions that processes a subtask of a solution.

Answer: T

3.9. The Control Module is a subtask of the Print Module.

Answer: F

3.10. Instructions in an algorithm must be complete and be executed one step at a time.

Answer: T

Multiple Choice:

3.11. A computer bug is:

a. A moth on the computer screen.

b. An error in a solution.

c. A computer chip.

d. A problem solving tool.

Answer: B

3.12. A parallelogram in a flowchart represents:

a. The start or end of the solution.

b. A process.

c. Input or Output.

d. A decision.

Answer: C

3.13. When a module is processed:

a. The computer jumps to the module, executes the instructions in the module, and then quits.

b. The computer jumps to the module, executes the instructions in the module, and then returns to the next executable instruction.

c. The computer jumps to the module, executes the instructions in the module, and then jumps to another module according to the structure chart.

d. The computer ignores the module and returns later to execute the instructions.

Answer: B

3.14. The algorithms:

a. Are the finished sets of programming instructions as written in a specific computer language.

b. Is the set of step by step instructions divided into the specific parts, or modules.

c. Are the words written inside the flowchart.

d. Are the modules outlined in a data flow pattern.

Answer: B

3.15. The IPO chart:

a. Shows the input, the processing, the output, and the module numbers.

b. Information is from the structure chart and the program analysis chart.

c. Shows which module each processing step is found.

d. All of the above.

Answer: D

3.16. The Problem Analysis Chart:

a. Has Three parts: the given data, the required results, and the processing required.

b. Has Four parts: the given data, the required results, the processing required, and the solution alternatives.

c. Helps to delete the words from a problem.

d. All of the above.

e. A and C.

Answer: E

3.17. In an algorithm:

a. The instructions cannot assume anything.

b. The instructions cannot skip any steps.

c. The instructions must be executed one at a time.

d. All of the above.

Answer: D

3.18. In a flowchart the diamond indicates:

a. A decision.

b. Input/output.

c. Processing.

d. Start.

Answer: A

3.19. An annotated flowchart includes:

a. The test results.

b. The algorithm.

c. The internal documentation.

d. All of the above.

e. a and c.

Answer: E

3.20. Testing the solution:

a. Provides a validation of the solution.

b. Is not necessary.

c. Does not find logic errors.

d. Should only be done after the program on the computer is completed.

Answer: A

3.21. Internal documentation:

a. Provides communication to the user.

b. Is unnecessary.

c. Provides communication and reminders to the programmer.

d. None of the above.

Answer: C

3.22. External documentation:

a. Provides communication to the user.

b. Is unnecessary.

c. Provides communication and reminders to the programmer.

d. None of the above.

Answer: A

3.23. When using the problem solving tools, the first one to use is:

a. PAC Chart.

b. IPO Chart.

c. Algorithm.

d. Flowchart.

Answer: A

3.24. An example of data found in a file would be:

a. Student name.

b. All personnel data.

c. One employee’s personnel data.

d. A quantity

Answer: B

3.25. When a flowchart does not fit on a page:

a. The module needs to end.

b. Use off page connectors.

c. Use on page connectors.

d. Tape another piece of paper on the bottom or side of the flowchart page.

Answer: B

3.26. Which of the following diagrams would you use when problem solving using UML:

a. Use case diagrams

b. Class diagrams

c. Sequence diagrams

d. State chart diagrams

e. Activity diagrams.

f. All of the above.

Answer: F

Unit Two: Logic Structures

Chapter 4: An Introduction to Programming Structure

True or False:

4.1. Cohesion is the ability of a module to be independent from other modules.

Answer: T

4.2. Modules are not necessary to use when programming.

Answer: F

4.3. Modules should have a designated function.

Answer: T

4.4. The value of a local variable is available to all other modules.

Answer: F

4.5. The value of a parameter is available to all other modules.

Answer: F

4.6. The value of a global variable is available to all other modules.

Answer: T

4.7. A solution is just as easy to read and understand if it is written in one module or many modules.

Answer: F

4.8. The use of modules many times eliminates rewriting the same instructions.

Answer: T

4.9. The Wrap-up module processes only those instructions that are at the end of a series of other modules before continuing to other modules.

Answer: F

4.10. The actual parameter listing is the list of parameters that follow the module name at the beginning of the module.

Answer: F

Multiple Choice:

4.11. Coupling allows:

a. Data to be passed from one module to all other modules.

b. Data to be passes from one module to another module.

c. Data to be unavailable to other modules.

d. Instructions to be available to other modules.

Answer: B

4.12. Data can be made available to other modules through the use of:

a. Parameters.

b. Global variables.

c. Return values.

d. All of the above.

Answer: D

4.13. Call-by-reference parameters pass values:

a. By passing the value of the variable.

b. By making the variable global.

c. By passing the memory location of the variable.

d. None of the above.

Answer: C

4.14. A coupling diagram shows:

a. How the data is passed from one module to another.

b. The test values of the variables.

c. How the modules process the data.

d. Where the variables are located in the modules.

Answer: A

4.15. The data dictionary is:

a. A list of definitions of words used in the development of the solution.

b. A list of definitions and attributes of the variables used in the solution.

c. A table the computer uses internally to define the memory location of the variables.

d. A table of values to test the solution of the problem.

Answer: B

4.16. Cohesion relates to:

a. The ability to share data between modules.

b. The ability to have local variables shared between modules.

c. The functional independence of each module.

c. All of the above.

Answer: C

4.17. Modules should:

a. Have one function.

b. Have one entrance and one exit.

c. Be short and easily read.

d. All of the above.

e. a and c.

Answer: D

4.18. Calculations may be found:

a. In any module.

b. Only in the calculation modules.

c. Only in any process modules.

d. Any module but the Wrap-up module.

Answer: A

4.19. Call-by-value parameters:

a. Pass the changed value back to the calling module.

b. Can be changed in the called module.

c. Pass the unchanged (oringinal) value back to the calling module.

d. Cannot be changed in the called module.

e. b and c.

f. c and d.

Answer: E

4.20. The variable names in the formal and actual parameter listings:

a. Must be the same.

b. May be the same.

c. Cannot be the same.

d. Only the call-by-value names must be the same.

Answer: B

4.21. The sequential logic structure:

a. Processes instructions in order of listing.

b. Allows the computer to make a choice of two paths to follow.

c. Allows the computer to repeat instructions.

d. Allows the computer to make a choice of two or more paths to follow.

Answer: A

4.22. The decision logic structure:

a. Processes instructions in order of listing.

b. Allows the computer to make a choice of two paths to follow.

c. Allows the computer to repeat instructions.

d. Allows the computer to make a choice of two or more paths to follow.

Answer: B

4.23. The loop logic structure:

a. Processes instructions in order of listing.

b. Allows the computer to make a choice of two paths to follow.

c. Allows the computer to repeat instructions.

d. Allows the computer to make a choice of two or more paths to follow.

Answer: C

4.24. The case logic structure within the decision logic structure:

a. Processes instructions in order of listing.

b. Allows the computer to make a choice of two paths to follow.

c. Allows the computer to repeat instructions.

d. Allows the computer to make a choice of two or more paths to follow.

Answer: D

4.25. The values of local variables:

a. Are defined within a module.

b. Are defined within the calling module.

c. Can only be changed within the module.

d. Are available to any called module.

Answer: A

Chapter 5: Problem Solving with the Sequential Logic Structure

True or False:

5.1. The sequential logic structure allows decisions to be made.

Answer: F

5.2. The problem analysis chart, the IPO chart, the structure chart, the algorithms, and the flowchart are all tools to be used in the development of a solution to a problem.

Answer: T

5.3. The algorithm and the flowchart are the same thing.

Answer: F

5.4. The equals sign in an assignment statement really means equals to.

Answer: F

5.5. The word end and exit can be used interchangeably according to the desire of the developer.

Answer: F

5.6. The Return instruction is used to end a module.

Answer: T

5.7. The Return instruction and the Exit instruction are exactly the same and can be used interchangeably.

Answer: F

5.8. An instruction has two parts: the general instruction followed by the specifications on how to execute the instruction.

Answer: T

5.9. In a coupling diagram, all variables are indicated in the same way.

Answer: F

5.10. It is not important to indicate what documentation is needed as you are developing the solution.

Answer: F

Multiple Choice:

5.11. The flattened ellipse in a flowchart indicates:

a. A process.

b. An input or output instruction.

c. A decision.

d. The start or stop of the module.

Answer: D

5.12. The rectangle in a flowchart indicates:

a. A process.

b. An input or output instruction.

c. A decision.

d. A module to be processed.

Answer: A

5.13. The algorithm of a module always starts with:

a. A flattened ellipse.

b. The module name and number.

c. The name of the program.

d. The name of the developer.

Answer: B

5.14. The interactivity (structure) chart is developed by:

a. Using the similar types of modules for all programs.