1/44
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
Props vs. State (React)
Props are external data passed in from a parent and are read-only. State is internal data a component manages itself and can change, causing a re-render.
What is OOP?
A programming style that organizes code around objects. Built on 4 principles: Encapsulation, Inheritance, Polymorphism, Abstraction.
Class vs. Object
A class is a template/blueprint. An object is an actual instance created from that template.
Interface vs. Abstract Class
Abstract class: has implemented and unimplemented methods, can hold variables, one per class. Interface: only method signatures, no implementation, a class can implement multiple.
an interface defines a peripheral contract ("what" an object can do), while an abstract class defines an identity blueprint ("what" an object is)
Constructor
A special method that runs automatically when an object is created, used to initialize starting values.
let vs const vs var
var is function-scoped and outdated. let is block-scoped and reassignable. const is block-scoped and cannot be reassigned.
== vs ===
== compares values after converting types if different. === compares both value and type (preferred).
Callback function
A function passed as an argument into another function, to be executed later.
JavaScript vs. Java
Java: statically-typed, compiled, OOP language, mostly backend. JavaScript: dynamically-typed, interpreted, mostly frontend (also backend via Node.js).
id vs. class (CSS)
id is unique, targets one specific element. class can be reused across many elements for shared styling.
CSS Box Model
Content → Padding → Border → Margin (inside out).
Block vs. Inline elements
Block (div, p): full width, starts on new line. Inline (span, a): only as wide as content, sits alongside other elements.
Primary Key vs. Foreign Key
Primary key uniquely identifies each row in its own table. Foreign key is a column referencing a primary key in another table.
SQL JOIN
Combines related rows from two tables based on a shared column, usually a foreign key.
SQL vs. NoSQL
SQL: structured tables, fixed schemas, relationships. NoSQL: flexible, stores data as documents/pairs/graphs.
Why use a relational database instead of one big table?
Reduces duplication, keeps data consistent, more efficient to query/maintain as data grows (normalization).
React Component
A reusable, self-contained piece of UI in React, like a function that returns HTML.
What happens when you type a URL and hit enter?
Browser looks up the domain's IP address, opens a connection to the server, sends an HTTP request, server processes and sends back a response, browser renders the page.
Frontend vs. Backend
Frontend: everything the user directly sees/interacts with. Backend: server-side logic, database, and APIs the frontend communicates with.
What is an API?
A set of rules that allows different software applications to communicate and exchange data with one another, e.g. an app's frontend requesting data from an API and getting a structured response.
Stack vs. Queue
Stack: LIFO (Last In, First Out), like a stack of plates. Queue: FIFO (First In, First Out), like a line at a store.
Version Control
A system (e.g. Git) that tracks changes to code over time, enabling collaboration without overwriting work and the ability to revert mistakes.
Reverse a string (JavaScript)
str.split("").reverse().join("") — splits into characters, reverses the order, joins back into a string.
or general approach:
Place one pointer (left) at the start of the string (index 0) and another pointer (right) at the very end (length - 1). Swap the characters at these two pointers, then move left forward and right backward. Repeat until the pointers meet or cross in the middle.
Compiled vs. Interpreted languages
Compiled: translated to machine code before running (e.g. Java, C), errors caught at compile time. Interpreted: run line-by-line at runtime (e.g. JavaScript, Python).
How would you handle code that isn't working?
Check error messages/logs to isolate the issue, re-read the code carefully, check documentation, and ask a teammate for a second pair of eyes if still stuck.
HTTP GET vs. POST
GET: retrieves data, sent via URL, doesn't change anything on the server. POST: sends data to create/update something, sent via request body.
How would you optimize slow-running code?
Identify the actual bottleneck first (don't guess), look for repeated/unnecessary work (e.g. a DB call inside a loop), consider more efficient data structures or algorithms.
Responsive Design
Designing a site to look/function well across screen sizes, using flexible layouts (Flexbox/Grid), relative units, and media queries.
Check for Empty Array: Ensure the array contains at least one element to avoid errors.
Initialize Trackers: Initialize two variables, largest and smallest. Set both of them equal to the first element of the array (array[0]).
Crucial Tip: Do not initialize them to 0. If your array contains only negative numbers, initialization to 0 will yield an incorrect result. [1, 2, 3]
Loop Through the Array: Iterate through the rest of the array starting from the second element (index 1). [1, 2]
Compare and Update: For every element in the loop:
If the current element is greater than largest, update largest to this element.
If the current element is less than smallest, update smallest to this element. [1] O(n) time.
Initialize Sum: Create a variable named sum and set it to 0.
Get Count: Find the total number of elements in the array (length or size).
Loop Through Array: Go through each item in the array one by one.
Accumulate: Add each item's value to the sum variable.
Calculate Average: Divide the final sum by the total count of elements.
Check Empty Arrays: Make sure the array is not empty before dividing to prevent a crash or a NaN (Not a Number) result. O(n) time.
Use a built-in sort (e.g. .sort() in JS) for practical purposes. Conceptually, common algorithms include bubble sort (simple, O(n²)) and merge sort (efficient, O(n log n)).
|
BUBBLE: You iterate through the array and compare adjacent elements side by side. If they are in the wrong order, you swap them. This process causes the largest elements to "bubble up" to the end of the array with each pass