Test Flashcards

1
Q

What is the definition of finiteness in algorithms?

A

An algorithm must always have a finite number of steps before it ends

It must have a defined endpoint or output and not enter an endless loop.

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

Define definiteness in the context of algorithms.

A

An algorithm needs to have exact definitions for each step

Clear and straightforward directions ensure that every step is understood and can be taken easily.

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

What are inputs in an algorithm?

A

Values supplied to the algorithm before its processing

These inputs come from a predetermined range of acceptable values.

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

What is meant by output in an algorithm?

A

One or more results produced after the algorithm completes its steps

The relationship between the input and the result should be clear.

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

Explain the effectiveness characteristic of an algorithm.

A

Stages must be straightforward to be carried out in finite time using basic operations

Every operation in the algorithm should be doable and practicable.

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

What does generality mean in terms of algorithms?

A

An algorithm should solve a group of issues rather than just one specific case

It should offer a generic fix that manages a variety of inputs.

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

What does modularity refer to in algorithm design?

A

The ability to break a problem down into small modules or steps

This is a basic definition of an algorithm.

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

Define correctness in the context of an algorithm.

A

When given inputs produce the desired output

It indicates that the algorithm was designed correctly.

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

What is maintainability in algorithm design?

A

The algorithm should be designed in a straightforward, structured way

This allows for redefinition without significant changes.

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

What does functionality mean in algorithms?

A

It takes into account various logical steps to solve a real-world problem

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

What is robustness in an algorithm?

A

An algorithm’s ability to define a problem clearly

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

What does user-friendly mean in the context of algorithms?

A

The algorithm should be easy to understand for the programmer

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

How does simplicity impact algorithms?

A

A simple algorithm is easier to understand

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

What is extensibility in algorithm design?

A

The algorithm should be usable by other designers or programmers

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

What is a brute force algorithm?

A

A straightforward approach that exhaustively tries all possible solutions

Suitable for small problem instances but may become impractical for larger ones.

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

Define a recursive algorithm.

A

A method that breaks a problem into smaller, similar subproblems and applies itself to solve them

It continues until reaching a base case.

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

What is an encryption algorithm?

A

Utilized to transform data into a secure, unreadable form using cryptographic techniques

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

What is a backtracking algorithm?

A

A trial-and-error technique used to explore potential solutions by undoing choices

Commonly employed in puzzles and optimization problems.

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

What is the purpose of a searching algorithm?

A

Designed to find a specific target within a dataset

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

What does a sorting algorithm do?

A

Aims to arrange elements in a specific order

This enhances data organization and retrieval.

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

What is a hashing algorithm?

A

Converts data into a fixed-size hash value for rapid data access

Commonly used in databases and password storage.

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

What is the divide and conquer algorithm?

A

Breaks a complex problem into smaller subproblems, solves them independently, and combines their solutions

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

What is a greedy algorithm?

A

Makes locally optimal choices at each step to find a global optimum

Useful for optimization problems but may not always lead to the best solution.

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

What is dynamic programming in algorithms?

A

Stores and reuses intermediate results to avoid redundant computations

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

What is a randomized algorithm?

A

Utilizes randomness in its steps to achieve a solution

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

What is a base case in recursive algorithms?

A

The condition under which the recursion stops

It represents the simplest instance of the problem.

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

What is a recursive case?

A

The part of the algorithm that breaks the problem down into smaller instances

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

What is a stack in the context of recursion?

A

Each recursive call is placed on the system call stack

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

What is the factorial of a number n in terms of recursion?

A

Defined as n! = n * (n-1)! for n > 0, and 0! = 1 as the base case

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

What are the advantages of recursion?

A
  • Simplicity
  • Direct translation for naturally recursive problems
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

What are the disadvantages of recursion?

A
  • Performance overhead due to multiple function calls
  • Higher memory usage from call stack
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

When should recursion be used?

A

When a problem can be divided into similar sub-problems or when the recursive solution is simpler

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

What is linear search?

A

A simple search algorithm that checks each element sequentially

It has a time complexity of O(n).

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

What is the time complexity of linear search in the worst case?

A

O(n)

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

What is binary search?

A

A more efficient search algorithm that repeatedly divides the search interval in half

Requires the array to be sorted.

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

What is the time complexity of binary search?

A

O(log n)

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

What is the best case time complexity for binary search?

A

O(1)

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

Define interpolation search.

A

