1/57
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Value
cannot be simplified further and belongs exclusively to some type
(8 // this is the number 8
"Hello" // this is the string "Hello"
True // this is the Boolean value True)
Types
a defining shape of data, describes a set of valid values which follow a set of restrictions
(Boolean, Int, Char,
String)
Operators
describe computations which can be performed on a set number of values of a given type
(+, -, /, \*,%, &&, ||, ==, <=, >=, !=, !, +)
Expression
a set of values and operators which evaluate to become a single value
(11+ (33/3))
Boolean
represents the logical value true or false
Boolean Operators
NOT (!), AND(&&), OR(||)
(!true, true && true, false || !false && true || false)
Int (integer)
a whole number, who's value is between -2,147,483,648 and 2,147,483,647
uint (unsigned int)
a positive whole number which is a value between 0 and 4,294,967,295.
Addition
Add: (int,int)→int returns the sum of two integers.
Overflow
If the sum exceeds int.MaxValue, int wraps around to int.MinValue
Subtraction
(int,int)→int returns the difference between two integers
Underflow
If the difference is less than int.MinValue, int wraps around to int.MaxValue.
Multiplication
(int,int)→int returns the product of two integers.
Integer Division
(int,int)→int returns the quotient of two integers, discarding any remainder.
Division by Zero
results in a DivideByZeroException
Truncation
The fractional part of the division is discarded.
Modulo
(int,int)→int returns the remainder of a division between two integers.
Remainder
The result is always an integer between 0 (inclusive) and the absolute value of the divisor (exclusive).
Floating-Point Representation
defines a valid range for its whole value, along with a precision which determines what fractionals are possible.
double
a 64-bit floating-point number used to approximate real numbers (range of approximately ±1.7976931348623157E+308 and a precision of 15-16 decimal digits)
float
a 32-bit floating-point number used to approximate real numbers (a range of approximately ±3.4028235E+38 and a precision of 7 decimal digits)
decimal
a 128-bit floating-point number designed for precise representation of decimal fractions (range of approximately ±7.9228162514264337593543950335 and a precision of 28-29 decimal digits)
Comparison
an operation that takes two values and produces a boolean by checking their relationship.
Char
a 16-bit value type representing a single text character with a value between 0 and 65,535.
Character Addition
(char,int)→int returns the numeric result of adding a character's code and an integer
Strings
an indexed immutable collection of characters.
Concatenation
(string,string)→string returns a new string containing all characters from both inputs in order
ToUpper
string→string returns a new string with all characters converted to uppercase
ToLower
string→string returns a new string with all characters converted to lowercase
Length
string→int returns the number of characters in the string
Variable
a reserved space in memory used to store a value of some type
Memory Allocation
Each type declaration gives C# precise instructions
Type Safety
The guarantee that operations will behave consistently based on their types, preventing unexpected bugs and crashes.
State
the set of bindings at a given point of execution
Scope
hold boundaries of code, with a defined start and end, where any new entries to the programs state are cleared once execution crosses the end.
Expression
a set of operators and/or entities which combine to evaluate to a single value
Assignment
Before we assign or bind a value to a variable, the expression is fully evaluated.
If Statements
a branching structure which contains a sequence of scopes with associated conditions. The only scope entered is the first of the sequence whose condition is met.
Loop
a control structure that repeats a block of code while a specified condition remains true. It consists of an initial state, a condition, and an iteration step
Accumulation loop
maintains a running total or result that is updated throughout the execution of the loop. It involves an accumulator, initialized before the loop and a loop that updates the accumulator.
Search loop
continues until either the desired item is found (success case), or we’ve checked everything and confirmed it’s not there (failure case)
Input validation loop
repeatedly prompts for input, checks if the input is valid, and continues only if the input was invalid
Loop state
consists of all variables that control the loop’s execution (loop variables), accumulate results during the loop (accumulators), and track the loop’s progress (flags and counters)
Precondition
what must be true before the loop begins
Postcondition
what must be true after the loop completes
Nested loop
a loop that contains another loop within its body. The inner loop completes all its iterations for each single iteration of the outer loop.
break
immediately exits the loop entirely
continue
skips the rest of the current iteration and moves to the next one
array
an ordered collection of elements which share a type. It has a fixed size which cannot be changed, and each element has an index which it can be accessed with.
Linked List
an ordered collection of nodes where each node contains a value of some type and a reference to the next node. It has a dynamic size which can grow or shrink during execution, and nodes must be accessed sequentially from the first node.
Class
a user-defined type that serves as a blueprint for creating objects, specifying both the data (fields) and operations (methods) that characterize all objects of that type
Object
a specific instance of a class that exists in memory during program execution, with its own unique state and the ability to perform the behaviors defined by its class
Method
a function defined within a class that performs operations related to that class, often accessing or modifying the object’s fields
Constructor
a special method that has the same name as the class and is executed automatically when a new object is created. Its purpose is to initialize the object’s state. They have no return type (not even void) and are called implicitly when using the new keyword.
Encapsulation
the principle of bundling data (fields) and the methods that operate on that data within a single unit (the class), and restricting direct access to some of the object’s components (typically the fields). This principle is implemented by making fields private and providing public methods or properties to access and modify them in a controlled way.
Getters and Setters
Getter methods provide controlled read access to private fields, while setter methods provide controlled write access to private fields, often including validation logic.
Generics
allow you to define classes, interfaces, and methods with placeholder types (type parameters) that are specified only when the generic type or method is actually used. This enables type-safe code reuse across different data types.
Nullable reference types
a C# feature (enabled at the project level or via directives) that changes the default assumption: reference types are considered non-nullable unless explicitly marked otherwise. This helps prevent null reference exceptions by making potential nulls explicit and enabling compiler warnings. Using the ? suffix on a reference type indicates that the variable is allowed to be null.