Mod 3 Flashcards

1
Q

Describe unstructured programming.

A

The most elementary method in which any line of code may be executed if logic dictates that action.

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

Describe procedural programming.

A

Groups statements that perform a specific task together.

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

Describe object oriented programming.

A

Using the concept of objects and their interactions to design applications and computer programs

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

What defines an object?

A

Classes which defines an objects attributes grouped together with behaviors. Objects do not exist until the programmer creates them.

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

What are the 3 common techniques Object oriented programming is based on?

A

Encapsulation,
Inheritance,
Polymorphism

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

What is encapsulation?

A

Conceals the functional details of a class from the user that the user does not “need to know”.

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

What is inheritance?

A

Possesses characteristics and behaviors from the parent class while introducing it’s own.

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

What is polymorphism?

A

Allows you to treat derived class members just like their parents class but achieve a different result.

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

What is a programming language?

A

How people talk to computer hardware.

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

What is machine code?

A

1st generation of programming languages. Native code to the computers CPU.

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

What is assembly language?

A

Earliest programming language and closest to machine code. 2nd generation. Composed of commands called MNEMONICS.

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

How does a CPU understand assembly language?

A

Assembly language is converted to machine code in a process called assembling, performed by an assembler tool.

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

What are compiled languages?

A

3rd generation. Not CPU specific. Requires a compiler to convert to machine code to be interpreted by CPU.

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

What is a compiler for C++?

A

g++

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

What is interpreted /scripting language?

A

Delays the immediate assembling/compiling process and instead the code is translated each time the program is run. 3rd gen.

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

what is JIT (just in time) compilation?

A

Blurs the lines between compiler and interpreted languages. 3rd gen. The source code is compiled to an intermediate byte code the translated by a virtual machine into machine language at run-time.

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

What is porting?

A

The process of taking a program from one language or system architecture to another.

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

What are the three techniques used by computer programs?

A

Sequential action,
Branches,
Loops

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

What is program flow?

A

The process of how a program executes. Branching and looping are referred to as flow control statements.

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

What is a flow chart?

A

Graphical representation of a process that demonstrates the steps followed to arrive at a solution.

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

What flow chart action is represented by an oval?

A

Terminal. Start/end of the program.

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

What flow chart action is represented by a rectangle?

A

Process. Action to be executed.

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

What flow chart action is represented by a rhombus?

A

Input/output. Acquire data from user or display data to user.

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

What flow chart action is represented by a diamond?

A

Decision. Branch based on a Boolean decision.

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

What is pseudocode?

A

Using natural language to define code or flow charts.

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

What is required before any else or else if statement?

A

An if or else if statement.

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

What are two branching statements?

A

If and else if.

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

What are the 3 loop statements?

A

While,
Do while,
For

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

What is the different between a while and do while statement?

A

A while statement will check a Boolean expression before it loops and if the condition is true perform the body of the loop. The do whole tests the conditions at the bottom. Always performed at least once.

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

What is the concept of embedding a statement in another statement?

A

Nesting.

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

What are the 4 stages of compilation?

A
Pre-processor,
Compilation,
Assembly,
Linking. 
(PCAL)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

What happens in the pre-processor stage?

A

Combined source codes into one logic file.

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

what happens in the compilation phase?

A

The output from the pre-processor phase is converted to assembly language.

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

What happens in the assembly phase?

A

Machine code is generated from the output of the compilation phase.

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

What happens in the linking phase?

A

Takes the machine code to produce an executable.

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

What is an executable?

A

And finished program. “The thing you click on”

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

What are the four parts of a program?

A
Declarations,
Input,
Processing,
Output. 
(DIPO)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

What are comments and what are the two types?

A