Similar to binary search but works on uniformly distributed data

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

What is depth-first search (DFS)?

A

Explores as far as possible along one branch before backtracking

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

What is breadth-first search (BFS)?

A

Explores all neighbors at the present depth before moving on to the next depth level

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

What is bubble sort?

A

A simple sorting algorithm that repeatedly swaps adjacent elements

It is inefficient for large datasets.

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

What is the worst-case time complexity of bubble sort?

A

O(n^2)

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

What is selection sort?

A

Finds the minimum element and swaps it with the first unsorted element

Always performs O(n^2) comparisons.

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

What is the worst-case time complexity of selection sort?

A

O(n^2)

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

What is the time complexity of Selection Sort in the best case?

A

O(n^2)

Selection sort does not improve with better input scenarios.

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

What is the primary characteristic of Insertion Sort?

A

Builds a sorted list one element at a time

Efficient for small or nearly sorted datasets.

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

What is the worst-case time complexity of Insertion Sort?

A

O(n^2)

Occurs when the array is sorted in reverse order.

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

What is the best-case time complexity for Merge Sort?

A

O(n log n)

The time complexity remains the same in all cases.

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

What is the main approach used in Quicksort?

A

Selects a pivot element and partitions the array around it

Recursively sorts the partitions.

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

What is the average-case time complexity of Quicksort?

A

O(n log n)

Occurs with random pivots.

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

What data structure does Heap Sort utilize?

A

Binary heap data structure

Builds a max-heap and repeatedly extracts the maximum element.

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

What is the time complexity of Counting Sort?

A

O(n + k)

Where k is the range of the input.

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

What is Radix Sort effective for?

A

Sorting large numbers or strings with fixed length

Sorts numbers by processing individual digits.

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

What is the worst-case time complexity for Bucket Sort?

A

O(n^2)

All elements may end up in one bucket in a degenerate case.

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

What is the defining characteristic of Shell Sort?

A

Generalization of insertion sort with a gap sequence

Sorts elements far apart and gradually reduces the gap.

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

What is Big O Notation?

A

Provides an upper bound on time or space complexity

Represents the worst-case scenario for an algorithm’s efficiency.

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

What does O(1) signify in Big O Notation?

A

Constant Time

The algorithm takes the same time to execute regardless of input size.

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

What is the time complexity of Linear Search?

A

O(n)

The runtime increases linearly with the input size.

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

What is the worst-case time complexity of Bubble Sort?

A

O(n^2)

Inefficient for large datasets.

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

What is the average-case time complexity for Merge Sort?

A

O(n log n)

Consistent across different input scenarios.

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

What is the primary use case for Insertion Sort?

A

Good for small or nearly sorted lists

Efficient for building a sorted list incrementally.

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

Fill in the blank: The best case for Insertion Sort is _______.

A

O(n)

Occurs when the array is already sorted.

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

What is a key observation regarding Quick Sort?

A

Can degrade to O(n^2) if poor pivot selection occurs

While it is efficient on average, the worst-case scenario exists.

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

What is the time complexity of Heap Sort in all cases?

A

O(n log n)

Consistent across best, average, and worst cases.

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

What does O(n log n) represent in terms of algorithm efficiency?

A

Log-Linear Time

Common in efficient sorting algorithms like merge sort and quicksort.

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

What characterizes Exponential Time complexity?

A

Runtime doubles with each additional element

Common in algorithms that solve problems by brute force.

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

What is the definition of a Data Type?

A

Classification that specifies the type of data a variable can hold

Defines operations that can be performed on the data.

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

Give examples of primitive data types.

A
  • Integer
  • Floating Point
  • Character
  • Boolean

Basic building blocks of data in programming.

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

What is an Enumeration in programming?

A

A data type allowing a variable to be a set of predefined constants

Improves code readability and limits possible values.

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

What is the advantage of using Enums?

A
  • Readability
  • Maintainability
  • Type Safety

Prevents assigning invalid values to variables.

71
Q

Fill in the blank: The average case for linear search is _______.

A

O(n)

This simplifies from O(n/2) in Big O notation.

72
Q

What is an Enum in Python?

A

A symbolic name for a set of values, improving code readability and type safety

Enums are defined in Python using the enum module.

73
Q

List three advantages of using Enums

A
  • Readability
  • Maintainability
  • Type Safety

Enums help prevent errors by restricting variable values to a set of specific options.

