Chapter 2 Flashcards

1
Q

What do data types describe

A
  1. what values can be held by the item
  2. how the item is stored in memory
  3. what operations can be performed on the item
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what are two data types that are supported by all programming languages

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

what are the two types of constants

A
  1. numeric constant (numbers that don’t change)
  2. string constant (alphanumeric values) - contain numbers and characters and enclosed in question marks
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

declaration

A

a statement that provides a variable’s data type, identifier (variables name) and maybe and initial value

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

string variables can hold text, letters, and

A

special characters (punctuation etc)

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

type - safety prevents

A

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 are the rules for creating identifier’s (variable names)

A
  1. reserved keywords are not allowed
  2. must be one word
  3. must start with a letter
  4. should have appropriate meaning
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Camel casing

A

variable names have a “hump” in the middle (hourlyWage)

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

pascal casing

A

variable names have the first letter in each word uppercase (HourlyWage)

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

Hungarian notation

A

form of camel casing in which the data type is part of the name (numhourlyWage)

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

snake casing

A

parts of variable names are separated by underscores (hourly_wage)

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

mixed case with underscores

A

all letters uppercase with underscores in between each letter (Hourly_Wage)

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

kebob case

A

parts of variable names are separated by dashes (hourly-wage)

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

assignment statement

A

statement that assigns variable to number (set myAnswer = myNumber * 2)

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

assignment operator (equal sign)

A
  1. binary operator - it requires two operands, one on each side
  2. right associativity - operates from right to left
  3. lvalue - result to the left of assignment operator
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

initializing a variable

A

giving the variable a start value

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

garbage

A

a variable’s unknown value

18
Q

named constant

A

similar to a variable that’s assigned a value once

19
Q

magic number

A

unnamed constant

20
Q

rules of precedence

A

order of operations

21
Q

remainder operator (modulo operator or modulus operator)

A

contains the remainder of a division operation

22
Q

modules

A

subunit of programming problem

23
Q

call a module

A

use its name to invoke the module, causing it to execute

24
Q

modularization (functional decomposition)

A

breaking down large program into modules

25
Q

abstraction

A

paying attention to the important stuff and ignoring not important stuff

26
Q

why is modularization popular

A
  1. easier to divide the task among various people
  2. its faster to write the program
  3. reusable (allows other modules to be used in other applications)
  4. reliable (ensures every module has been tested)
27
Q

Modularizing a program

A
  1. main program or mainline logic (basic steps of program)
  2. name module (similar to naming variable)(module names are followed by set of parentheses)
28
Q

what to include in a module

A

module header, body, and return statement

29
Q

when a main program wants to use a module it

A

“calls” the modules name

30
Q

symbol used to call a module (flowchart)

A

rectangle with bar across the top

31
Q

encapsulated

A

statements taken out of a main program and put into a module

32
Q

global variables and constants are declared at which level

A

the program level (visible and usable in all modules called by the program)

33
Q

mainline logic for every program is

A
  1. declare global variables and constants
  2. housekeeping tasks (steps performed at beginning of program to get ready for rest of program)
  3. detail loop tasks (core work of program)
  4. end of job tasks (steps you take to finish the application)
34
Q

hierarchy chart

A

shows overall pic of how modules are related to another (shows which modules exist in a program and which modules call others)

35
Q

programming comments

A

explantation of program that isn’t apart of program code

36
Q

flowchart symbol for comments

A

annotation symbol

37
Q

self-documenting

A

using meaningful names

38
Q

data dictionary

A

list of variables

39
Q

temporary variable (work variable)

A

1.not used for input/output
2. working variable used during a program’s execution

40
Q

prompt

A

message displayed on monitor to ask user for a response

41
Q

echoing input

A

repeating input back to a user in a subsequent prompt/input