CSE 2221 OSU Midterm 2

0.0(0)
studied byStudied by 1 person
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/83

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

84 Terms

1
New cards

Kernel Interface Design

The basic, essential methods that a component must have. Think of it as the "minimum toolkit" needed to make the component work.

2
New cards

Constructor

A special method that runs when you create a new object. It sets up the object's starting values.

3
New cards

No-Argument Constructor

A constructor that doesn't need any information passed to it. Example: new NaturalNumber1L() with no parameters.

4
New cards

Copy Constructor

A constructor that creates a duplicate of an existing object. Example: NaturalNumber copy = new NaturalNumber1L(original).

5
New cards

Instance Method

A method you call on a specific object using the dot. Example: myNumber.clear() - clear() is the instance method.

6
New cards

Receiver

The object that a method is being called on. In myNumber.clear(), myNumber is the receiver.

7
New cards

Distinguished Formal Parameter

In method documentation, this represents the object the method is called on (the receiver). Usually shown as "this" in the contract.

8
New cards

Parameter Modes

Tags in Javadoc that tell you what happens to a parameter: does it stay the same, get modified, get replaced, or get cleared?

9
New cards

Default Parameter Mode

When no mode tag is given, we assume the parameter stays unchanged (restores mode).

10
New cards

Primitive Type

Simple data types that hold the actual value directly. Examples: int x = 5, boolean flag = true, char letter = 'A'.

11
New cards

Reference Type

Types that hold a "pointer" to where the actual object lives in memory, not the object itself. Examples: String, NaturalNumber, arrays.

12
New cards

Immutable Reference Type

An object that can't be changed once created. Example: String - when you "change" a String, you actually create a new one.

13
New cards

Mutable Reference Type

An object whose contents can be modified after creation. Example: NaturalNumber can be incremented, arrays can have elements changed.

14
New cards

Reference Diagrams

Drawings that show variables as boxes with arrows pointing to the actual objects in memory. Helps visualize aliasing.

15
New cards

Reference Value

The "address" or "pointer" stored in a reference variable - it tells Java where to find the actual object.

16
New cards

Object Value

The actual data stored inside an object (like the number 42 inside a NaturalNumber object).

17
New cards

Assignment Operator (with Reference Types)

When you write x = y with reference types, you copy the pointer, not the object. Both x and y now point to the same object.

18
New cards

Call-by-Copy (with Reference Types)

When passing objects to methods, Java copies the reference (pointer), so the method can modify the same object.

19
New cards

Garbage Collector

Java's automatic cleanup system that deletes objects no longer being used by any variable.

20
New cards

Aliases / Aliasing of References

When two or more variables point to the exact same object. Change through one variable affects the other.

21
New cards

Arrays (Mutable Reference Type)

A fixed-size container holding multiple elements. Can modify elements after creation. Example: int[] numbers = new int[5].

22
New cards

Scope

Where in your code a variable can be used. Variables declared in a method only exist inside that method.

23
New cards

Repeated Arguments

Passing the same object as multiple parameters to one method. Example: myMethod(x, x, x) where x appears three times.

24
New cards

NaturalNumber

An OSU component representing non-negative whole numbers (0, 1, 2, 3…) with special methods for manipulation.

25
New cards

Standard

An interface that adds extra convenient methods on top of the kernel. Example: Standard might add increment() when kernel only has add().

26
New cards

@restores

Method promise: "I won't change this parameter's value." Input stays exactly the same.

27
New cards

@updates

Method promise: "I might modify this parameter." The value could change.

28
New cards

@replaces

Method promise: "I'll give this parameter a completely new value." Old value is gone.

29
New cards

@clears

Method promise: "I'll reset this parameter to empty/zero." Like hitting the clear button.

30
New cards

== (with Reference Types)

Checks if two variables point to the SAME object in memory. Doesn't check if contents are equal.

31
New cards

equals

Method that checks if two objects have the same contents/value, even if they're different objects in memory.

32
New cards

Arrays.equals

Special method to check if two arrays have the same elements in the same order.

33
New cards

null

A special value meaning "this variable doesn't point to any object." Like an empty parking space.

34
New cards

NullPointerException

Error you get when trying to use a variable that's null. Like trying to open a door that doesn't exist.

35
New cards

Interval Halving / Binary Search

Search method that cuts the search area in half each time. Much faster than checking every item one by one.

36
New cards

Mathematical String Notation

A formal way to write and work with strings using math symbols instead of Java code.

37
New cards

Empty String (Math)

A string with zero characters. Written as "" or ε (epsilon). Length is 0.

38
New cards

Concatenation

Sticking two strings together. "Hello" + "World" = "HelloWorld".

39
New cards

Substring

A piece of a string. "cat" is a substring of "concatenate".

40
New cards

Prefix

A substring that starts at the beginning. "pre" is a prefix of "prefix".

41
New cards

Suffix