74
Q

Define a data structure

A

A specific way of organizing and storing data in a computer for efficient access and modification

Data structures are built on top of data types.

75
Q

Give two examples of data structures

A
  • Arrays
  • Linked Lists

Other examples include stacks, queues, trees, graphs, and hash tables.

76
Q

What is an Abstract Data Type (ADT)?

A

A theoretical model of a data structure defining behavior from the user’s perspective without implementation details

ADTs specify operations and expected behavior.

77
Q

List two differences between Data Structures and ADTs

A
  • Data Structures: Concerned with organization and access
  • ADTs: Concerned with operations and expected behavior

Data types are the most basic level of abstraction.

78
Q

What is an array?

A

A collection of homogeneous elements stored in contiguous memory locations

Each element can be accessed using its index.

79
Q

What is the time complexity for accessing an element in an array?

A

O(1)

Direct access via index allows for constant time complexity.

80
Q

What is a linked list?

A

A linear collection of nodes where each node contains data and a reference to the next node

Linked lists can be singly, doubly, or circular.

81
Q

What is the time complexity for inserting a node at the beginning of a linked list?

A

O(1)

This is because only the head pointer needs to be adjusted.

82
Q

What does the append() method do in Python lists?

A

Adds an element to the end of the list

Example: list.append(element)

83
Q

True or False: A stack follows the First-In-First-Out (FIFO) principle.

A

False

A stack follows the Last-In-First-Out (LIFO) principle.

84
Q

What is a queue?

A

A linear data structure that follows the First-In-First-Out (FIFO) principle

The first element added is the first one to be removed.

85
Q

What is a hash table?

A

A data structure that maps keys to values using a hash function

It provides fast lookup for key-value pairs.

86
Q

What is the purpose of a hash function?

A

To convert a key into an index for a hash table

A good hash function ensures uniform distribution and fast computation.

87
Q

What data structure uses the Last-In-First-Out (LIFO) principle?

A

Stack

Operations include push, pop, and peek.

88
Q

Fill in the blank: A _______ allows for storing duplicate elements.

A

Bag

Also known as a multiset.

89
Q

What is the time complexity for searching an element in a linked list?

A

O(n)

Requires traversal from the head to find the target element.

90
Q

What is a tree?

A

A hierarchical data structure composed of nodes with a root node and child nodes

The top node is called the root, and nodes without children are leaves.

91
Q

What is the time complexity for deleting an element from the end of a stack?

A

O(1)

This operation is constant time because it only involves removing the top element.

92
Q

What is a tree in data structures?

A

A hierarchical data structure composed of nodes, with a top node called the root and nodes with no children called leaves.

Each node contains a value and references to child nodes.

93
Q

Define a Binary Tree.

A

A tree where each node has at most two children (left and right).

It is the simplest form of a tree structure.

94
Q

What is a Binary Search Tree (BST)?

A

A binary tree where the left child contains values less than the parent, and the right child contains values greater than the parent.

Allows for efficient searching.

95
Q

What characterizes an AVL Tree?

A

A self-balancing binary search tree where the height of the two child subtrees of any node differs by at most one.

It rebalances through rotations when this condition is violated.

96
Q

What is a Red-Black Tree?

A

A binary search tree with an extra bit of storage per node for color, which can be either red or black, with specific properties to maintain balance.

Properties include that the root is always black and red nodes cannot have red children.

97
Q

What is a B-Tree?

A

A self-balancing search tree where nodes can have more than two children, commonly used in databases and file systems.

A B-tree of order m can have at most m-1 keys and m children.

98
Q

What is the time complexity for insertion in balanced trees like AVL or Red-Black Trees?

A

O(log n).

For unbalanced trees, the complexity can be O(n).

99
Q

What are the types of tree traversal?

A
  • In-order
  • Pre-order
  • Post-order
  • Level-order

Each traversal method has different orders of visiting nodes.

100
Q

Define In-order Traversal.

A

Left, Node, Right.

Used in BSTs to get sorted order.

101
Q

What is a heap?

A

A specialized tree-based data structure that satisfies the heap property, where in a max-heap, the parent node is greater than or equal to its children.

In a min-heap, the parent node is less than or equal to its children.

102
Q

What is the time complexity for searching in a binary heap?

A

O(1).

This is for accessing the root element.

103
Q

What operations can be performed on a set?

