wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Programming Logic and Design, 5th edition. Ch 1- 4

Total questions: 168

Worksheet time: 2hrs 44mins

Name
Class
Date
1.

The main components of a computer are?

a)

Hardware

b)

Hardware and Software

c)

Central Processing Unit (CPU) and Software

2.
  1. What is a flag variable?

a)

A flag is a variable signal that sets to False

b)

A flag is a variable that signals when some condition exists in the program.

c)

A flag is a variable signal that sets to True

d)

A flag is a variable that signals when some condition starts in the program

3.
  1. What values can you store in a Boolean variable?

a)

True or False

b)

Yes or No

c)

Fact or Fiction

4.

You need to write a multiple alternative decision structure, but the language you are using will not allow you to perform the test you need in a Select Case statement. What can you do to achieve the same results?

a)

the program jumps out of the structure.

b)

the program will branch to the Case 1: section and execute the Display "Error: Invalid month" statement that immediately follows it.

c)

the program branches to the Case statement

d)

the program branches to the Default statement and executes the statements that immediately follow it.

5.

What does the case structure test, in order to determine which set of statements to execute?

a)

test If the testExpression does not match any of the Case values

b)

test if there is one or more blocks of statements that begin with a Case statement.

c)

test the value of a variable or an expression and then use that value to determine which statement or set of statements to execute.

d)

tests if the model number can be stored in a variable

6.

How do you write a multiple alternative decision structure in pseudocode?

a)

b)

c)

d)

7.
  1. How does a dual alternative decision structure work?

a)

is an expression that can be evaluated to True or False using a relational operator (>, <, >=, <=, ==, !=)

b)

one path is taken if a condition is true, and the other path is taken if the condition is false

c)

One path is taken if the condition evaluates True, the other if the condition evaluates False. See the answer to 4.8. It's the same question!

8.

When you write an If-Then-Else statement, under what circumstances do the statements that appear between Else and End If execute?

a)

If the expression is false

b)

If the expression is true

9.
  1. What statement do you use in pseudocode to write a dual alternative decision structure?

a)

If Else

b)

Else If

c)

Else

d)

If-Then-Else

10.

How does a dual alternative decision structure work?

a)

a decision structure will execute one group of statements if its Boolean expression is true, or another group if its Boolean expression is false.

b)

is any Boolean expression. If the expression is true, the statements that appear next are executed, up to the line that reads Else.

c)

two possible paths of execution—one path is taken if a condition is true, and the other path is taken if the condition is false

11.

Write a pseudocode If-Then statement that assigns 0.2 to commission if sales is greater than or equal to 10,000

a)

If sales = 100,000

Set commission > 0.2

End if

b)

If sales >= 10,000

Set commission = 0.2

End if

c)

If sales = 10,000

Set commission < 0.2

End if

d)

If sales >= 10,000

Set commission <= 0.2

End if

12.

Write a pseudocode If-Then statement that assigns 0 to x if y is equal to 20

a)

If y = 0 Then

Set x = y

End if

b)

If y >= 20 Then

Set x > 0

End if

c)

If y <= 20 Then

Set x = y

End if

d)

If y = 20 Then

Set x = 0

End if

13.
  1. What types of relationships between values can you test with relational operators?

a)

Greater than

b)

Less than

c)

>=

Greater than or equal to

d)

<=

Less than or equal to

e)

==

Equal to

14.
  1. What is a Boolean expression?

a)

a flowchart showing human actions, not program statements

b)

a logical design that controls the order in which a set of statements executes

c)

All programming languages allow you to create expressions that can be evaluated as either true or false

d)

allows a program to perform actions only under certain conditions

15.

What is a single alternative decision structure?

a)

provides only one alternative path of execution

b)

a logical design that controls the order in which a set of statements executes

c)

a Boolean expression

d)

a flowchart showing human actions, not program statements

16.

Computers can do many different jobs because they are ________.

a)

reliable

b)

electronic

c)

automated

d)

programmable

17.

