Mod 3 Flashcards Preview

jcac random > Mod 3 > Flashcards

Flashcards in Mod 3 Deck (97):
1

Describe unstructured programming.

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

2

Describe procedural programming.

Groups statements that perform a specific task together.

3

Describe object oriented programming.

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

4

What defines an object?

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

5

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

Encapsulation,
Inheritance,
Polymorphism

6

What is encapsulation?

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

7

What is inheritance?

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

8

What is polymorphism?

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

9

What is a programming language?

How people talk to computer hardware.

10

What is machine code?

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

11

What is assembly language?

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

12

How does a CPU understand assembly language?

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

13

What are compiled languages?

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

14

What is a compiler for C++?

g++

15

What is interpreted /scripting language?

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

16

what is JIT (just in time) compilation?

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.

17

What is porting?

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

18

What are the three techniques used by computer programs?

Sequential action,
Branches,
Loops

19

What is program flow?

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

20

What is a flow chart?

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

21

What flow chart action is represented by an oval?

Terminal. Start/end of the program.

22

What flow chart action is represented by a rectangle?

Process. Action to be executed.

23

What flow chart action is represented by a rhombus?

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

24

What flow chart action is represented by a diamond?

Decision. Branch based on a Boolean decision.

25

What is pseudocode?

Using natural language to define code or flow charts.

26

What is required before any else or else if statement?

An if or else if statement.

27

What are two branching statements?

If and else if.

28

What are the 3 loop statements?

While,
Do while,
For

29

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

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.

30

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

Nesting.

31

What are the 4 stages of compilation?

Pre-processor,
Compilation,
Assembly,
Linking.
(PCAL)

32

What happens in the pre-processor stage?

Combined source codes into one logic file.

33

what happens in the compilation phase?

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

34

What happens in the assembly phase?

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

35

What happens in the linking phase?

Takes the machine code to produce an executable.

36

What is an executable?

And finished program. "The thing you click on"

37

What are the four parts of a program?

Declarations,
Input,
Processing,
Output.
(DIPO)

38

What are comments and what are the two types?

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 (/* */)

39

What is a variable?

Named memory location. Can change.

40

What is a constant?

A names value. Cannot change.

41

What are the four basic data types and their sizes?

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

42

What are the 3 required parts of a variable declaration?

Data type, variable name, and a semicolon.

43

What is an array?

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

44

What are the 2 terms associated with arrays?

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

What is a string?

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

46

What is concatenating?

The process of joining 2 or more strings together.

47

What library must be utilized for input/output?

48

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

ws(cin)

49

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

setprecision(n)
Must be using library.

50

What is a switch statement used for?

It can act as a menu.

51

What are the 3 essential actions in a loop?

Initialization
Condition
Change

52

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



srand(time(NULL));

53

What is a vector?

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

54

What adds elements to a vector?

push_back()

55

What removed the elements from the end of a vector?

pop_back()

56

What returns the current number of elements in a vector?

size()

57

What are the sections of memory?

Stack
Free space
Heap
BSS
Data
Text

58

What is variable scope?

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

59

What is a local variable?

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

What is a global variable?

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

What is a static variable?

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

What are the 3 generally accepted programming methodologies?

Unstructured,
Procedural,
Object-oriented

63

What does the stack hold?

Local variables explicitly declared in a program

64

What is free space?

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

65

What is the heap?

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

What does the BSS hold?

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

67

What does data hold (in memory)?

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

68

What does text hold?

Source code of the currently running program.

69

What is kernal mode memory?

Heart of the computer (Os, hardware etc)

70

What are pointers?

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

71

What is a * pointer?

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

72

What a & pointer?

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

73

What data type are pointers?

Integers.

74

What is another very important aspect of pointers?

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

What is dynamic memory allocation?

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

76

What is the purpose of the operator "new"?

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

77

What is the purpose of the operator "delete"?

Frees memory allocated with "new".

78

What is a structure?

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

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

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

80

What is the purpose of a constructor?

Initialize the class data.

81

What is the purpose of a destructor?

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

82

What is the purpose of private?

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

83

What is the purpose of public?

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

84

What is the purpose of this?

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

85

What is the purpose of getters/setters?

Used to get and set private variables.

86

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

ifstream (input file stream)
ofstream (output file stream)

87

What are the 4 most common file modes?

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

What is file output?

The ability to write data to a file.

89

What is file input?

The ability to read data from a file.

90

What is a linked list?

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

What is the head node of a linked list?

Identifies the first node of the list.

92

What is the tail node of a linked list?

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

93

What is the next node in a linked list?

Contains a pointer to the next node available.

94

What is the previous node on a linked list?

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

95

What is a singly linked list?

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

What is a doubly linked list?

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

97

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

Compile the program using the -g flag.