Ch. 1-1 to 4-1 Flashcards

Computer software, C language elements, arithmetic expressions, formatting, functions, basic file processing

1
Q

What instructions do tasks IF a condition is true?

A

Conditional instructions

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

What instructions do tasks WHILE a condition is true?

A

Iterative instructions

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

What does a compiler do?

A

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

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

What does a linker program do?

A

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)

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

What does a loader program do?

A

Loads the linked program into memory so that it can be executed.

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

What is the first step in the “Scientific Method” (sciences)/”Systems Approach” (business)?

A

Specify the problem requirements

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

What is the second step in the “Scientific Method” (sciences)/”Systems Approach” (business)?

A

Analyze the problem

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

What is the third step in the “Scientific Method” (sciences)/”Systems Approach” (business)?

A

Design an algorithm to solve the problem

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

What is the fourth step in the “Scientific Method” (sciences)/”Systems Approach” (business)?

A

Implement the algorithm

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

What is the fifth step in the “Scientific Method” (sciences)/”Systems Approach” (business)?

A

Test and verify the completed program

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

What is the sixth and final step in the “Scientific Method” (sciences)/”Systems Approach” (business)?

A

Maintain and update the program

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

What does a reserved word look like?

A

int

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

What does a preprocessor directive look like?

A

define PI 3.14159 /* Constant macro */

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

What does a variable declaration look like?

A

int height = 0, radius = 0;

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

What is a data type?

A

A set of values + set of operations on those values

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

How would you write scientific notation for double values in C? 15.0 * 10^-3

A

15.0e-3

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

When defining char variables in a program, use…

A

Single quotes

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

How do you format an arithmetic expression?

A

operand1 operator operand2

18
Q

Which operators consist of only one operand?

A

Unary operators

19
Q

Which operators require two operands?

A

Binary operators

20
Q

What is top-down design?

A

It allows us to manage the complexity of a problem by decomposing it into smaller, less complex subproblems; a divide and conquer approach

21
Q

As part of an anatomy function prototype: void display_gpa(double gpa); – what is “void”?

A

Return value

22
Q

As part of an anatomy function prototype: void display_gpa(double gpa); – what is “display_gpa”?

A

Function name

23
Q

As part of an anatomy function prototype: void display_gpa(double gpa); – what is “(double gpa)”?

A

Function argument list; should be “void” if function has no arguments

24
Q

When are memory for local variables allocated?

A

When a function is called.

25
Q

When are memory for local variables released?

A

Upon completion of function execution.

26
Q

What should you include in a function comment?

A

Short description, preconditions (true conditions prior to execution), postconditions (true conditions after execution)

27
Q

What is an actual argument?

A

The values that are called into the function.

28
Q

What is a formal parameter?

A

A value, from a call, which is used to assign it to a variable within a function.

29
Q

Where are the file functions located in C?

A

<stdio.h>
</stdio.h>

30
Q

What command do you use to open a file?

A

fopen(), which also returns a file handle to the opened file

31
Q

What command do you use to read from a file?

A

fscanf()

32
Q

What command do you use to write to a file?

A

fprintf()

33
Q

What command do you use to close a file?

A

fclose(), which also closes the file based on the file handle

34
Q

What does “r” mode do?

A

Provide read permissions for a file.

35
Q

What does “w” mode do?

A

Provide overwrite permissions for a file.

35
Q

What does “a” mode do?

A

Provide append permissions for a file.

36
Q

What does “r+” mode do?

A

Opens an existing file for update (reading and writing).

37
Q

What does “w+” mode do?

A

Creates a file for update (if it already exists, discard the current contents.)

38
Q

What does “a+” mode do?

A

Open or create a file for update; writing is done at the end of the file

39
Q

How can we read/write/apparent binary data and information to a file?

A

Add a “b” to the mode. (For example: “rb”, “wb”, “ab”, “rb+”, “wb+”, “ab+”.)

40
Q

What does the fwrite() function do?

A

Transfers a specified number of bytes beginning at a specified location in memory to a file.

41
Q

What does the fread() function do?

A

Transfers a specified number of bytes from the location in the file specified by the file position pointer to an area in memory.

42
Q

What does the fseek() function do?

A

Sets the file position pointer to a specific position in the file.