EXAM ONE FULL STUDY GUIDE CS214

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

1/184

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 10:46 PM on 10/8/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

185 Terms

1
New cards

What are the four pillars of OOP?

Encapsulation/Inheritance/Polymorphism/Abstraction

2
New cards

What is a programming paradigm?

The fundamental approach or style of programming that defines how to structure and conceptualize code

3
New cards

What does imperative programming focus on?

How to achieve a result by explicitly listing each step

4
New cards

What does declarative programming focus on?

What the result should be/without specifying exact steps

5
New cards

What is OOP centered around?

Objects comprised of data(attributes)and methods(functions)

6
New cards

What is functional programming centered around?

The evaluation of expressions using functions/avoiding changing state and mutable data

7
New cards

What are the three key principles of functional programming?

First-class functions/immutability/and pure functions

8
New cards

What is a first-class function?

A function treated like any other data type—passed as arguments/returned/and assigned to variables

9
New cards

What is a higher-order function?

A function that accepts or returns other functions

10
New cards

What is immutability?

Data cannot be changed after creation/new data must be created instead

11
New cards

What is a pure function?

A function whose output is determined only by its input/with no side effects

12
New cards

What is referential transparency?

An expression can be replaced with its output without changing program behavior

13
New cards

When was FP added to Java?

Java 8(2014)with lambda expressions and streams

14
New cards

What is a lambda expression?

A concise way of representing an anonymous(unnamed)function:(parameters)->body

15
New cards

What is a functional interface?

An interface with exactly one abstract method

16
New cards

What does BinaryOperator do?

Takes two operands of type T and produces a result of type T

17
New cards

What does Function do?

Takes an input of type T and returns a result of type R

18
New cards

What does Consumer do?

Takes an input of type T and returns void

19
New cards

What does Supplier do?

Provides(returns)a result of type T with no input

20
New cards

What does Predicate do?

A boolean-value test on a type T

21
New cards

What is a stream in Java?

A sequence of objects processed in a functional manner/not a data structure/computed on demand

22
New cards

What are intermediate stream operations?

Operations that return a new stream and are lazy(e.g./map/filter/sorted/distinct)

23
New cards

What are terminal stream operations?

Operations that consume the stream and produce a result(e.g./collect/reduce/forEach/count/anyMatch/allMatch)

24
New cards

What does map() do?

Transforms each element in the stream

25
New cards

What does filter() do?

Keeps elements matching a given predicate

26
New cards

What does distinct() do?

Removes duplicate elements(per Object.equals)

27
New cards

What does reduce() do?

Combines elements into a single result

28
New cards

What does anyMatch() do?

Returns true if any element matches the condition

29
New cards

What does allMatch() do?

Returns true if all elements match the condition

30
New cards

Why are streams called lazy?

They do no work until a terminal operation is invoked

31
New cards

What is the Observer pattern used for?

Notifying multiple objects automatically when a subject's state changes

32
New cards

What are the components of the Observer pattern?

A subject/an observer interface/and classes implementing that interface

33
New cards

What is the Strategy pattern used for?

Defining a family of interchangeable algorithms the client can choose at runtime

34
New cards

What are the components of the Strategy pattern?

A strategy interface/concrete strategies/and a context class

35
New cards

What is UML?

A standardized visual modeling language for software design—not a programming language

36
New cards

What is a class diagram?

A structure diagram showing classes/attributes/operations/and their static relationships

37
New cards

What are the three main compartments of a class diagram?

Class name/attributes/and operations

38
New cards

What is a use case diagram for?

Showing how users(actors)interact with the system to achieve goals

39
New cards

What is an activity diagram for?

Modeling procedural and parallel behavior/workflows/and branching logic

40
New cards

What is a state machine diagram for?

Modeling an object's behavior over time through states and transitions

41
New cards

What is a package diagram for?

Grouping classes into namespaces and showing dependencies between packages

42
New cards

What is a deployment diagram for?

Showing the physical layout—what software runs on what hardware

43
New cards

What is an association in UML?

A solid line showing classes are related(related to relationship)

44
New cards

What is a unidirectional association?

