CSC 1061 Midterm

0.0(0)
Studied by 1 person
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/55

Last updated 8:44 PM on 3/5/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

56 Terms

1
New cards

Include Guard (Macro Guard)

A technique in C++ that uses a unique identifier defined at the top of header files (.h) to prevent multiple declarations of the same code.

2
New cards

Header File

These files contain declarations (function prototypes) and are #included, but not compiled

3
New cards

Source Files

These files contain the actual implementation (definitions) of functions and are compiled, but not #included

4
New cards

Preprocessor

The first stage in building a multi-file project where the #include directives are replaced by the content of the specified header or file.

5
New cards

Compiler

The second stage where each source file (.cpp) is checked for syntax errors and, if successful, generates a corresponding object file (.o)

6
New cards

Linker

The final stage in building a multi-file project where all objects are linked together to create the executable file (.exe)

7
New cards

Non-Member Function

A type of function that performs a specific task and operates independently of any class. An example is rand().

8
New cards

Overloaded Function

Functions that share the same name but differ in their argument list (number or data type of arguments), allowing them to perform the same task in different ways.

9
New cards

Pass By Value

A parameter passing type where a copy of the argument’s value is passed to the function, meaning the original cannot be modified. It’s safe and efficient for simple data types.

10
New cards

Pass By Reference

A parameter passing type where the memory address of the argument is passed to the function, allowing the function to modify the original variable.

11
New cards

Abstraction

The process of defining abstraction and explaining its role in the problem-solving process.

12
New cards

Class

A custom data type or Abstract Data Type (ADT) that encapsulates data and functionality, making it reusable.

13
New cards

Encapsulation

The concept of hiding the internal implementation details of an object and only exposing the necessary functionalities to the outside world, typically by declaring data members as private.

14
New cards

Object

An instantiation of a class, which has memory and values based on the class’s blueprint.

15
New cards

Constructor

A special type of function that allows an object to be created and its data members initialized. All classes should have a default one.

16
New cards

Member Function

A function that belongs to a class and performs tasks on the class’s data members. Examples include getters, setters, and other utility functions.

17
New cards

Getters

Member functions that return the value of a data member.

18
New cards

Setters

Member functions that change or modify the value of a data member, often with validation.

19
New cards

This Pointer

A hidden argument passed to all member functions calls that points to the object that invoked the function. It is NOT available in static member functions.

20
New cards

Static Variable

Variables declared as ‘static’ in a class, which are allocated in separate static storage and shared by objects of that class. They cannot be initialized using constructors.

21
New cards

Operator Overloading

The ability of an operator to behave differently based on the data types or classes of the operands involved, defining custom behaviors for existing operators.

22
New cards

Friend Functions

A function or class declared with the ‘friend’ keyword that can access the private and protected members of another class.

23
New cards

New Operators

New creates on the heap and return the address. This is accessed by a pointer, which stores its address. Must be deleted after creation for fear or memory leaks.

24
New cards

Non-Overloadable Operators

Member selector (.), scope-resolution (::), ternary (?:), sizeof, and member pointer selector (.*) cannot be overloaded.

25
New cards

Default Operator Definition

Operators are only automatically defined for simple data types by default. For custom classes, you typically need to overload them.

26
New cards

Relational Operator Rule

If you define one relational operator (e.g., ==), it is good practice to define all six (==, !=, <, <=, >, >=) to ensure completeness and logical consistency.

27
New cards

Assignment Operator Default

The ‘operator=’ is automatically provided by classes for assignment, creating a copy of the object’s values.

28
New cards

Insertion Operator Return Type

When overloading the insertion (<<) operator for output, it typically returns ‘std::ostream&’ to allow for method chaining.

29
New cards

File Stream Operator Guideline

When overloading ‘operator<<’ or ‘operator>>’ for file streams (ofstream/ifstream), do not create, open, check, or close the file object within the operator function. This is handled by the caller.

30
New cards

Static Array

A compiler memory-managed array that is fixed-size at compile time, cannot grow or shrink during run-rime, stores elements of the same data type, and has 0-based indexes for referencing elements.

31
New cards

Data Structure

A specialized means of organizing and storing data in computers to perform operations on the stored data more efficiently.

32
New cards

Big-O Notation

A notation (for ‘operations order’) that provides a useful approximation to the actual number of steps an algorithm takes in computation, characterizing its efficiency independent of specific programs or computer.

33
New cards

Bag Data Structure

An unordered collection of values that may have duplicates.

34
New cards

Container (Data Structure)

A holder object that stores a collection of other objects (elements), manages their storage space, and provides member functions to access and modify the collection.

35
New cards

Subscript Operator ([])

A mechanism to retrieve and manipulate array elements, acting as both a getter and a setter, denoted by [].

36
New cards

append()

A Bag ADT function that adds a new element at the end of the array if there is room.

37
New cards

getSize()

A Bag ADT function that returns the number of actual objects currently held in the array.