A computer program is ________.

a)

a set of instructions that allow the computer to solve a problem or perform a task

b)

the same as main memory

c)

another name for an operating system

d)

only used for desktop computers

18.

________ is an extensive encoding scheme that is compatible with ASCII.

a)

Floating-point notation

b)

Unicode

c)

RAM

d)

Assembly language

19.

A syntax error does not prevent a program from being compiled and executed.

a)

True

b)

False

20.

A(n) ________ is a software package that usually consists of a text editor, a compiler or interpreter, and tools to test and debug programs.

a)

CPU

b)

IDE

c)

storage device

d)

compiler

21.

The instruction set for a microprocessor is unique and is typically understood only by the microprocessors of the same brand.

a)

True

b)

False

22.

The computer language that uses mnemonics for writing programs is ________.

a)

Pascal

b)

Assembly

c)

Ada

d)

Java

23.

The term software refers to all the physical devices, or components, that a computer is made of.

a)

True

b)

False

24.

Each different type of CPU has its own ________.

a)

syntax

b)

machine language

c)

high-level language

d)

software

25.

________ is the term used for a set of rules that must be strictly followed when writing a program.

a)

Grammar

b)

Semantics

c)

Key words

d)

Syntax

26.

What is the largest value that can be stored in one byte?

a)

8

b)

128

c)

255

d)

16

27.

The ________ cycle is used by the CPU to execute instructions in a program.

a)

execute - fetch - decode

b)

decode - fetch - execute

c)

decode - execute - fetch

d)

fetch - decode - execute

28.

In a flowchart the symbol that represents an assignment statement is an oval.

a)

True

b)

False

29.

What symbol is used to mark the beginning and end of a string?

a)

a slash ( / )

b)

an asterisk ( * )

c)

a semicolon ( ; )

d)

a quote mark ( " )

30.

An uninitialized variable is a variable that has been declared and automatically initialized to zero.

a)

True

b)

False

31.

Which of the following is not a variable data type?

a)

String

b)

Integer

c)

Numeral

d)

Real

32.

A(n) ________ is a name that represents a value which cannot be changed during the program's execution.

a)

input variable

b)

uninitialized variable

c)

named constant

d)

named variable

33.

What is the error in the following pseudocode?

Declare Integer widgets

Declare Real cost

Set widgets = 3.5

Set cost = widgets * 5

a)

There is no error.

b)

widgets has been declared as an Integer and cannot hold a floating-point value.

c)

widgets is an invalid variable name for this code.

d)

You cannot mix a Real variable and an Integer variable in a program.

34.

What term is used for a string that appears in the actual code of a program?

a)

str

b)

string literal

c)

any of these

d)

virtual string

35.

A(n) ________ is a diagram that graphically depicts the steps that take place in a program.

a)

algorithm

b)

code list

c)

pseudocode document

d)

flowchart

36.

A variable is a storage location in memory that is represented by a name and can hold different values during the execution of the program.

a)

True

b)

False

37.

What is the first step of the program development cycle?

a)

test executable code

b)

write the code

c)

design the program

d)

correct syntax errors

38.

________ is the informal language used by programmers to create models of programs.

a)

Source code

b)

Flowcharting

c)

Pseudocode

d)

Algorithm

39.

What is the value of the variable result in the following expression?

Set result = ( 6 + 8) / 4 * 2

a)

10

b)

7

c)

28

d)

22

40.

What is the value of the following expression?

12 - 4 * 3 / 2 + 9

a)

21

b)

2.18

c)

15

d)

-6

41.

What is a program

a)

The central processing unit

b)

A task a computer performs

c)

small chips known as microprocessors

d)

read-only memory

42.

What are the five major components of a computer system

a)

The Central Processing Unit (CPU)

b)

Main Memory

c)

Secondary storage devices

d)

Input devices

e)

Output devices

43.

What part of the computer actually runs programs?

a)

The central processing unit, or CPU

b)

Main Memory

c)

Secondary storage

d)

