Chapter 2 Primary Data Types Flashcards
What is RAM and what is it composed of?
Random Access Memory is a computer’s short-term memory or volatile memory. It is composed of fixed-size cells, with each cell number referenced through an address.
What are common variable characteristics?
Name: Variable name used to reference data in program code
Type: Number, character, etc.
Value: Data value assigned to variable’s memory location
Address: Assigned to variable, which points to a memory cell location
What are two actions needed to create variables?
Declare (int x;) and initialize (x = 0;)
What is needed when assigning character data to character variables?
Character data must be enclosed in single quotes (‘), AKA tick marks or apostrophes.
What is the keyword for integer data types?
int
What is the keyword for character data types?
char
What is the keyword for floating-point number?
float
What is the difference between int, char, and float data types?
Integer data types consist of positive and negative whole numbers.
Character data types consist of ASCII character sets that represent integer values (e.g., character code 90 = Z)
Floating-point numbers consist of large and small, positive and negative decimal numbers (09.4543)
What is the ASCII?
American Standard Code for Information Interchange
What are conversion specifiers?
They tell the program how to display the variable and their corresponding data types.
What are common conversion specifiers?
%d = Displays signed integer value %f = Displays signed floating-point value %c = Displays single character value
What are constant data types?
Read-only variables that cannot lose their data values during program execution.
What are common rules for naming variables?
- Begin with lowercase letter
- No spaces
- Only letters, numbers, and underscores (_)
- Fewer than 31 characters (ANSI C standard)
What are best practice programming conventions and styles?
- Use of white space should be consistent
- Appropriate usage of upper and lower case letters
- Self-documenting variable names (data type prefix & purpose)
What does the scanf(0) function do?
Reads standard input from the keyboard and stores it in previously declared variables
What operator is required when using the scanf() function?
The address (pointer) operator “&”
What is the correct way to state the “=” operator?
It is an “assignment” operator rather than “equals”
What are some common unstructured numeric data types?
integers and floating-point numbers
What are some common unstructured non-numeric data types?
character and boolean
What are some common structured data types?
arrays, structures, classes, and files
What is the Negation operator in reference to logical operators?
The Negation operator is the “!” which is used on Boolean variables that causes the variable to flip its Boolean assignment.
If x = true, then !x = false
What are the 6 relational operators?
- Equality (==)
- Inequality (!=)
- Greater than (>)
- Greater than or equal to (>=)
- Less than (
What is the difference between = and ==?
= is the assignment operator when assigning values to variables.
== is the Boolean equality operator to verify if two operands are equal.