Chapter 2 Review (Test Prep)

Ace your homework & exams now with Quizwiz!

2.2 What is a software requirement?

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

3. Variable names can have spaces in them.

false (variables cannot have spaces)

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

1. Display a prompt on the screen. 2. Read a value from the keyboard.

2.7 What are the three operations that programs typically perform?

1. Input is received. 2. Some process is performed on the input. 3. Output is produced.

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

1. Perform any operations that are enclosed in parentheses. 2. Perform any operations that use the exponent operator to raise a number to a power. 3. Perform any multiplications, divisions, or modulus operations as they appear from left to right. 4. Perform any additions or subtractions as they appear from left to right.

2.13 Summarize three common rules for naming variables.

1. Variable names must be one word. They cannot contain spaces. 2. 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. 3. In most languages, the first character of a variable name cannot be a number.

2.9 What is a sequence structure?

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

2.32 What are the two general types of comments that programmers write in a program's code? Describe each.

Block Comments - take up several lines and are used when lengthy explanations are required. Often appears at the beginning of a program, explaining what the program does, listing the name of the author, giving the date that the program was last modified, and any other necessary information. Line Comments - comments that occupy a single line, and explain a short section of the program.

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

False (the assignment statement symbol on a flowchart is a rectangle)

(Review Questions T or F) 1. Programmers must be careful not to make syntax errors when writing pseudocode programs.

False (there are no syntax errors in pseudocode because the code is not meant to be compiled.)

2.8 What is an IPO chart?

IPO stands for input, processing, and output, and an IPO chart describes the input, processing, and output of a program.

2.6 What are each of the following symbols in a flowchart? Oval Parallelogram Rectangle

Oval - terminal symbols. The Start terminal symbol marks the program's starting point and the End terminal symbol marks the program's ending point. Parallelogram - used for both input symbols and output symbols Rectangle - processing symbols

Which of the following is not an actual programming language?

Pseudocode

2.10 What is a string? What is a string literal?

String - a sequence of characters that is used as data String Literal - When a string appears in the actual code of a program, or in pseudocode. In program code, or pseudocode, a string literal is usually enclosed in quotation marks.

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

The variable's name The variable's data type

2.24 What is the purpose of the modulus operator?

The ∧ symbol is commonly used as the exponent operator, and its purpose it to raise a number to a power. (Some languages use the % symbol for the same purpose.) The modulus operator performs division, but instead of returning the quotient, it returns the remainder.

(quiz) The structure of the camelCase naming convention is to write the first word of the variable name in lowercase letters and then to capitalize the first character of the second and subsequent words.

True

4. In most languages, the first character of a variable name cannot be a number.

True

6. In languages that require variable declarations, a variable's declaration must appear before any other statements that use the variable.

True

7. Uninitialized variables are a common cause of errors.

True

Variable names cannot include spaces.

True

2.28 Do uninitialized variables pose any danger in a program?

Uninitialized variables are a common cause of logic errors in programs.

2.5 What is a flowchart?

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

2.17 What is a prompt?

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

2.3 What is an algorithm?

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

2.12 What is a variable?

a storage location in memory that is represented by a name.

2.29 What is an uninitialized variable?

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

A(n) _______ is a set of well-defined logical steps that must be taken to perform a task.

algorithm

2. What is pseudocode?

an informal language that has no syntax rules, and is not meant to be compiled or executed.

2.4 What is pseudocode?

an informal language that has no syntax rules, and is not meant to be compiled or executed.

2.27 What is variable initialization?

assigning a value to a variable in the declaration statement.

The following is an example of a(n) ________ statement. set rate = 6.25

assignment

11. A(n) ________ sets a variable to a specified value.

assignment statement

20. Short notes placed in different parts of a program, explaining how those parts of the program work, are called _______.

comments

2.19 What does the term user-friendly mean?

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

2.30 What is external documentation?

describes aspects of the program for the user.

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

double quote marks (")

13. A(n) ________ operator raises a number to a power.

exponent

10. Internal documentation refers to books and manuals that document a program, and are intended for use within a company's programming department.

false (appears as comments in a program's code.)

5. The name gross_pay is written in the camelCase convention.

false (camelCase convention requires the first character should be lowercase and each subsequent word should begin with an uppercase character.)

9. Hand tracing is the process of translating a pseudocode program into machine language by hand.

false (debugging process where you imagine that you are the computer executing a program. (This process is also known as desk checking.)

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

flowchart

19. A debugging process in which you imagine that you are the computer executing a program is called ________.

hand tracing (This process is also known as desk checking.)

16. Assigning a value to a variable in a declaration statement is called __________ .

initialization

2.31 What is internal documentation?

is for the programmer, and explains how parts of the program work.

(Chapter Review Questions Multiple Choice) A ______ error does not prevent the program from running, but causes it to produce incorrect results.

logic

Which of the following error types produces incorrect results but does not prevent the program from running?

logic

14. A(n) ________ operator performs division, but instead of returning the quotient it returns the remainder.

modulus

18. A(n) _______ is a variable whose content has a value that is read only and cannot be changed during the program's execution.

named constant

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

named constant

6. What value is stored in uninitialized variables?

no value has been assigned which is why the variable is considered to be initialized.

12. In the expression 12 + 7, the values on the right and left of the + symbol are called ______.

operands

10. A(n) _________ is a message that tells (or asks) the user to enter a specific value.

prompt

An informal language that has no syntax rules, and is not meant to be compiled or executed is called ______.

pseudocode

6. A(n) _______ is a set of statements that execute in the order that they appear.

sequence structure

2.20 What is an assignment statement?

sets a variable to a specified value.

A _______ is a single function that the program must perform in order to satisfy the customer.

software requirement

7. A _________ is a sequence of characters that is used as data.

string

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

the new value replaces the old value previously stored.

2.16 Who is the user?

the person using the program.

(Checkpionts Questions) 2.1 Who is a programmer's customer?

the person, group, or organization that is asking you to write a program.

2. In a math expression, multiplication and division take place before addition and subtraction.

true

8. The value of a named constant cannot be changed during the program's execution.

true

17. A(n) __________ variable is one that has been declared, but has not been initialized or assigned a value.

uninitialized

9. A _______ is any hypothetical person that is using a program and providing input for it.

user

What is the error in the following pseudocode? Display "What is your name?" Input userName Declare String userName

userName has been used before it is declared.

8. A ______ is a storage location in memory that is represented by a name.

variable

15. A(n) _________ specifies a variable's name and data type.

variable declaration

(Chapter Review Short Answer) 1. What does a professional programmer usually do first to gain an understanding of a problem?

working directly with the customer to understand what a program is supposed to do before you can determine the steps that the program will perform.

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

you have to write a variable's declaration statement before any other statements in the program that use the variable.


Related study sets

Real Estate GA state practice exam

View Set

NorthWestern Mutual Life Insurance Test

View Set

Chapter 27 26, 25 Bleeding,24 Trauma 12 1 13 14 Airway Management - 10, 6, 5

View Set

Biology Chapter 3: Chemical Building Blocks of Life

View Set

9 клас карпюк Magic Box

View Set

Chapter 11-Domestic and International Sales

View Set

Health and Life Licensing: Chapter 1

View Set