Universal Serial Bus drives, or USB drives

44.

What part of the computer serves as a work area to store a program and its data while the program is running?

a)

Input device

b)

Solid state drives

c)

Main Memory

d)
  • The central processing unit (CPU)

45.

What part of the computer holds data for long periods of time, even when there is no power to the computer?

a)

Universal Serial Bus drives, or USB drives

b)

Memory chips

c)

keyboard, mouse, touchscreen, ect.

d)

Secondary storage

46.

What part of the computer collects data from people and from other devices?

a)

Flash drives

b)

Input Devices

c)

Output Devices

d)

Microprocessors

47.

What part of the computer formats and presents data for people or other devices?

a)

Output Devices

b)

Cloud storage

c)

Input Devices

d)

ENIAC

48.

What amount of memory is enough to store a letter of the alphabet or a small number?

a)

One byte

b)

Two byte

c)

Three byte

d)

Four byte

49.

What do you call a tiny “switch” that can be set to either on or off?

a)

Bit, Binary Digit

b)

Data

c)

Binary Numbering System.

50.

In what numbering system are all numeric values written as sequences of 0s and 1s?

a)

Floating-point notation

b)

Binary numbering system

c)

Digital data

51.

What is the purpose of ASCII

(American Standard Code for Information Interchange)?

a)

a set of 128 numeric codes that represent the English letters, various punctuation marks, and other characters.

b)

quickly becoming the standard character set used in the computer industry.

c)

coding schemes have been developed to represent characters in computer memory.

d)

binary numbering system

52.

What encoding scheme is extensive to represent all the characters of all the languages in the world?

a)

ASCII

b)

Unicode

53.

What do the terms “digital data” and “digital device” mean?

a)

used to describe anything that uses binary numbers.

b)

any device that works with binary data

c)

data that is stored in binary

d)

broken into small pieces known as samples

54.

A CPU understands instructions that are written only in what language?

a)

high-level language

b)

machine language

c)

assembly language

d)

programming language

55.

A program has to be copied into what type of memory each time the CPU executes it?

a)

Execute

b)

Decode

c)

Main Memory

d)

RAM

56.

When a CPU executes the instructions in a program, it is engaged in what process?

a)

Fetch-Decode-Execute Cycle.

b)

Execute-Fetch-Decode Cycle

c)

Decode-Fetch-Execute Cycle.

57.

What is assembly language?

a)

machine language program.

b)

short words that are known as mnemonics.

58.

What type of programming language allows you to create powerful and complex programs without knowing how the CPU works?

a)

Low-level language.

b)

High-level language

59.

Each language has a set of rules that must be strictly followed when writing a program. What is this set of rules called?

a)

Syntax

b)

Statements

c)

High-level language

60.

What do you call a program that translates a high-level language program into a separate machine language program?

a)

Interpreter

b)

Compiler

c)

Integrated development environments

61.

What do you call a program that both translates and executes the instructions in a high-level language program?

a)

Interpreter

b)

Compiler

c)

Statements

62.

What type of mistake is usually caused by a misspelled key word, a missing punctuation character, or the incorrect use of an operator?

a)

Software error

b)

Syntax error

c)

Programming error

63.

What fundamental set of programs controls the internal operations of the computer’s hardware?

a)

Operating Systems.

b)

Utility Programs

c)

Software Development Tools.

64.

What do you call a program that performs a specialized task, such as a virus scanner, a file compression program, or a data backup program?

a)

Operating Systems

b)

Utility Programs

c)

Software Development Tools

65.

Word processing programs, spreadsheet programs, email programs, Web browsers, and game programs belong to what category of software?

a)

System Software

b)

Application Software

66.

What System Software is used to creat, modify, and test software?

a)

Operating Systems

b)

Utility Programs

c)

Software Development Tools

67.

Who is a programmer’s customer?

a)

person

b)

group

c)

organization

d)

programmer

68.

What is a software requirement?

a)

someone who is paying you to write a program

b)

single function that the program must perform in order to satisfy the customer