A substring that goes to the end. "fix" is a suffix of "suffix".

42
New cards

Substring Notation (Interval Notation)

Math way to write "give me characters from position i to j". Like s[0,3) means first 3 characters.

43
New cards

Permutation

All possible orderings of items. "AB" and "BA" are the two permutations of A and B.

44
New cards

Fast Powering Algorithm

Clever way to calculate powers by squaring repeatedly. To get 2^8, calculate 2^4 then square it, instead of multiplying 2 eight times.

45
New cards

|s|

Math symbol for "length of string s". If s = "hello", then |s| = 5.

46
New cards

rev(s)

Math function that reverses a string. rev("hello") = "olleh".

47
New cards

perms(s1, s2)

Math function that finds all permutations of two strings combined together.

48
New cards

count(s, x)

Math function that counts how many times character x appears in string s.

49
New cards

Recursion / Recursiveness

When a method calls itself to solve a problem by breaking it into smaller versions of the same problem.

50
New cards

Recursive Structure

Data organized like nested Russian dolls - each piece contains smaller pieces of the same type.

51
New cards

Recursive Method

A method that has at least one call to itself inside its own code.

52
New cards

Recursive Design Strategy (FreeLunch)

Strategy where you assume smaller problems are already solved, then just handle combining those solutions.

53
New cards

Confidence-Building Argument

Explanation showing recursion works: prove the base case works, then show if size N works, size N+1 also works.

54
New cards

Size Metric

A number that gets smaller with each recursive call, ensuring the recursion eventually stops at the base case.

55
New cards

Mathematical Induction

Proof method: show it works for the smallest case, then show if it works for N it works for N+1. Therefore it works for all cases.

56
New cards

Recursion on Trees

Using recursion to process tree structures by handling one node, then recursively processing its children.

57
New cards

Inheritance

When one class/interface gets to use all the methods and variables from another class/interface automatically.

58
New cards

Subinterface / Child Interface

An interface that extends another interface, getting all its method requirements plus adding new ones.

59
New cards

Superinterface / Parent Interface

The interface being extended by another interface. It's the "parent" in the relationship.

60
New cards

Subclass / Child Class

A class that extends another class, inheriting all its fields and methods.

61
New cards

Superclass / Parent Class

The class being extended. It's the "parent" that shares its code with child classes.

62
New cards

Overriding

Writing a new version of a method that was inherited from a parent class/interface. Same name and parameters, new code.

63
New cards

Overloading

Having multiple methods with the same name but different parameters in one class. Example: add(int x) and add(double x).

64
New cards

Declared Type / Static Type

The type written in the variable declaration. In "NaturalNumber x = new NaturalNumber1L()", NaturalNumber is the declared type.

65
New cards

Interface Type

A type that only defines what methods must exist, not how they work. Can't create objects directly from an interface.

66
New cards

Instantiation

Creating an actual object using "new". This is when memory is allocated and the constructor runs.

67
New cards

Object Type / Dynamic Type

The actual class of the created object. In "NaturalNumber x = new NaturalNumber1L()", NaturalNumber1L is the object type.

68
New cards

Polymorphism

Using a parent type variable to hold different child type objects. Allows treating different types the same way.

69
New cards

implements

Keyword saying "my class will provide code for all methods in this interface". Class must write all interface methods.

70
New cards

extends

Keyword for inheritance. "class B extends A" means B inherits everything from A. "interface B extends A" means B includes all of A's methods.

71
New cards

super

Keyword to access the parent class. Use super() to call parent constructor or super.method() to call parent's version of a method.

72
New cards

@Override

Annotation that tells Java "I'm intentionally replacing a parent's method." Helps catch typos in method names.

73
New cards

Unit Testing

Testing one small piece of code (like one method) by itself to make sure it works correctly.

74
New cards

Integration Testing

Testing how multiple pieces of code work together after combining them.

75
New cards

System Testing

Testing the entire completed program to make sure everything works together as expected.

76
New cards

Unit Under Test (UUT)

The specific method or component you're currently testing.

77
New cards

Testing Mindset

Thinking like you're trying to break the code. Look for problems and edge cases, not just happy paths.

78
New cards

Test Case

One single test with specific input values, expected output, and instructions for what to check.

79
New cards

Test Plan / Test Fixture

A complete set of test cases designed to thoroughly check if a component works correctly.

80
New cards

Boundary Cases

Tests using extreme values like empty, zero, maximum size, or edges of valid ranges. Often where bugs hide.

81
New cards

Routine Cases

Tests using normal, typical values that represent how the code will usually be used.

82
New cards

Challenging Cases

Tests using complex or tricky inputs that really exercise the logic and might reveal subtle bugs.

83
New cards

JUnit

A Java library that provides tools and structure for writing and running automated tests.

84
New cards

@Test

Annotation marking a method as a JUnit test. JUnit will automatically run all methods with this annotation.