Ch. 1-1 to 4-1 Flashcards
Computer software, C language elements, arithmetic expressions, formatting, functions, basic file processing
What instructions do tasks IF a condition is true?
Conditional instructions
What instructions do tasks WHILE a condition is true?
Iterative instructions
What does a compiler do?
Translates the source file, checks to make sure that the program is syntactically correct, and if so, translates the program into an object file with machine language instructions
What does a linker program do?
Performs the operation of linking the object file that is translated by the compiler to other object files containing functions (the predefined pieces of code)
What does a loader program do?
Loads the linked program into memory so that it can be executed.
What is the first step in the “Scientific Method” (sciences)/”Systems Approach” (business)?
Specify the problem requirements
What is the second step in the “Scientific Method” (sciences)/”Systems Approach” (business)?
Analyze the problem
What is the third step in the “Scientific Method” (sciences)/”Systems Approach” (business)?
Design an algorithm to solve the problem
What is the fourth step in the “Scientific Method” (sciences)/”Systems Approach” (business)?
Implement the algorithm
What is the fifth step in the “Scientific Method” (sciences)/”Systems Approach” (business)?
Test and verify the completed program
What is the sixth and final step in the “Scientific Method” (sciences)/”Systems Approach” (business)?
Maintain and update the program
What does a reserved word look like?
int
What does a preprocessor directive look like?
define PI 3.14159 /* Constant macro */
What does a variable declaration look like?
int height = 0, radius = 0;
What is a data type?
A set of values + set of operations on those values
How would you write scientific notation for double values in C? 15.0 * 10^-3
15.0e-3
When defining char variables in a program, use…
Single quotes
How do you format an arithmetic expression?
operand1 operator operand2
Which operators consist of only one operand?
Unary operators
Which operators require two operands?
Binary operators
What is top-down design?
It allows us to manage the complexity of a problem by decomposing it into smaller, less complex subproblems; a divide and conquer approach
As part of an anatomy function prototype: void display_gpa(double gpa); – what is “void”?
Return value
As part of an anatomy function prototype: void display_gpa(double gpa); – what is “display_gpa”?
Function name
As part of an anatomy function prototype: void display_gpa(double gpa); – what is “(double gpa)”?
Function argument list; should be “void” if function has no arguments
When are memory for local variables allocated?
When a function is called.
When are memory for local variables released?
Upon completion of function execution.
What should you include in a function comment?
Short description, preconditions (true conditions prior to execution), postconditions (true conditions after execution)
What is an actual argument?
The values that are called into the function.
What is a formal parameter?
A value, from a call, which is used to assign it to a variable within a function.
Where are the file functions located in C?
<stdio.h>
</stdio.h>
What command do you use to open a file?
fopen(), which also returns a file handle to the opened file
What command do you use to read from a file?
fscanf()
What command do you use to write to a file?
fprintf()
What command do you use to close a file?
fclose(), which also closes the file based on the file handle
What does “r” mode do?
Provide read permissions for a file.
What does “w” mode do?
Provide overwrite permissions for a file.
What does “a” mode do?
Provide append permissions for a file.
What does “r+” mode do?
Opens an existing file for update (reading and writing).
What does “w+” mode do?
Creates a file for update (if it already exists, discard the current contents.)
What does “a+” mode do?
Open or create a file for update; writing is done at the end of the file
How can we read/write/apparent binary data and information to a file?
Add a “b” to the mode. (For example: “rb”, “wb”, “ab”, “rb+”, “wb+”, “ab+”.)
What does the fwrite() function do?
Transfers a specified number of bytes beginning at a specified location in memory to a file.
What does the fread() function do?
Transfers a specified number of bytes from the location in the file specified by the file position pointer to an area in memory.
What does the fseek() function do?
Sets the file position pointer to a specific position in the file.