c)

steps that must be taken to perform the task

d)

mistake that does not prevent the program from running

69.

What is an algorithm?

a)
  1. Pour the desired amount of water into a pot.

  2. Put the pot on a stove burner.

  3. Turn the burner to high.

  4. Watch the water until you see large bubbles rapidly rising. When this happens, the water is boiling.

b)

pseudocode and flowcharts

c)

diagram that graphically depicts the steps that take place in a program

d)

set of well-defined logical steps that must be taken to perform a task

70.

What is pseudocode?

a)

fake code

b)

real code

c)

high-level code

d)

low-level code

71.

What is a flowchart?

a)

A diagram that graphically depicts the steps that take place in a program.

b)

terminal symbols

c)

a small circle with a letter or number written inside it.

72.

What are each of the following symbols in a flowchart?

a)

ovals, which appear at the top and bottom of the flowchart, are called terminal symbols.

b)

off-page connector symbol to connect the pieces of the flowchart.

c)

parallelograms, which are used for both input symbols and output symbols

d)

rectangles, which are called processing symbols.

73.

What are the three operations that programs typically perform?

a)
  1. Input is received.

b)
  1. Some process is performed on the input.

c)

Output is produced.

d)

high-level languages.

74.

What is an IPO chart?

a)

input

b)

processing

c)

output

d)

program

75.

What is a sequence structure?

a)

When a string appears in the actual code of a program (or in pseudocode)

b)

a sequence of characters that is used as data

c)

logical design that controls the order in which a set of statements executes.

d)

A set of statements that execute in the order that they appear

76.

What is a string?

What is a string literal?

a)

a sequence of characters that is used as data

b)

string appears in the actual code of a program

c)

simply any hypothetical person that is using a program and providing input for it.

d)

uppercase characters that appear in a name are sometimes reminiscent of a camel’s humps.

77.

A string literal is usually enclosed inside a set of what characters?

a)

quote marks

b)

quotation marks

78.

What is a variable?

a)

simple but effective tool that programmers commonly use while designing programs.

b)

logical design that controls the order in which a set of statements executes.

c)

storage location in memory that is represented by a name.

d)

message that tells (or asks) the user to enter a specific value.

79.

What are three common rules for naming variables?

a)
  • Variable names must be one word. They cannot contain spaces.

b)
  • The program pauses and waits for the user to type something on the keyboard, and then press the Enter key.

c)
  • In most languages, punctuation characters cannot be used in variable names. It is usually a good idea to use only alphabetic letters and numbers in variable names.

d)
  • In most languages, the first character of a variable name cannot be a number.

80.

What variable naming convention do most programmers use?

a)

camelCase

b)

underscore character

81.

Look at the following pseudocode statement:

  Input temperature

What happens when this statement executes?

a)

It will display what temperature is entered

b)

Does nothing

82.

Who is the user?

a)

simply any hypothetical person that is using a program and providing input for it

b)

simple but effective tool that programmers commonly use while designing programs.

c)

logical design that controls the order in which a set of statements executes.

d)

storage location in memory that is represented by a name.

83.

What is a prompt?

a)

logical design that controls the order in which a set of statements executes.

b)

simple but effective tool that programmers commonly use while designing programs.

c)

message that tells (or asks) the user to enter a specific value.

d)

storage location in memory that is represented by a name.

84.

What two steps usually take place when a program prompts the user for input?

a)
  • The first character of the second and subsequent words is written in uppercase.

b)
  1. Display a prompt on the screen.

c)

Read a value from the keyboard.

d)
  • Variable names must be one word. They cannot contain spaces.

85.

What does the term user-friendly mean?

a)

storage location in memory that is represented by a name.

b)

logical design that controls the order in which a set of statements executes.

c)

simple but effective tool that programmers commonly use while designing programs.

d)

commonly used in the software business to describe programs that are easy to use.

e)

message that tells (or asks) the user to enter a specific value.

86.

What is an assignment statement?

a)

assignment statement appears in a processing symbol