Comments are symbols used to indicate to the compiler that the text following should be ignored. Single line comment (//) and block or multi line comment (/* */)

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

What is a variable?

A

Named memory location. Can change.

40
Q

What is a constant?

A

A names value. Cannot change.

41
Q

What are the four basic data types and their sizes?

A

Character 1 byte
Integer 4 bytes
Float 4 bytes
Boolean 1 byte

42
Q

What are the 3 required parts of a variable declaration?

A

Data type, variable name, and a semicolon.

43
Q

What is an array?

A

An array is a concept that groups data of the same type in adjacent memory locations. After declared it cannot change in size.

44
Q

What are the 2 terms associated with arrays?

A

Index- how the computer will reference a position in an array. First position is 0.
Element- association to position in human format. Begins with 1.

45
Q

What is a string?

A

An object that holds a series of characters. Can be any length and can change in size.

46
Q

What is concatenating?

A

The process of joining 2 or more strings together.

47
Q

What library must be utilized for input/output?

A
48
Q

If using cin and getline in the same process what must be in between?

A

ws(cin)

49
Q

What is used to specify the number of decimals to include when displaying a floating number?

A

setprecision(n)

Must be using library.

50
Q

What is a switch statement used for?

A

It can act as a menu.

51
Q

What are the 3 essential actions in a loop?

A

Initialization
Condition
Change

52
Q

What 2 libraries and 1 statement must be used when generating a random number?

A

srand(time(NULL));

53
Q

What is a vector?

A

A vector is like a standard array but can increase in size.

54
Q

What adds elements to a vector?

A

push_back()

55
Q

What removed the elements from the end of a vector?

A

pop_back()

56
Q

What returns the current number of elements in a vector?

A

size()

57
Q

What are the sections of memory?

A
Stack
Free space 
Heap
BSS
Data
Text
58
Q

What is variable scope?

A

Defines how long the variable exists in memory and which parts of the program can access the variable.

59
Q

What is a local variable?

A

Declared within a specific block of code. Stored on the program stack. Only exist while the function is running. Only accessible by the function that created them.

60
Q

What is a global variable?

A

Declared outside of any function. Visible and modifiable by any function in the file they are declared. Exist in memory for the life of the program.

61
Q

What is a static variable?

A

Blend of local and global scoping rules. Declared within a function and can only be accessed by that function. Exist through life of the program.

62
Q

What are the 3 generally accepted programming methodologies?

A

Unstructured,
Procedural,
Object-oriented

63
Q

What does the stack hold?

A

Local variables explicitly declared in a program

64
Q

What is free space?

A

Memory set aside for stack, heap, or other uses.

65
Q

What is the heap?

A

Dynamically allocated memory, uninitialized at first. Slower than the stack. Data can be allocated when needed and freed when it is no longer used.

66
Q

What does the BSS hold?

A

Global and static variables which are uninitialized or initialized to 0. Exist throughout the life of the program. Also holds function pointers.

67
Q

What does data hold (in memory)?

A

Global and static variables which are initialized to a non-zero value. Exist throughout the life of the program.

68
Q

What does text hold?

A

Source code of the currently running program.

69
Q

What is kernal mode memory?

A

Heart of the computer (Os, hardware etc)

70
Q

What are pointers?

A

Special variables whose value is a memory address pointing to where the data is located in memory.

71
Q

What is a * pointer?

A

Pointer declaration or de reference operator. Accesses data referred to by the value of the pointer variable.

72
Q

What a & pointer?

A

Address of. Returns the address in memory where the variable is stored.

73
Q

What data type are pointers?

A

Integers.

74
Q

What is another very important aspect of pointers?

A

Ability to bypass local scoping rules. By passing a reference to the variable using a pointer or memory address the variable can be modified by another function.

75
Q

What is dynamic memory allocation?

A

Allows a programmer to request contiguous blocks of memory from the heap.

76
Q

What is the purpose of the operator “new”?

A

Allocated space in memory. Returns a pointer to the allocated memory or NULL if the allocation failed.

77
Q

What is the purpose of the operator “delete”?

A

Frees memory allocated with “new”.

78
Q

What is a structure?

A

A way of defining a complex variable type comprised of the primitive data types built into C++. Structures allow you to treat related info as one variable.

79
Q

What are the parts that make up a class in a structure?

A

Constructor, destructor, private, public, this, getters/setters.

80
Q

What is the purpose of a constructor?

A

Initialize the class data.

81
Q

What is the purpose of a destructor?

A

Housekeeping when the object leaves scope or the delete keyword is used explicitly. (~)

82
Q

What is the purpose of private?

A

Describe a section of data meant only to be used by the class itself.

83
Q

What is the purpose of public?

A

Describe a section of info that can be accessed from outside the class.

84
Q

What is the purpose of this?

A

Indicates the object itself and cannot be accessed outside the class.

85
Q

What is the purpose of getters/setters?

A

Used to get and set private variables.

86
Q

C++ utilizes two classes to perform file input and output which are located in the fstream header. What are they?

A

ifstream (input file stream)

ofstream (output file stream)

87
Q

What are the 4 most common file modes?

A

ios: :app- append to the end of the file if It already contains data otherwise treat as a new file.
ios: :binary- used when a file contains data that falls outside the printable character range.
ios: :in- read mode. Cannot change contents of the file. Default for ifstream.
ios: :out- write mode. Truncates contents of file or creates a new file if it doesn’t already exist. Default for ofstream.

88
Q

What is file output?

A

The ability to write data to a file.

89
Q

What is file input?

A

The ability to read data from a file.

90
Q

What is a linked list?

A

Provides a mechanism to store data records in a logically ordered manner using pointers to other records. Not constrained by a pre-defined limit of records.

91
Q

What is the head node of a linked list?

A

Identifies the first node of the list.

92
Q

What is the tail node of a linked list?

A

Identifies the final node available. The next node will contain NULL to indicate there is not another node to follow.

93
Q

What is the next node in a linked list?

A

Contains a pointer to the next node available.

94
Q

What is the previous node on a linked list?

A

Contains a pointer to the previous node. Only used in doubly linked lists.

95
Q

What is a singly linked list?

A

Easiest to use. Limitations are inserting or removing data in the middle of the list. Only points to the next node and must start from the first node every time granted access to another node.

96
Q

What is a doubly linked list?

A

Has a pointer to both the previous and next node so traversal of the list can be done both forwards and backwards.

97
Q

How do we ensure a source code is available while debugging?

A

Compile the program using the -g flag.