QB02Test.doc



Chapter 2

INTRODUCTION TO STRUCTURED PROGRAMMING AND PROBLEM SOLVING

Multiple Choice

1. The three levels of programming languages discussed in this chapter, in order from the most machine-oriented to the most human-oriented, are _______.

a. machine language, high-level language, and assembly language

b. machine language, high-level language, and binary representation

c. binary representation, machine language, and assembly language

d. machine language, assembly language, and high-level language

2. Machine language programs are written using _______.

a. English-like words

b. series of 1s and 0s representing high and low electrical states

c. BASIC

d. symbolic names to represent storage locations

3. Programming languages that are more oriented toward the programmer, rather than the computer are _______ languages.

a. assembly

b. machine

c. low-level

d. high-level

4. Assembly language programs _______.

a. differ depending on the type of computer on which they are to be executed

b. contain instructions written in 1s and 0s.

c. do not require knowledge of the internal operations of the computer

d. more closely resemble English than BASIC

5. BASIC is _______.

a. a machine language

b. short for Beginner’s All-Purpose Symbolic Instruction Code

c. difficult to learn

d. useful only for writing business programs

6. The _______ is the sequence of steps that a programmer uses when using the computer as a problem-solving tool.

a. structure chart

b. programming process

c. problem definition

d. decision step

7. Which of the following is true of structured programming?

a. Program logic is easy to follow and the programs are divided into smaller subprograms.

b. Program logic is easy to follow and the programs are written in machine language.

c. The programs are divided into smaller subprograms and the programs are written in machine language.

d. The programs are written in assembly language and are divided into smaller subprograms.

8. Which of the following is not part of the first step of the programming process?

a. determining the needed output and how it should be formatted

b. determining the needed input

c. documenting the problem definition

d. developing an algorithm

9. _______ graphically represents how a problem solution can be broken into subtasks.

a. A flowchart

b. Pseudocode

c. An algorithm

d. A structure chart

10. A(n) _______ must list every step in a problem solution necessary to get the correct output from the input.

a. algorithm

b. problem definition

c. programming process

d. input chart

11. Which of the following is not one of the three basic types of control structures with which any program can be written?

a. the loop structure

b. the addition statement

c. the decision structure

d. the sequence

12. _______ is a method of solving a problem by proceeding from the general to the specific.

a. Flowcharting

b. Problem definition

c. Top-down design

d. Pseudocoding

13. Which of the following is not one of the steps in the programming process?

a. writing and documenting the program

b. defining and documenting the problem

c. designing and documenting a solution

d. printing the results

14. Which of the three types of program structures would be the most useful if a program needed to read the names and test scores of 200 students?

a. the sequence

b. the decision structure

c. the loop structure

d. none

Use the following flowchart to answer Questions 15–18.

[pic]

15. How many input steps does this flowchart contain?

a. 0

b. 1

c. 2

d. 3

16. How many output steps does this flowchart contain?

a. 0

b. 1

c. 2

d. 3

17. What type of symbol represents the processing step?

a. [pic]

b. [pic]

c. [pic]

d. [pic]

18. Which of the following statements best describes the function of this flowchart?

a. It calculates the time needed to travel a specified distance at a specified speed.

b. It calculates the distance that can be traveled in a specified time at a specified speed.

c. It calculates the speed needed to travel a specified distance in a specified time.

d. It calculates the amount of gas used to travel a specified distance in a specified time.

Use the following flowchart to answer Questions 19–21.

[pic]

19. How many arithmetic steps does this flowchart have?

a. 1

b. 2

c. 3

d. 4

20. In all, how many input and output steps does this flowchart have?

a. 0

b. 2

c. 3

d. 4

21. Which of the following pseudocodes best corresponds to this flowchart?

a. Begin

Enter height of Christmas tree

Cost = height * 3.00

Cost = cost + cost x 0.05

Output cost

End

b. Begin

Enter height of Christmas tree

Cost = cost + tax

Output cost

Cost = height * 3.00

End

c. Begin

Enter height of Christmas tree

Cost = height * 3.00

Output cost

Tax = cost * 0.05

Cost = cost + tax

End

d. Begin

Cost = height * 3.00

Tax = cost * 0.05

Cost = cost + tax

Output cost

End

22. Pseudocode uses _______ to express a program’s logic.

a. English-like statements

b. an object program

c. geometric symbols

d. stepwise refinement

23. In a flowchart, a decision step is represented by which of the following symbols?

a. [pic]

b. [pic]

c. [pic]

d. [pic]

24. A _______ is used to perform repetitive tasks that involve executing a sequence of instructions as many times as needed.

a. flowchart

b. loop

c. decision structure

d. simple sequence

25. In a flowchart, input or output is represented by which of the following symbols?

a. [pic]

b. [pic]

c. [pic]

d. [pic]

26. When a program is _______, it is run with a wide variety of data to determine if it always obtains correct results.

a. debugged

b. compiled

c. tested

d. desk checked

27. The grammatical rules of a language are its _______.

a. structure

b. syntax

c. pseudocode

d. documentation

28. When a programmer traces through a program by hand in an attempt to locate errors, he or she is _______ the program.

a. executing

b. coding

c. desk checking

d. documenting

29. If you used the formula length + width to calculate the area of a rectangle (when it should be length × width), you would have made a _______ error.

a. logic

b. syntax

c. pseudocode

d. debugging

30. The process of actually writing a program in a programming language is _______.

a. coding

b. pseudocoding

c. compiling

d. debugging

Short-Answer Questions

31. Write an algorithm to instruct a person to boil a pot of water.

32. Draw a flowchart showing the steps in making a pizza.

Return to CP1020

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download