b)

sets a variable to a specified value

c)

common calculation in computer programming.

d)

determining the average of a group of values

87.

When you assign a value to a variable, what happens to any value that is already stored in the variable?

a)
  • When you store a value in a variable, that value replaces the previous value that was in the variable.

b)

The outcome variable could be assigned either 6 or 14, depending on when the division takes place.

c)

statement to perform the calculation and store the result in the average variable:

Set average = (test1 + test2 + test3) / 3
88.

Summarize the mathematical order of operations, as it works in most programming languages.

a)
  1. 1. Perform any operations that are enclosed in parentheses.

b)
  1. 2. Perform any operations that use the exponent operator to raise a number to a power.

c)

3. Perform any multiplications, divisions, or modulus operations as they appear from left to right.

d)

4. Perform any additions or subtractions as they appear from left to right.

89.

What is the purpose of the exponent operator?

a)

sometimes the ** characters are used

b)

The ∧ symbol is commonly used

c)

the % character is used

d)

additional algebraic expressions

90.

What is the purpose of the modulus operator?

a)

sometimes the ** characters are used

b)

MOD:

Divides one number by another and gives the remainder

c)

The ∧ symbol is commonly used

d)

the % character is used

91.

What two items do you usually specify with a variable declaration?

a)

This blank line does not affect the way the program works because most compilers and interpreters ignore blank lines.

b)

statement typically causes the variable to be created in memory.

c)
  • The variable’s data type

d)
  • The variable’s name

92.

Does it matter where you write the variable declarations in a program?

a)

Yes

b)

No

93.

What is variable initialization?

a)

When you declare a variable, you can optionally assign a value to it in the declaration statement

b)

use a blank line to separate a group of variable declaration statements from the rest of the statements in a program.

c)

simply the type of data that the variable will hold.

d)

statement that typically specifies the variable’s name, the variable’s data type

94.

What is an uninitialized variable?

a)

Integer, Real, and String.

b)

can cause logic errors that are hard to find in a program.

c)

a statement that typically specifies the variable’s name, the variable’s data type

d)

variable that has been declared, but has not been initialized or assigned a value.

95.

Do uninitialized variables pose any danger in a program?

a)

can cause logic errors that are hard to find in a program.

b)

statement that typically specifies the variable’s name, the variable’s data type

c)

common cause of logic errors in programs

d)

unpredictable values such as this as “garbage.”

96.

What is external documentation?

a)

appears as comments in a program’s code

b)

designed for the user

97.

What is internal documentation?

a)

appears as comments in a program’s code.

b)

typically designed for the user.

98.

What are the two general types of comments that programmers write in a program’s code?

a)

External documentation is typically designed for the user.

b)

Internal documentation appears as comments in a program’s code.

c)

Block comments take up several lines and are used when lengthy explanations are required.

99.

Computers can do many different jobs because they are ________.

a)

reliable

b)

electronic

c)

automated

d)

programmable

100.

A computer program is ________.

a)

a set of instructions that allow the computer to solve a problem or perform a task

b)

the same as main memory

c)

another name for an operating system

d)

only used for desktop computers

101.

________ is an extensive encoding scheme that is compatible with ASCII.

a)

Floating-point notation

b)

Unicode

c)

RAM

d)

Assembly language

102.

A syntax error does not prevent a program from being compiled and executed.

a)

True

b)

False

103.

A(n) ________ is a software package that usually consists of a text editor, a compiler or interpreter, and tools to test and debug programs.

a)

CPU

b)

IDE

c)

storage device

d)

compiler

104.

The instruction set for a microprocessor is unique and is typically understood only by the microprocessors of the same brand.

a)

True

b)

False

105.

The computer language that uses mnemonics for writing programs is ________.

a)

Pascal

b)

Assembly

c)

Ada

d)

Java

106.

The term software refers to all the physical devices, or components, that a computer is made of.

a)

True

b)

False

107.

Each different type of CPU has its own ________.

a)

syntax

b)

