Chapter 2 Flashcards

1
Q

What is a variable?

A

Named memory locations whose contents can vary or differ over time.

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

What is a declaration in programming?

A

A statement that provides a data type and an identifier for a variable.

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

What is an identifier in programming?

A

A variable’s name.

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

Define a named constant.

A

Similar to a variable but can be assigned a value only once.

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

What are the standard arithmetic operators?

A
  • Addition (+), * Subtraction (-), * Multiplication (*), * Division (/)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is type-safety?

A

Prevents assigning values of an incorrect data type.

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

What does a hierarchy chart represent?

A

Shows the overall picture of how modules are related to one another.

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

What is modularization?

A

Breaking down a large program into modules.

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

What is the purpose of program comments?

A

Written explanations of programming statements, not part of the program logic.

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

What is the role of temporary variables?

A

Work variables used during a program’s execution to hold intermediate results.

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

What does the term ‘magic number’ refer to?

A

An unnamed constant.

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

What are the advantages of modularization?

A
  • Easier task division among programmers, * Reusability of modules, * Reliability of tested modules.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Fill in the blank: A prompt is a message displayed on a monitor to ask the user for a _______.

A

response.

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

True or False: Global variables are declared at the program level.

A

True.

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

What does the assignment operator do?

A

Sets a variable to a value.

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

What is garbage in programming?

A

A variable’s unknown value.

17
Q

What is the purpose of using clear prompts in a program?

A

To ask the user for input clearly.

18
Q

What is the difference between global and local variables?

A

Global variables are usable in all modules, while local variables are usable only within the module.

19
Q

What is the significance of using meaningful names for variables?

A

They are self-documenting and make the code easier to read.

20
Q

What is the role of flowcharts in programming?

A

Visual representation of the program’s logic and structure.

21
Q

Fill in the blank: A hierarchy chart is a _______ tool that helps in planning the overall relationship of program modules.

22
Q

What is the order of operations also known as?

A

Rules of precedence.

23
Q

What is a remainder operator?

A

Also called the modulo operator, it provides the remainder of a division operation.

24
Q

What should be avoided when naming variables?

A
  • Using digits, * Reserved keywords, * Abbreviations.
25
True or False: The contents of a variable cannot change during program execution.
False.
26
What is encapsulation in programming?
Taking statements out of a main program and putting them into a module.
27
What is a work variable?
A temporary variable used during a program's execution.
28
What does it mean for a variable name to be case sensitive?
Variable names can be distinguished based on uppercase and lowercase letters.
29
What does modularization allow in terms of team programming?
Easier division of tasks among multiple programmers.