A
  • Insert: O(1)
  • Delete: O(1)
  • Search: O(1)
  • Union: O(n)
  • Intersection: O(n)
  • Difference: O(n)

Sets manage unique elements.

104
Q

What is a graph?

A

A collection of nodes (vertices) connected by edges, which can be directed or undirected.

Can also be weighted or unweighted.

105
Q

What is Dijkstra’s Shortest Path Algorithm?

A

A greedy algorithm that finds the shortest path from a single source vertex to all other vertices in a graph with non-negative edge weights.

Time complexity is O(V^2) for the simplest implementation.

106
Q

What distinguishes the Bellman-Ford algorithm from Dijkstra’s algorithm?

A

Bellman-Ford handles negative edge weights and can detect negative cycles, while Dijkstra’s cannot.

Time complexity for Bellman-Ford is O(V*E).

107
Q

What is the time complexity for adding an edge in a graph using an adjacency list?

A

O(1).

This applies when using an adjacency matrix as well.

108
Q

Fill in the blank: A _______ is an abstract data structure that stores unique elements without a specific order.

A

set

Sets are useful for managing unique collections of data.

109
Q

What is the difference between a directed and an undirected graph?

A

Directed graphs have edges with direction, while undirected graphs do not.

This affects how relationships between nodes are represented.

110
Q

Define the time complexity for removing a vertex in a graph.

A

O(V + E).

This is for an adjacency list representation.

111
Q

What is the time complexity of searching in a balanced tree?

A

O(log n).

For unbalanced trees, the complexity can be O(n).

112
Q

What is a Deque?

A

Double-ended queue; flexible insertions/deletions.

113
Q

What data structure uses key-value pairs for fast lookups?

A

Hash Table.

114
Q

Define a Tree in data structures.

A

Hierarchical structure; efficient searches and sorted data.

115
Q

What is a Heap used for?

A

Binary tree for priority queues; fast access to max/min.

116
Q

What characterizes a Set in programming?

A

Unique elements; fast membership checks.

117
Q

What is a Graph in the context of data structures?

A

Nodes and edges; used in networks and relationship modeling.

118
Q

What are the key operations in a Dictionary/Map?

A
  • Insertion * Lookup * Deletion * Update * Check Existence * Iteration * Get Method * Length * Clearing * Copying * Pop * Popitem * Setdefault
119
Q

How do you add a new key-value pair to a dictionary?

A

dictionary[key] = value.

120
Q

What is the syntax to retrieve a value associated with a key in a dictionary?

A

value = dictionary[key].

121
Q

What does the ‘del’ statement do in a dictionary?

A

Removes a key-value pair from the dictionary.

122
Q

How do you update a value in a dictionary?

A

dictionary[key] = new_value.

123
Q

What is the purpose of the ‘in’ keyword in a dictionary?

A

Checking if a key exists in the dictionary.

124
Q

Fill in the blank: To iterate over values in a dictionary, use _______.

A

dictionary.values()

125
Q

What does the ‘get’ method do in a dictionary?

A

Retrieves the value associated with a key, with an optional default.

126
Q

How can you find the number of key-value pairs in a dictionary?

A

len(dictionary).

127
Q

What does the ‘clear’ method do in a dictionary?

A

Removes all key-value pairs from the dictionary.

128
Q

What does the ‘copy’ method do in a dictionary?

A

Creates a shallow copy of the dictionary.

129
Q

What is the purpose of the ‘pop’ method in a dictionary?

A

Removes a key and returns its value.

130
Q

What does the ‘popitem’ method do in a dictionary?

A

Removes and returns an arbitrary key-value pair as a tuple.

131
Q

What does the ‘setdefault’ method do in a dictionary?

A

Returns the value of a key if it exists; otherwise, inserts the key with a specified value and returns that value.

132
Q

What is the difference between static and dynamic variable declaration?

A
  • Static: Memory allocated at compile time. * Dynamic: Memory allocated at runtime.
133
Q

What is a characteristic of static variables?

A

Fixed size; allocated during compilation.

134
Q

Fill in the blank: Dynamic variables are allocated memory at _______.

A

runtime

135
Q

What defines strongly-typed languages?

A

Strict type enforcement; no implicit conversions.

136
Q

What is a key characteristic of weakly-typed languages?

A

Implicit type coercion; allows automatic conversion between types.

137
Q

What are the assignment operators in programming?

A
  • Simple Assignment (=) * Compound Assignment (+=, -=, *=, /=, etc.)