38
New cards

removeByIndex() (Bag ADT)

A Bag ADT function that removes an element at a specified index by taking the last indexed element and overwriting the element to remove.

39
New cards

Invariant of data members

A rule or condition that must always be true for the data members of a class, ensuring the data structure’s integrity.

40
New cards

Sorting Algorithm Objectives

To simulate and understand the runtime behavior of various sorting algorithms, and to understand their advantages and disadvantages.

41
New cards

Bubble Sort

A sorting algorithm where adjacent elements are repeatedly compared and swapped if they are in the wrong order, with the largest unsorted element moving to the end of the list after each iteration.

Best: O(n)

Worst: O(n²)

42
New cards

Bubble Sort: First Iteration

In the first iteration of Bubble Sort, you start by comparing the first and second elements. If the first is greater than the second, they are swapped. This process continues, comparing adjacent elements and swapping them if out of order, until the last element is reached.

43
New cards

Selection Sort

A sorting algorithm that repeatedly finds the minimum element from the unsorted part of the list and puts it at the beginning. It builds the sorted list one element at a time.

Best: O(n²)

Worst: O(n²)

44
New cards

Selection Sort: First Element Comparison

In Selection Sort, you set the first element as the minimum. Then you compare this minimum with subsequent elements, updating the minimum if a smaller element is found. This continues until the end of the unsorted list for that iteration.

45
New cards

Selection Sort: Iteration Completion

After each iteration in Selection Sort, the found minimum element is placed at the front of the unsorted list. The process then repeats, starting from the new first unsorted element, until all elements are in their correct positions.

46
New cards

Basic Sorting Algorithms

Bubble Sort, Selection Sort, Insertion Sort.

They generally have less efficient runtime complexities compared to more advanced algorithms for larger datasets.

47
New cards

Shell Sort

A type of sorting algorithm that improves on Insertion Sort by sorting incremental sub-lists, allowing elements to move further distances at once.

48
New cards

Merge Sort

A sorting algorithm that requires additional space for the merging process, as it typically divides the list into halves, sorts them, and then merges the sorted halves back together.

49
New cards

Quick Sort

A sorting algorithm that can degrade in performance if the ‘split points’ (pivots) are not chosen near the middle of the list. It does not require additional space for sorting in-place.

50
New cards

Class ‘has a’ relationship

A class ‘has a’ data member relationship describes composition, where one class contains an object of another class as a member.

51
New cards

Inheritance ‘is a’ relationship

Inheritance describes an ‘is a’ relationship where a derived class is specialized version of a base class, inheriting its properties and behaviors.

52
New cards

Code Reuse

Code reuse is a significant benefit of inheritance, allowing developers to extend existing code rather than rewriting it, which saves time and effort.

53
New cards

Inherited from Base Class (exclusions)

In principle, a publicly derived class inherits access to every member of a base class except for constructors, destruction, assignment operator members, and friend non-member functions, and private members.

54
New cards

Derived Class Constructors

The constructors of a derived class must call the constructor of its base class using an initializer list to properly initialize the base class part of the derived object.

55
New cards

Inheritance Function Overriding

Function overriding occurs when a derived class provides its own implementation of a function that is already defined in its base class.

56
New cards

Polymorphism

Polymorphism (meaning ‘many forms’) allows a parent pointer to call a child method, provided the child class overrides the method of the parent. This often involves base class pointers pointing to the derived class objects.

Explore top flashcards

flashcards
English 1111-Sadlier Unit IIII
20
Updated 1242d ago
0.0(0)
flashcards
APHUG Unit 6 & 7 Vocab
50
Updated 1066d ago
0.0(0)
flashcards
PSYC 14
64
Updated 188d ago
0.0(0)
flashcards
Kafli 9 - Choice and Preference
43
Updated 120d ago
0.0(0)
flashcards
Fifty common Russian verbs
51
Updated 435d ago
0.0(0)
flashcards
Unit 3 vocab
20
Updated 1206d ago
0.0(0)
flashcards
PA Drivers Permit Flashcards
166
Updated 1056d ago
0.0(0)
flashcards
Unit 1A
61
Updated 1160d ago
0.0(0)
flashcards
English 1111-Sadlier Unit IIII
20
Updated 1242d ago
0.0(0)
flashcards
APHUG Unit 6 & 7 Vocab
50
Updated 1066d ago
0.0(0)
flashcards
PSYC 14
64
Updated 188d ago
0.0(0)
flashcards
Kafli 9 - Choice and Preference
43
Updated 120d ago
0.0(0)
flashcards
Fifty common Russian verbs
51
Updated 435d ago
0.0(0)
flashcards
Unit 3 vocab
20
Updated 1206d ago
0.0(0)
flashcards
PA Drivers Permit Flashcards
166
Updated 1056d ago
0.0(0)
flashcards
Unit 1A
61
Updated 1160d ago
0.0(0)