machine language

c)

high-level language

d)

software

108.

________ is the term used for a set of rules that must be strictly followed when writing a program.

a)

Grammar

b)

Semantics

c)

Key words

d)

Key words

109.

What is the largest value that can be stored in one byte?

a)

8

b)

128

c)

255

d)

16

110.

The ________ cycle is used by the CPU to execute instructions in a program.

a)

execute - fetch - decode

b)

decode - fetch - execute

c)

decode - execute - fetch

d)

fetch - decode - execute

111.

In a flowchart the symbol that represents an assignment statement is an oval.

a)

True

b)

False

112.

What symbol is used to mark the beginning and end of a string?

a)

a slash ( / )

b)

an asterisk ( * )

c)

a semicolon ( ; )

d)

a quote mark ( " )

113.

An uninitialized variable is a variable that has been declared and automatically initialized to zero.

a)

True

b)

False

114.

Which of the following is not a variable data type?

a)

String

b)

Integer

c)

Numeral

d)

Real

115.

A(n) ________ is a name that represents a value which cannot be changed during the program's execution.

a)

input variable

b)

uninitialized variable

c)

named constant

d)

named variable

116.

What is the error in the following pseudocode?

Declare Integer widgets

Declare Real cost

Set widgets = 3.5

Set cost = widgets * 5

a)

There is no error.

b)

widgets has been declared as an Integer and cannot hold a floating-point value.

c)

widgets is an invalid variable name for this code.

d)

You cannot mix a Real variable and an Integer variable in a program.

117.

What term is used for a string that appears in the actual code of a program?

a)

Str

b)

string literal

c)

any of these

d)

virtual string

118.

A(n) ________ is a diagram that graphically depicts the steps that take place in a program.

a)

algorithm

b)

code list

c)

pseudocode document

d)

flowchart

119.

A variable is a storage location in memory that is represented by a name and can hold different values during the execution of the program.

a)

True

b)

False

120.

What is the first step of the program development cycle?

a)

test executable code

b)

write the code

c)

design the program

d)

correct syntax errors

121.

________ is the informal language used by programmers to create models of programs.

a)

Source code

b)

Flowcharting

c)

Pseudocode

d)

Algorithm

122.

What is the value of the variable result in the following expression?

Set result = ( 6 + 8 ) / 4 * 2

a)

10

b)

7

c)

28

d)

22

123.

What is the value of the following expression?

12 - 4 * 3 / 2 + 9

a)

21

b)

2.18

c)

15

d)

-6

124.
What is a module?
a)

large task is divided into several smaller tasks that are easily performed.

b)

group of statements that exist for the purpose of performing a specific task within a program.

c)

If a specific operation is performed in several places in a program, a module can be written once to perform that operation, and then be executed any time it is needed.

125.

What is meant by the phrase “divide and conquer” for a module?

a)

a large task is divided into several smaller tasks that are easily performed.

b)

writing the code to perform a task once and then reusing it each time you need to perform the task.

c)

unmodularized program tends to be simpler, smaller, and easier to understand.

126.

How do modules help you reuse code in a program?

a)

you are writing the code to perform a task once and then reusing it each time you need to perform the task.

b)

group of statements that exist for the purpose of performing a specific task within a program.

c)

is a set of instructions that a computer follows to perform a task.

d)

group of statements that exist within a program for the purpose of performing a specific task

127.

How can modules make the development of multiple programs faster?

a)

is a group of statements that exist for the purpose of performing a specific task within a program.

b)

is a group of statements that exist within a program for the purpose of performing a specific task.

c)

is a set of instructions that a computer follows to perform a task.

d)

modules can be written for the commonly needed tasks, and those modules can be incorporated into each program that needs them

128.

How can modules make it easier for programs to be developed by teams of programmers?

a)

modules can be written for the commonly needed tasks, and those modules can be incorporated into each program that needs them.

b)

When a program is developed as a set of modules that each perform an individual task, then different programmers can be assigned the job of writing different module

c)