Only one class knows about the other(e.g./Customer knows Order/Order doesn't know Customer)

45
New cards

What is a bidirectional association?

Two classes linked as inverses/each knowing about the other

46
New cards

What is aggregation?

A has a whole-part relationship where the part can exist independently(open diamond on the whole)

47
New cards

What is composition?

A stronger consists of relationship where the part cannot exist independently(filled diamond on the whole)

48
New cards

What is generalization?

Inheritance—a parent-child is a relationship/shown as a solid line with a hollow arrowhead

49
New cards

What is realization?

A class implementing an interface/shown as a dashed line with a hollow arrowhead

50
New cards

What does multiplicity 1 mean?

Exactly 1

51
New cards

What does multiplicity * mean?

Zero or more with no upper limit

52
New cards

What does multiplicity 0..1 mean?

Zero or one

53
New cards

What is forward engineering?

Drawing a UML diagram before writing code

54
New cards

What is reverse engineering?

Drawing a UML diagram from existing code

55
New cards

What is a requirement?

A statement stakeholders agree must be true for the customer's problem to be adequately solved

56
New cards

What is requirements gathering?

Collecting information about what the system needs to do

57
New cards

What is requirements analysis?

Identifying/documenting/and validating the needs and expectations of the product

58
New cards

What is a utility class?

A stateless helper class/often with static methods

59
New cards

When should you use an instance variable vs a parameter?

Use instance variables when data is part of an object's state/otherwise prefer passing as parameters

60
New cards

What is the output of:numbers.stream().map(n->n2).reduce(0/Integer::sum)for[1/2/3/4/5]?

30—each number doubled/then summed

61
New cards

What is the output of:words.stream().filter(s->s.length()>=5).map(String::toUpperCase .sorted().collect(…)for[banana/apple/kiwi/pear/orange/grape]?

[APPLE/BANANA/GRAPE/ORANGE]—kiwi(4)and pear(4)are filtered out

62
New cards

What is the difference between map()and forEach()?

map()transforms each element and returns a new stream/forEach()performs an action on each element and returns void

63
New cards

What is the key difference between intermediate and terminal operations?

Intermediate operations return a new stream and are lazy/terminal operations consume the stream and produce a result

64
New cards

Can you call a terminal operation and then continue chaining?

No—once a terminal operation runs/the stream is consumed

65
New cards

What does collect(Collectors.toSet())do vs toList()?

toSet()returns a Set(removes duplicates)/toList()returns a List(preserves all elements

66
New cards

Which functional interface would you use to test a condition?

Predicate—it has a test()method returning boolean

67
New cards

Which functional interface would you use to produce a value with no input?

Supplier—it has a get()method

68
New cards

Which functional interface would you use to consume an input with no return?

Consumer—it has an accept()method

69
New cards

What is the arrow token in a lambda?

The->separates parameters from the body:(params)->body

70
New cards

A stock-trading app needs:(1)multiple components auto-update when price changes/(2)traders choose different algorithms at runtime.Which patterns?

Observer for(1)/Strategy for(2)

71
New cards

What pattern is best for a GUI event listener system?

Observer—multiple components notified when an event/state changes

72
New cards

What pattern is best for a payment system with credit card/PayPal/and bank transfer?

Strategy—interchangeable algorithms chosen at runtime

73
New cards

In the Strategy pattern/what is the role of the context class?

It holds a reference to a strategy and delegates work to it/able to switch strategies dynamically

74
New cards

In the Observer pattern/what does the subject maintain?

A list of its observers and notifies them of state changes

75
New cards

What are the three components of the Observer pattern?

A subject/an observer interface/and concrete observer classes

76
New cards

What are the three components of the Strategy pattern?

A strategy interface/concrete strategy classes/and a context class

77
New cards

Which relationship uses an open diamond?

Aggregation—the part can exist independently of the whole

78
New cards

Which relationship uses a filled diamond?

Composition—the part cannot exist independently

79
New cards

Which relationship uses a solid linewith a hollow arrowhead?

Generalization(inheritance)—is a

80
New cards

Which relationship uses a dashed linewith a hollow arrowhead?

Realization(implementation)—can

81
New cards

A Library contains many Books/and a Book belongs to a Library.What type of association?

Bidirectional—both classes reference each other

82
New cards

A Customer knows its Order/butthe Order doesn't know the Customer.What type?

Unidirectional

83
New cards

CarTire cannot exist independently of Car.What relationship?

Composition(filled diamond on Car's side)

84
New cards

ElectricCar extends Car.What relationship?

Generalization(inheritance/is a)

85
New cards

What is multiplicity 1..?

One or more

86
New cards

What is the difference between forward and reverse engineering?

Forward=diagram before code/reverse=diagram drawn from existing code

87
New cards

What is the difference between structure and behavior diagrams?

Structure=static aspects(what is present/architecture)/behavior=dynamic aspects(what happens/functionality)

88
New cards

True or False:Messy code is okay to meet a deadline.You can clean it up later.

False

89
New cards

True or False:Keeping code clean at all times is not a cost effective solution.

False

90
New cards

True or False:Adding more staff can maintain productivity with messy code.

False

91
New cards

True or False:Productivity decreases asymptotically to zero over time with messy code.

True

92
New cards

True or False:Longer names are generally better than shorter names since they can give more context.

False

93
New cards

True or False:Class names should only be nouns.

True

94
New cards

True or False:Solution domain names are preferable to problem domain names to make it easier for the programmer.

False—problem domain names are preferred

95
New cards

True or False:Names should reveal intention.

True

96
New cards

True or False:Most names provide meaningful context in and of themselves.

False

97
New cards

True or False:Use encodings like member prefixes"m_"to distinguish names.

False

98
New cards

True or False:Different classes can use different words for the same concept.

False—be consistent across classes

99
New cards

True or False:Choosing good names requires a shared cultural background.

True

100
New cards

True or False:Names should vary in small ways.

False