138
Q

What is the order of operations in programming?

A
  • Arithmetic Operations * Comparison Operations * Logical Operations * Assignment Operators * Bitwise Operations * Miscellaneous
139
Q

What is the purpose of a for loop?

A

Iterates over a sequence or range, executing a block of code for each item.

140
Q

What does the while loop do?

A

Repeatedly executes a block of code as long as a condition is True.

141
Q

What is a do-while loop?

A

Executes a block of code at least once, then repeats while a condition is True.

142
Q

What does the ‘break’ statement do in a loop?

A

Exits the loop immediately.

143
Q

What is the purpose of the ‘continue’ statement in loops?

A

Skips the rest of the current iteration and proceeds to the next.

144
Q

What is the function of the ‘pass’ statement in Python?

A

Acts as a placeholder statement.

145
Q

What are nested loops?

A

Loops inside other loops to perform complex iterations.

146
Q

What is the if statement used for?

A

Executes a block of code if its condition is True.

147
Q

What is the difference between if-else and if-elif-else statements?

A

if-else handles two conditions; if-elif-else checks multiple conditions in sequence.

148
Q

What does the switch-case statement do?

A

Dispatches execution to different parts of code based on the value of an expression.

149
Q

What does the AND operator return?

A

True if both conditions are True.

150
Q

What does the OR operator return?

A

True if at least one condition is True.

151
Q

What does the AND operator do?

A

Returns True if both conditions are True

Syntax: condition1 and condition2 (Python/C/C++)

152
Q

What is the syntax for the OR operator in Python?

A

condition1 or condition2

Example: if x < 0 or x > 10:

153
Q

Describe the NOT operator.

A

Returns the opposite Boolean value of the condition

Syntax: not condition (Python/C/C++)

154
Q

Define a class.

A

A template for creating objects that encapsulates data and methods

Example: class ClassName: …

155
Q

What are attributes in a class?

A

Variables that hold data related to the class

Defined within the __init__ method using self in Python.

156
Q

What are methods in a class?

A

Functions defined within a class that operate on its attributes or perform actions

Defined with def keyword in Python.

157
Q

What is a constructor?

A

A special method that initializes objects of the class

In Python, it’s the __init__ method.

158
Q

What is a destructor?

A

A method that cleans up when an object is destroyed

In C++, defined with ~ClassName().

159
Q

What is inheritance in programming?

A

Allows creating a new class based on an existing class, inheriting its attributes and methods

Example: class ChildClass(ParentClass): …

160
Q

What does encapsulation refer to?

A

The concept of restricting access to certain details of an object’s implementation

Involves using access specifiers.

161
Q

What are access specifiers in C++?

A

Keywords that control access to class members

Examples: public, protected, private.

162
Q

What is polymorphism in programming?

A

Allows objects of different classes to be treated as objects of a common base class

Typically through method overriding.

163
Q

What is garbage collection?

A

A process by which a computer’s memory is automatically managed

Frees up memory that is no longer being used.

164
Q

What is reference counting?

A

A count of the number of times an object is referred to in a program

In Python, when the count becomes zero, the object is deleted.

165
Q

What is memory allocation?

A

The process of reserving memory space for an object in a program

Example: new keyword in Java.

166
Q

Define linked allocation.

A

A memory allocation technique where memory is allocated in linked nodes

Example: Linked lists.

167
Q

What is sequential allocation?

A

A memory allocation technique where memory is allocated in a sequential manner

Example: Arrays.

168
Q

What is a Data Flow Diagram (DFD)?

A

A graphical representation of the flow of data through a system

Shows how data enters, moves, and exits the system.

169
Q

What do processes represent in a DFD?

A

How data is transformed or manipulated

Represented by circles or rounded rectangles.

170
Q

What are data stores in a DFD?

A

Where data is stored within the system

Represented by open-ended rectangles.

171
Q

What do data flows represent in a DFD?

A

Movement of data between processes, data stores, and external entities

Represented by arrows.

172
Q

What are external entities in a DFD?

A

Outside the system but interact with it

Represented by squares or rectangles.

173
Q

How do DFDs assist in algorithm design?

A

Help visualize how data will flow through the algorithm

Useful for designing algorithms that manipulate data.

174
Q

What benefit do DFDs provide for modularity?

A

Break down the system into smaller processes for better organization

Each process can correspond to a function or module.