A modularized program is easier to maintain than an unmodularized program because its code tends to be simpler, smaller, and easier to understand.

d)

Programmers can test each module in a program individually, to determine whether it correctly performs its operation.

129.

Describe the steps involved in the top-down design process

a)

a header

b)

a body

c)

a footer

d)

a terminator

130.

What is a local variable? How is access to a local variable restricted?

a)

An error will occur if a statement in one module tries to access a local variable that belongs to another module.

b)

local variables with the same names cannot see each other’s local variables

c)

a variable that is declared inside a module

d)

Different modules can have local variables with the same names because the modules cannot see each other’s local variables.

131.

What is a variable’s scope?

a)

the part of a program in which a variable may be accessed.

b)

A variable is visible only to statements inside the variable’s__

c)

usually begins at the variable’s declaration and ends at the end of the module in which the variable is declared

132.

Is it usually permissible to have more than one variable with the same name in the same scope? Why or why not?

a)

Yes, because the compiler or interpreter will know which variable to use when a statement tries to access one of them.

b)

No, because the compiler or interpreter would not know which variable to use when a statement tries to access one of them.

c)

Yes, because all variables that exist within the same scope must have the same name.

d)

No, because all variables that exist within the same scope must have unique names.

133.

Is it usually permissible for a local variable in one module to have the same name as a local variable in a different module?

a)

Yes

b)

No

134.

What are the pieces of data that are passed into a module called?

a)

An argument

b)

An integer number

c)

An integer parameter

d)

An actual language

135.

What are the variables that receive pieces of data in a module called?

a)

parameter variable

b)

argument

c)

refactoring

d)

parameter

136.

Does it usually matter whether an argument’s data type differs from the data type of the parameter it is being passed to?

a)

Yes,

most programming languages require that the argument and the receiving parameter variable be of the same data type.

b)

No,

it will not cause an error

137.

Typically, what is a parameter variable’s scope?

a)

is visible only to statements inside the variable’s scope.

b)

is any piece of data that is passed into a module when the module is called.

c)

is usually the entire module in which the parameter is declared.

d)

is a way that one module can communicate with another module.

138.

Explain the difference between passing by value and passing by reference.

a)

Passing an argument by value means that only a copy of the argument’s value is passed into the parameter variable.

b)

Passing an argument by reference means that the argument is passed into a special type of parameter known as a reference variable.

139.

What is the scope of a global variable?

a)

is a named constant that is available to every module in the program.

b)

All of the modules that are defined in the program have access to the variable.

c)

is the entire program, so all of the modules in the program can access a global variable.

140.

What are the reasons for not using global variables in a program?

a)

Global variables make debugging difficult.

b)

Modules that use global variables are usually dependent on those variables.

c)

Global variables make a program hard to understand. A global variable can be modified by any statement in the program.

d)

Global varuables make coding easier

141.

What is a global constant? Is it permissible to use global constants in a program?

a)

a global constant’s value cannot be changed during the program’s execution.

b)

you do not have to worry about many of the potential hazards that are associated with the use of global variables.

c)

is a named constant that is available to every module in the program.

d)

Global constants are typically used to represent unchanging values that are needed throughout a program

142.

To execute a module, you must ________.

a)

call it

b)

compile it

c)

parse it

d)

debug it

143.

An argument that is passed by ________ is not affected by a change to the content of the parameter variable.

a)

a global variable

b)

value

c)

reference

d)

a local variable

144.

The scope of the parameter variables is the entire program and they are visible to any statement in the program.

a)

True

b)

False

145.

When a variable is passed by reference to a module, changes to the value of the argument in the module will also affect the variable in the part of the program that sent that argument.

a)

True

b)

False

146.

Given the following pseudocode, what, if anything, is an error?

Module main ()

Declare Integer myGrade = 93

Call curveScore (myGrade)

End Module

Module courveScore (Integer score)

Declare Integer newScore

Set new score = score + 5

Display new score

Set myGrade = 0

End Module

a)

