C++ Ch1-2 Flashcards

main memory
Terms Definitions
what are the two components of the cpu?
the control unit and the arithmatic logic unit
What is the purpose of the control unit?
to use computer operations
What is teh fetch/decode/execute cycle?
cpu process
Define fetch in the process?
CPU fetches from main memory, the next instruction in the the sequence of program instructions
Define decode in the process of fetch, decode, execute?
instruction is encoded into a number, control unit decodes it and generates an electronic signal
Define execute in the process of fetch, decode, execute?
signal is routed to appropriate component of the computer (any device) causes component to perform operation
What is the main memory?
What is secondary memory?
any long term storage device
What are the five components of any computer system?
1)CPU 2)Input 3)output 4)Main memory 5)Secondary storage
Define algorithm?
set of well defined steps for performing a task or solving a problem
Define portability?
C++ program can be written on one type and run on another with litle modification
Define source code?
statments written by programmer
Define run time library?
set of code in C++ used for mathematic functions
What is the purpose of the preprocessor?
It finds lines with #, allows it to modify the source code
What is the purpose of the compiler?
translates source code to machine language and looks for syntax errors
What is the purpose of the linker?
links the program to the run time library and makes the code executable
Define integrated development environment?
includes text editor, compiler, debugger, and other utilities
define keywords?
specific meaning, can only be used for that purpose, always written in lower case
define operators?
perofrm operations on one or more operands, i.e. a piece of data
define syntax?
the rules of a computer system
the use of the = sign can be called what?
an assignment operator
define variable?
named storage location in computer's memory for holding a piece of information
Where are variables stored?
what is the difference between variable definition and variable declaration?
defintion always cause a variable to be placed in memory, declartions do not always have to
What are the 3 primary activities of a program?
Input, process, output
what is a logical error?
mistakes that cuase a program to produce erroneous results
define desk checking?
programmer reads part of the program and steps through each statment
what is the purpose of procedural programming?
make a program that prodcues a specific task
what is the function of // ?
beginning of a comment, ignored by computer, runs to end of line
define a preprocessor directive?
i.e. #, preprocessor reads program, looks for #, and only executes those lines, 'set up' to compiler
what is the purpose of the iostream?
a files that allows C++ to display out on screen and read from keyboard
what is the purpose of the namespace std?
declares that program will be accessing entries whose names are part of the namespace called std, must be set with entities in the iostream
what is the purpose of int main ()?
this is the beginnig of a function, starting point of the program
what is a string literal or string constant?
the characters inside quotation marks
what is the purpose of return 0; ?
sends the interger value 0 back to OS upon completion, 0 usually indicates success
purpose of the #?
marks beginning of preprocessor directive
purpose of <,>?
encloses a filename, used with # include directive
purpose of (,)?
used in naming function, i.e. int main ()
purpose of {,}?
enclsoes a group of statments
what is a variable definition and give an example?
int number, assigning a definition to a variable
what is the difference between a string literal and an integer literal?
quotes vs. =
what are the 2 rules for legal identifiers (1 of 2)?
1) first character underscore or a-z or A-Z,
what are the 2 rules for legal identifiers (2 of 2)?
2) after first character, a-z, A-Z, underscore 0-9
what is the purpose of an unsigned data type?
only to store non-negative numbers
how can you define two variables (i.e. x and y) in one line?
int x, y;
how do you force an integer literal to be stored as a long integer, i.e 32?
what does ASCII stand for?
american standard code for information
what data type is char?
essentially its an integer data type
how do you define a char literal, i.e. x?
char letter; letter= 'x';
How is a string (i.e. ghost) stored?
it is stored consecutively in memory, ghost\0 = 6 bytes
what is a c-string?
a string of characters stored in memory with null terminator of the number 0
what is a floating point number?
any real number i.e. fractional
define the mantissa?
the actual number in scientific notation, 4.6e10-> the mantissa is 4.6
define float (single precision)?
+/- 3.4E-38 to 3.4E+38
define double (double precision)?
+/- 1.7E-308 to positive E-308
Define long double precision (long double)?
1.7E-308 to positive but in some computers +/-3.4E-4932 to +/-1.1E4832
is there such thing as an unsigned floating point data type?
No, because float, double and long double store negative numbers also
how are floating point literals stored in memory?
stored as doubles
How do you force a literal to be stored as float?
Add F or f to the end
How do you force a literal to be stored as a long double?
Add L, l
What happens when you assign a floating point to an integer variable such as int i; float f; f=7.5; i=f?
i=7, it is truncated and not rounded
What happens if a floating point is stored as an integer and the floating point is too large?
an invalid value will be stored
What is a boolean variable?
set to either true or false
define initialization, give an example?
declaring a variable and assigning it at the same time; i.e. int month; int days; month=2, days=30 OR int month=2, days=30
define scope?
part of the program where the variable may be used, you can't expect to use the variable before you define it
what happens when you divide 2 integers, i.e. 17/3?
the remainder is discarded
how would you divide 2 integers (17/3) and show remainder?
make 17 floating point 17.0
how do you open and close multi line comments?
/ 68

Leave a Comment ({[ getComments().length ]})

Comments ({[ getComments().length ]})


{[ comment.comment ]}

View All {[ getComments().length ]} Comments
Ask a homework question - tutors are online