Programming Logic and Design - CH 2
Questions and Answers
A string literal is usually enclosed inside a set of what characters? - ANSWER-
Quotation marks
What is a variable? - ANSWER-A storage location in memory that is represented by
a name.
Summarize three common rules for naming variables. - ANSWER-• Variable names
must be one word. They cannot contain spaces.
• 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.
• In most languages, the first character of a variable name cannot be a number.
What variable naming convention do we follow in this book? - ANSWER-camelCase
Look at the following pseudocode statement:
Input temperature
What happens when this statement executes? - ANSWER-• The program pauses
and waits for the user to type something on the keyboard, and
then press theekey.
• When the ekey is pressed, the data that was typed is stored in the temperature
variable.
Who is the user? - ANSWER-Any hypothetical person that is using a program and
providing input for it.
What is a prompt? - ANSWER-A message that tells (or asks) the user to enter a
specific value.
What two steps usually take place when a program prompts the user for input? -
ANSWER-1. Display a prompt on the screen.
2. Read a value from the keyboard.
What does the term user-friendly mean? - ANSWER-The term user-friendly is
commonly used in the software business to describe programs
that are easy to use.
What is an assignment statement? - ANSWER-A statement that sets a variable to a
specified value.
When you assign a value to a variable, what happens to any value that is
already stored in the variable? - ANSWER-It is replaced.
Summarize the mathematical order of operations, as it works in most
Questions and Answers
A string literal is usually enclosed inside a set of what characters? - ANSWER-
Quotation marks
What is a variable? - ANSWER-A storage location in memory that is represented by
a name.
Summarize three common rules for naming variables. - ANSWER-• Variable names
must be one word. They cannot contain spaces.
• 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.
• In most languages, the first character of a variable name cannot be a number.
What variable naming convention do we follow in this book? - ANSWER-camelCase
Look at the following pseudocode statement:
Input temperature
What happens when this statement executes? - ANSWER-• The program pauses
and waits for the user to type something on the keyboard, and
then press theekey.
• When the ekey is pressed, the data that was typed is stored in the temperature
variable.
Who is the user? - ANSWER-Any hypothetical person that is using a program and
providing input for it.
What is a prompt? - ANSWER-A message that tells (or asks) the user to enter a
specific value.
What two steps usually take place when a program prompts the user for input? -
ANSWER-1. Display a prompt on the screen.
2. Read a value from the keyboard.
What does the term user-friendly mean? - ANSWER-The term user-friendly is
commonly used in the software business to describe programs
that are easy to use.
What is an assignment statement? - ANSWER-A statement that sets a variable to a
specified value.
When you assign a value to a variable, what happens to any value that is
already stored in the variable? - ANSWER-It is replaced.
Summarize the mathematical order of operations, as it works in most