The variable myGrade is not available inside the curveScore module.

b)

The variable score has not been initialized.

c)

There are no errors.

d)

The curveScore module should receive a variable named score, not myGrade.

147.

The ________ is the first line of a module definition.

a)

body

b)

header

c)

call

d)

introduction

148.

The use of ________ variables may make programs hard to understand and debug.

a)

local

b)

reference

c)

value

d)

global

149.

Modules make it impossible for programmers to work in teams.

a)

True

b)

False

150.

In most languages, a module definition has three parts: a header, body, and footer.

a)

True

b)

False

151.

When a variable is passed by value, changes to that argument made within the module also affect the value of the variable in the part of the program that made the call to that module.

a)

True

b)

False

152.

Modules may also be called ________.

a)

Subroutines

b)

Procedures

c)

Methods

d)

Subprograms

e)

any if these

153.

To create a module, you write its ________.

a)

Definition

b)

Head Seaction

c)

Name

d)

Pseudocode

154.

The following statement will evaluate to True:

( 5 > 6 ) OR ( 12 < 14 )

a)

True

b)

False

155.

In a flowchart, the ________ symbol indicates that some condition must be tested.

a)

Diamond

b)

Oval

c)

Rectangle

d)

Parallelogram

156.

Which two logical operators perform short-circuit evaluation?

a)

All perform short-circuit evaluation

b)

OR and NOT

c)

AND and OR

d)

AND and NOT

157.

What would be displayed if the following pseudocode was coded and executed?

Declare String pet1 = "puppy"

Declare String pet2 = "kitten"

If pet1 == pet2 Then

Display "These animals are the same."

Else

Display "These animals are different."

End If

a)

These animals are the same.

b)

puppy

kitten

These animals are different.

c)

These animals are the same.These animals are different.

d)

These animals are different.

158.

The ________ operator is a unary operator, which means it works with only one operand.

a)

OR

b)

AND

c)

NOT

d)

All are u

159.

What would display if the following pseudocode was coded and run, given that rate = 8?

Select rate

Case 10:

Display "A"

Case 9:

Case 8:

Display "B"

Case 7:

Case 6:

Display "C"

Default:

Display "Rating not possible."

End Select

a)

A

b)

B

c)

Rating not possible

d)

C

160.

An If-Then-Else statement must be used to write a single alternative decision structure.

a)

True

b)

False

161.

A nested decision structure can be used to test more than one condition.

a)

True

b)

False

162.

Decision structures and selection structures are completely different.

a)

True

b)

False

163.

Given the following pseudocode, what would display if this pseudocode was coded and executed, given that examGrade = 93 and homeworkGrade = 87?

Is exam grade <= 90 AND homeworkGrade >= 90 Then

Display "You are doing very well!"

Else If examGrade < 90 AND homeworkGrade >= 90 Then

Display "Study harder for the next exam."

Else If examGrade <= 90 AND homeworkGrade < 90 Then

Display "See me for help with homework."

Else

Display "Let's talk about your grades."

End If

a)

Let's talk about your grades.

b)

You are doing very well!

c)

Study harder for the next exam.

d)

See me for help with homework.

164.

What does the following expression evaluate to, given that a = 3 and b = 6?

(a != b) AND (b > a)

a)

False

b)

True

c)

cannot tell

d)

NOT

165.

What type of operator determines whether a specific relationship exists between two values?

a)

Logical

b)

Relational

c)

Boolean

d)

Mathematical

166.

The OR operator will evaluate to True only if both subexpressions are also True.

a)

True

b)

False

167.
  1. What is a control structure?

a)

a flowchart showing human actions, not program statements.

b)

a set of statements that execute in the order that they appear.

c)

a logical design that controls the order in which a set of statements executes.

168.
  1. What is a decision structure?

a)

allows a program to perform actions only under certain conditions.

b)

a Boolean expression

c)

a flowchart showing human actions, not program statements

d)

a sequence structure because the statements in it execute in the order that they appear, from the beginning of the module to the end