Chapter 2 Flashcards

1
Q

String and literal string

A

These pieces of data are sequences of characters. In programming terms, a sequence of characters that is used as data is called a string. When a string appears in the actual code of a program (or in pseudocode, as it does in Program 2-1) it is called a string literal. In program code, or pseudocode, a string literal is usually enclosed in quotation marks. As mentioned earlier, the quotation marks simply mark where the string begins and ends.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Variables

A

Programs use variables to store data in memory. A variable is a storage location in memory that is represented by a name.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Input statement

A

basic input operation: reading data that has been typed on the keyboard. When a program reads data from the keyboard, usually it stores that data in a variable so it can be used later by the program. In pseudocode we will read data from the keyboard with the Input statement.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Variables rules

A
  • 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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

CamelCase

A
  • You begin writing the variable name with lowercase letters.
  • The first character of the second and subsequent words is written in uppercase.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Sequence structure

A

A set of statements that execute
in the order that they appear is called a sequence structure. In fact, all of the programs that you will see in this chapter are sequence structures.
A structure, also called a control structure, is a logical design that controls the order in which a set of statements execute.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Prompt

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Assignment statement

A

An assignment statement sets a variable to a specified value. In this case, the variable price is set to the value 20.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Operators

A

Most real-world algorithms require calculations to be performed. A programmer’s tools for performing calculations are math operators.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Basic programming structure

A

In the 1960s, a group of mathematicians proved that only three program structures are needed to write any type of program. The simplest of these structures is the sequence structure. Later in this book, you will learn about the other two structures—decision structures and repetition structures.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly