CS341 Midterm - Core Terms and Quick Syntax

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

1/59

flashcard set

Earn XP

Description and Tags

Course-backed recall cards: definitions, lists, access rules and tiny C++ syntax. Say the answer before flipping and mark misses. Masks use unsigned x and a valid index k, with index 0 at the right. Use the paper quizzes for full code, reasoning and traces.

Last updated 9:35 PM on 10/13/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

60 Terms

1
New cards

Four pillars of OOP

Inheritance, polymorphism, data abstraction, encapsulation.

2
New cards

Three forms of polymorphism in CS341

Virtual members, name overloading, operator overloading.

3
New cards

Abstract data type (ADT)

A collection of data and a set of operations on that data.

4
New cards

Data structure

An implementation of an ADT in a programming language.

5
New cards

Abstraction

Separate what something does from how it is implemented.

6
New cards

Encapsulation

Combine data and operations in a class and control access to the internal data.

7
New cards

Inheritance

A derived class gains a base-class relationship and its accessible members.

8
New cards

Polymorphism

A common interface, function name or operator supports different forms or implementations.

9
New cards

Virtual members

Virtual functions support run-time dispatch through a base-class pointer or reference.

10
New cards

Name overloading

Same function name, different parameter lists. Return type alone is not enough.

11
New cards

Operator overloading

The same operator has different implementations for different operand types.

12
New cards

Static polymorphism

Selection normally occurs at compile time; examples include name and operator overloading.

13
New cards

Dynamic polymorphism

Run-time selection of an overridden virtual method according to the actual object.

14
New cards

Abstract class

Has at least one remaining pure-virtual requirement; cannot be instantiated directly.

15
New cards

Pure abstract class

Course term for an interface whose behavioral operations are all pure virtual.

16
New cards

Concrete class

Has no remaining pure-virtual requirements and can be instantiated.

17
New cards

Pure virtual method: C++ declaration

virtual void walk(void) = 0;

18
New cards

Declaration

Announces an entity and its interface; a function declaration need not supply a body.

19
New cards

Function definition

Supplies the function's implementation body.

20
New cards

Header versus source in this course

.h usually declares methods; .cpp defines them. Headers can also contain inline definitions.

21
New cards

Three inheritance modes in CS341

Public, protected, private.

22
New cards

Default inheritance for a C++ class

Private: class Child : Base uses private inheritance.

23
New cards

Public inheritance: public/protected base members

Public remains public; protected remains protected.

24
New cards

Protected inheritance: public/protected base members

Both become protected in the derived class.

25
New cards

Private inheritance: public/protected base members

Both become private in the derived class.

26
New cards

Base-private members in a derived class

Not directly accessible to ordinary derived-class methods; still exist in the base subobject.

27
New cards

Base/derived construction order

Base then derived: BD.

28
New cards

Base/derived destruction order

Derived then base: DB.

29
New cards

Can a constructor be virtual?

No. C++ constructors cannot be virtual.

30
New cards

Why use a virtual base destructor?

To safely delete a derived object through a base-class pointer.

31
New cards

Immutable

Cannot change.

32
New cards

Mutable

Can change.

33
New cards

C++ keyword for the ordinary immutability promise

const.

34
New cards

const after a member-function parameter list

The function cannot modify the object's non-mutable direct state through this.

35
New cards

Create a heap Student through pointer student

Student * student = new Student();

36
New cards

Does Student * student; allocate a Student?

No. It only declares a pointer; it does not construct a Student object.

37
New cards

Cleanup for a single heap object

delete student; invokes its destructor and releases the allocation.

38
New cards

Cleanup for an array allocated with new[]

delete [] values; use array delete for an array allocation.

39
New cards

new

Allocates storage and constructs the object; returns a pointer.

40
New cards

nullptr

A null-pointer literal. Assigning it to a pointer does not delete the previous allocation.

41
New cards

Shallow copy of an owning pointer

Copies its address, so both objects refer to the same allocation.

42
New cards

Deep copy of owned data

Allocates independent storage and copies the contents.

43
New cards

Copy-constructor declaration for Snoopy

Snoopy(const Snoopy & other);

44
New cards

Why pass a copy-constructor source by reference?

To avoid recursively copying the argument; const prevents modifying the source through that reference.

45
New cards

Six traditional Makefile components

Comments, Rules, Dependency Lines, Shell Lines, Macros, Inference Rules.

46
New cards

Makefile comment

Begins with #; the rest of that line is comment text.

47
New cards

Makefile rule

A target/prerequisite line plus any associated shell commands; specifies what to build and how.

48
New cards

Makefile dependency line

target: prerequisites

49
New cards

Makefile target

The item to build or action to run; appears LEFT of the colon.

50
New cards

Makefile prerequisites (dependencies)

Inputs needed by the target; appear RIGHT of the colon.

51
New cards

Makefile shell line (recipe)

A command below a dependency line; ordinarily starts with a literal TAB.

52
New cards

Makefile macro

A named value, e.g. CXX = g++; expand it with $(CXX).

53
New cards

Makefile inference or pattern rule

A general build pattern, e.g. %.o: %.cpp, with a compilation command.

54
New cards

Bitwise &

AND: a result bit is 1 only when BOTH corresponding input bits are 1.

55
New cards

Bitwise |

Inclusive OR: a result bit is 1 when AT LEAST ONE corresponding input bit is 1.

56
New cards

Bitwise ^

Exclusive OR (XOR): a result bit is 1 when the corresponding input bits DIFFER.

57
New cards

Bitwise ~

One's complement: invert every bit within the type's width.

58
New cards

Bitwise <<

Left shift: shifts bits left by the specified number of positions.

59
New cards

Bitwise >>

Right shift: shifts bits right by the specified number of positions.

60
New cards

Four mask operations (unsigned x, valid right-index k)

mask = 1u << k; CHECK: (x & mask) != 0; SET: x |= mask; CLEAR: x &= ~mask; FLIP: x ^= mask. Index0 is rightmost.