In C, do you need to declare both values when declaring and initializing a new 2-dimensional array?

No. The first value [x] can be assumed by the compiler based on the initialized rows but the second value [y] MUST be declared.

In C, can Arrays be more than one type of variable?

No, because Arrays are implemented as a sequence of values in the computer's memory.

In C, how do you declare a string using pointer notation?

char * name = "your name"

In C, how do you declare a string that can be manipulated?

You declare it by calling char name[] = 'your name';. (declaring it as char * name = 'your name'; makes it read-only.)

Why are strings saved in memory as the length of the text plus 1?

Since the program doesn't know the length of the string (only the compiler), a special character /0 (null terminator) is added to the end to terminate the string.

In C, how can you insert a string placeholder using the printf function?

By using %s - for example printf("My name is %s", name)

In C, how can you insert an integer placeholder using the printf function?

By using %d - for example printf("He is %d years old", age)

In C, how do you compare 2 strings?

Using strncmp - for example if (strncmp("string", "string", 6) == 0).

In C, how do you concatenate 2 strings?

Using strncat - for example strncat("string 1", "string 2", n);

In C, what library do you need to include in order to have access to the strncmp and strncat functions?


In C, how many values can functions return?

One value or no values

In C, how do you declare a function that does not return a function?

Declare it with the keyword 'void'

In C, which keyword is used to set the scope of a variable and function to the file level?

Static. By default, variables are local only to the scope in which they are defined, and functions are global.

In C, what is a pointer?

A pointer is essentially a simple integer variable which holds a memory address that points to a value, instead of holding the actual value itself. (char * name = 'your name';)

In C, what 3 things does this line accomplish: 'char * name = 'John';'

Allocates a local (stack) variable named name (which is a pointer to a single character), causes the string 'John' to appear somewhere in the program memory (after compilation), and initializes the name argument to point to where the J character resides at (which is followed by the rest of the string in the memory).

In C, what is the act of referring to where the pointer points?

Dereferencing. Example: int * pointer_to_a = &a; (use as *pointer_to_a)

In C, what is a linked list?

A linked list is a set of dynamically allocated nodes, arranged in such a way that each node contains one value and one pointer. The pointer always points to the next member of the list. If the pointer is NULL, then it is the last node in the list.

In C, what are the advantages of a linked list?

Items can be added or removed from the middle of the list and there is no need to define an initial size

In C, what are the disadvantages of a linked list?

There is no 'random' access - it is impossible to reach the nth item in the array without first iterating over all items up until that item. This means we have to start from the beginning of the list and count how many times we advance in the list until we get to the desired item. Dynamic memory allocation and pointers are required, which complicates the code and increases the risk of memory leaks and segment faults. Linked lists have a much larger overhead over arrays, since linked list items are dynamically allocated (which is less efficient in memory usage) and each item in the list also must store an additional pointer.

What is a binary tree?

A type of data structure in which each node has at most two children (left child and right child). Binary trees are used to implement binary search trees and binary heaps, and are used for efficient searching and sorting.

In binary trees, what is depth-first search (DFS)?

An algorithm for traversing or searching tree or graph data structures. One starts at the root and explores as far as possible along each branch before backtracking. There are three types of depth first search traversal: pre-order visit, left, right, in-order left, visit, right, post-order left, right, visit.

In binary trees, what is breadth-first search (BFS)?

An algorithm for traversing or searching tree or graph structures. In level-order, where we visit every node on a level before going to a lower level.

In C, what are the advantages of dynamic allocation?

It helps us to dynamically store data without initially knowing the size of the data in the time we wrote the program.

In C, how do we dynamically allocate memory and then release that memory?

'person * myperson = malloc(sizeof(person));' and then 'free(myperson);' when finished.

What is the mathematical brain of a computer?

Arithmetic and Logic Unit (ALU)

What are the 3 fundamental operations in boolean algebra?

'Not', 'and' and 'or'

In boolean algebra, what flips a true value to false and a false value to true?

A 'not' operation

What is a transistor?

A semiconductor device used to amplify or switch electrical signals made up of a source, a sink and a gate.

What is the standard way in which humans represent numbers?

Base-10 or decimal notation

What is the standard way in which computers recognize numbers?

Base-2 or binary notation

What is the highest number that can be represented in 8 bits (1 byte)?

255 (11111111)

How do you represent negative numbers in binary?

By putting a '1' as the first bit.

What standard was created to represent letters and characters with binary code?

ASCII (American Standard Code for Information Interchange)

What was the first universal encoding scheme?


Explain the 2 parts of an ALU

The arithmetic unit performs all numerical operations and the logic unit performs logical operations like AND, OR, NOT, XOR and many others.

In memory, what is a latch?

When a circuit latches onto a particular, 1-bit output value and stays that way. (Part of SRAM - Static Random Access Memory.)

In memory, what's a 'register'?

A group of latches which hold a single number (the number of bits includes is its 'width').

In memory, what is a larger register referred to as?

A matrix - a grid of latches that require fewer data wires, write-enabled wires and read-enabled wires.

Explain RAM

Random access memory - the process of storing information in memory that can be retrieved directly at any point in time.

What is the heart of a computer?

The CPU (Central Processing Unit). It is used to execute programs.

What are the components of a CPU?

RAM, memory registers for temporary storage and manipulation, the control unit encompassing an instruction address register to keep track of where we are in a program (stores memory address of current insturction) and an instruction register to store the current instruction, the ALU, and the clock to advance the program.

What are the phases of a CPU's operation?

Fetch (to receive our first instruction), Decode (instructions are decoded and interpreted by a control unit made of logic gates), Execute (read enables the value in memory, sends it to register A and increments the instruction address register by 1).

What is the clock speed?

In the CPU, the clock speed measures how fast the CPU can carry out each fetch-decode-execute cycle measures in Hertz (1 hertz = 1 cycle per second)

What is the term for speeding up or slowing down a CPU's clock speed?

Dynamic frequency scaling. Speeding up can help with running a large program more smoothly and slowing down can save battery power.

In RAM, for each byte of data, what do the first 4 and then last 4 digits specify?

The first 4 digits specify the operation code (opcode) and the last 4 digits specify an address or registers.

What's it called to have bigger CPU instructions with more bits?

Instruction Length (32-64 bits)

What is instruction set architecture (ISA)?

The interface between the computer's software and hardware. Its implementations can vary in performance, physical size, and monetary cost.

What is the list of operations that a CPU follows?

The instruction set. (The Intel 4004 had 36 instructions which were enough to run a computer.)

What are the data wires connecting the CPU to the RAM?

a bus

What is a little piece of ram located on the CPU?

A cache. Caches allow for the speeding up of a program by allowing the RAM to transfer entire blocks of data directly to the CPU.

What is it called with the CPU draws from data already stored in its cache?

A cache hit. (A cache miss is when the CPU has to go back to the RAM for data.)

What's it called when the data stored in memory is different from the data stored in the CPU's cache?

A dirty bit.

What is instruction pipelining?

When the CPU parallelizes the fetch-decode-execute operations (overlapping the operations when freed).

What is speculative execution?

When a CPU guesses which branch to add its instructions to the CPU's pipeline.

If a CPU performs an incorrect speculative execution, what is the process for correction?

A pipeline flush. When a CPU has to dump all of its instructions and start over.

What benefit do multi-core processors provide?

Allows the CPU to run several streams of instructions at once.

What was one of the most famous examples of early programming?

Joseph Marie Jacquard developing a programmable textile loom (punch cards).

What is the language that computers speak?

Machine language (or machine code).

What is the writing of computer code in everyday language?


What is the job of an assembler?

To read a program written in Assembly language to native machine code. (very low-level - assembly languages have a 1-to-1 mapping to machine instructions)

Who built the first compiler?

Dr. Grace Hopper (Called A-0 in 1952)

What is the job of a compiler?

To transform programming source code into a low-level language like binary or machine code.

What compiler was built shortly after A-0 by IBM?

FORTRAN (Formula Translation) by John Backus in 1957.

What was the first common programming language that could be used by multiple different machines?

Common Business-Oriented Language (COBOL) led by Dr. Grace Hopper in 1959. Allowed programmers to "write once, enable anywhere" and opened the subject of programming to more than just computer experts.

What is the set of rules that govern the structure and composition of statements in a language?


What is the statement that assigns a value to a variable?

Assignment statement (a = 5)

What does it mean to set initial values for variables upon declaration?


What are examples of Control Flow Statements?

If statements, if-else statements

What type of statements are if-expression-then-endif statements?

Conditional statements

What are packages of code called?

Functions (or Methods or Subroutines)

What is it called to send a value back to the program from a function?

A return statement

What is the benefit of breaking code into many functions?

Called modularization, functions allow programmers to write entire apps and allow teams to work efficiently on bigger projects.

What are bundles of pre-written functions available in most programming languages?


What is an algorithm?

A list of specific steps used to complete a computation. (performance vs memory/storage determines success)

What is Big-O Notation?

How well an algorithm scales in reference to the size of its data. The O-notation formulas measure worst-case time.

What is a brute-force approach?

Trying every available path/algorithm to see which is fastest. Equal to O(n!) meaning n * n-1 * n-2 etc.

What is Dijkstra's Algorithm?

In graph search, it loops though each available node from the original starting point and retains the lowest value (or shortest route). Equal to O(n-squared)

What is a series of values stored in memory?

An Array

What is another term for an array or arrays?

A matrix

What is a linked-list?

A flexible data structure that can store many nodes of data.

What are examples of linked-lists?

Ques (first-in, first-out), stacks (last-in, first-out)

What are nodes?

In linked-lists, nodes are structs containing both values and pointers.

What are trees?

structs containing values and 2 pointers (parent nodes have children and leaf nodes have no children)

Who is known as 'The Father of Computer Science'?

Alan Turing

What is the Church-Turing Thesis?

The combined efforts that proved the limits of computation and formulize computability. (example, determining if a program or algorithm would loop forever)

What is the Turing Test?

Determining whether or not a computer could deceive a human into believing that it was human. (modern-day CAPTCHA)

Who coined the term 'software engineering'?

Margaret Hamilton

What is object oriented programming?

Refers to a type of programming in which programmers define not only the data type of a data structure, but also the types of functions that can be applied to the data structure.

What is an API?

Application Programming Interface - A set of functions and procedures allowing the creation of applications that access the features or data of an operating system or application.

What are IDEs?

Integrated Development Environment - A software application that provides comprehensive facilities to programmers for software development. An IDE normally consists of at least a source code editor, build automation tools, and a debugger.

What were the individual parts (vacuum tubes, resistors, capacitors, diodes) of electronic computing referred to as?

Discrete components

What are integrated circuits?

ICs, putting many computer components inside of new, single components

Who is the father of modern ICs (integrated circuits)?

Robert Noyce, and he started making them with silicon.

What were the benefits of printed circuit boards (PCBs) upon invention?

Didn't require soldering and bundling of billions of wires and could be mass produced. Using PCBs with ICs were smaller, cheaper and more reliable.

What is the fabrication process of an integrated circuit?

Semiconductor lithography (photolithography)

Who determined that approximately every 2 years, thanks to advances in materials and manufacturing, you could fit twice the number of transistors into the same amount of space?

Gordon Moore (Moore's Law)

What are external devices connected to a computer called?


What do operating systems provide as intermediary APIs between software programs and hardware peripherals?

Device drivers

What is the benefit of virtual memory?

As the operating system stores memory for each program, it assumes that the program's block of memory starts at position 0 instead of dedicating it's own entire physical block of memory taking up sometimes unnecessary space.

What is dynamic memory allocation?

As a result of virtual memory, it allows programs to have flexible memory sizes that appear to be single continuous blocks even when they're not. Simplifies the process for OSs trying to run multiple programs simultaneously.

What is the benefit of each program having their own block of allocated memory?

Memory Protection - if one program is buggy it won't affect the memory belonging to other programs.

What is a terminal?

A keyboard and screen that connects to a big computer but doesn't contain any processing power itself.

What is time-sharing?

Each individual user of a computer was allowed to use only a small fraction of a computer's memory and other resources.

What is a kernel?

The operating systems core functionality (e.g. memory management, multitasking, dealing with I/O).

What is non-permanent memory also called?

Volatile memory

What is the time that it takes for a computer to access any block of data?

Seek time

What are solid state technologies?

Technology with no moving parts (e.g. SSD - solid state drives, opposed to CDs).

What determines how the data inside a file is organized?

File format

What character encoding standard do TXT files use?


What is data about data called?


In a picture, what does each individual pixel consist of?

Red, green and blue colors

What keeps tracks of file information inside of a computer (including when each file begins in storage and how long they are)?

Directory File

What is it called when files get broken up across storage?

Fragmentation (Defragmentation is reording the file's storage to be sequential)

What is 'run-length encoding'?

In an image file, it takes all sequential pixels of the same RGB value, adds a bit at the beginning specifying how long the run is and then removes all duplicate pixels.

What is compression that doesn't cause any quality or information loss?

Lossless compression

What is a Huffman Tree?

A compression algorithm that groups code blocks by frequency. (A type of dictionary coder)

What is lossy compression?

Changing some of the file's data upon compression but only that which is nearly undetectable by humans. (Perceptual Coding)

In video files, what is it called when certain elements (like a background) remain largely the same frame-by-frame and therefore don't need to be retransmitted?

Temporal redundancy (Inter-frame Simularity)

What is a portion of the computer's memory reserved for the screen's character generator called?

Screen Buffer

What was the first commercially successful computer?

Univac 1 in the 1950s

What was one of the most influential factors bringing about personal computers?

Single-chip CPUs (powerful yet small and inexpensive)

What was the first commercially successful personal computer?

Altair 8800 released in 1975

What is an interpreter?

Similar to a compiler but runs as the program runs instead of beforehand

When did the first Apple computer launch?

1976 called the Apple 1 by Steve Wozniack and Steve Jobs (sold as a kit)

What personal computers were sold in 1977 that were offered as ready out-of-the-box?

Apple 2, TRS-80 Model 1 (Radio Shack), Commodore Pet 2001 (The 1977 Trinity)

When was Macintosh first released?

1984. It was the first computer with a GUI.

What is a GUI?

A visual way of interacting with a computer using items such as windows, icons, and menus.

What is a WIMP Interface?

A GUI with windows, icons, menus, and a pointer. (first introduced by the Xerox Alto)

What is event-driven programming?

Used by GUIs to fire code at any time in any order in response to events.

What is the process of flattening 3D coordinates onto a 2D plane?

3D Projection

Triangles used in 3D objects are called what?


What is Anti-Aliasing?

In computer graphics, when the polygon grazes a pixel, only the pixels fully contained inside the polygon are fully-filled while the grazed pixels are only partially filled.

What is latency?

The time it takes for a message to transfer.

What are relatively small networks of close-by computers called?

Local Area Networks (LANs)

What is a popular LAN connection using a connected cable?

Ethernet (each computer connected to a shared cable via a personal MAC address)

What is the rate at which a carrier can transmit data?


What is 'Exponential Backoff'?

In networking, EB occurs when multiple computers try to transmit data at the same time. When a collision occurs, the computers wait exponentially more time before trying again.

What is 'Circuit Switching'?

In networking, when whole circuits are switched to route traffic to the correct destination. (Because of the potential for having to wait for busy or in-use circuits, many large companies and governments have their own dedicated circuits.)

What is 'Message Switching'?

In networking, when computers are connected via multiple stops (like the postal service). This is fault-tolerant because if one stop is down the connection can be rerouted.

What is the 'Hop Count'?

In networking, the number of hops a message takes along it's route.

What is 'Packet Switching'?

In networking, when a message is broken apart into several packets of data with their own destination addresses. It's very efficient and fault-tolerant and how the internet works today.

What is the process your computer follows to connected to the internet via network?

LAN -> Local WAN (Wide Area Network run by the Internet Service Provider [ISP]) -> Regional WAN -> Other possible WANs

What is 'Internet Protocol' (IP)?

A set of standards that must be followed to transmit messages online (includes the destination address).

What is 'User Datagram Protocol' (UDP)?

An internet protocol that sets on top of IP which includes a port number (to make sure the messages gets to the correct program) and checksum (for message validation). Can be faulty.

What is 'Transmission Control Protocol' (TCP)?

An internet protocol on top of IP that ensures the data reaches its destination and in order. Also sends an acknowledgement back to the sender. If no acknowledgement is sent after a time the sender will automatically retransmit. Can lead to more network delays due to double the amount of messages being transmitted.

What is 'Domain Name System' (DNS)?

The mapping of domain names to IP addresses. When a domain name is entered in a browser and sent, DNS looks for the proper IP address for which to send the request and then returns it to the browser.

What are the 7 layers of the OSI (Open System Interconnection)?

Physical layer, data link layer, network layer, transport layer, session layer, presentation layer, application layer

What is URL short for?

Uniform Resource Locator

What is HTML short for?

Hypertext Markup Language

What would it mean for data to get 'throttled'?

Intentionally given less bandwidth and lower priority by ISPs (Net Neutrality)

In cybersecurity, what does 'integrity' mean?

Only authorized people should have the ability to use or modify systems and data.

In cybersecurity, what does 'availability' mean?

Authorized people should always have access to their systems and data

In cybersecurity, what is a 'threat model'?

When security experts attempt to determine 'who' the enemy is. They let you prepare against specific threats.

In cybersecurity, what is an 'attack vector'?

The attacker's capabilities, goals and means of attack.

What 2 main questions does security boil down to?

Who are you and what should you have access to?

How does the computer differentiate between the right and wrong people?

Authentication. What you know (based on knowledge of a secret/password), what you have (physical key and lock) and who you are (biometric sensors).

What is a 'brute force attack'?

When there's nothing clever to the attack than just trying every possible combination of numbers or letters.

What is 'multi-factor authentication'?

When the computer requires more than one type of authentication.

What is 'Access Control'?

After authentication, access control determines what you have access to (Permissions or Access Control Lists - ACL).

What are the 3 types of permissions?

Read, write and execute

What is the 'no read up, no write down' approach in cybersecurity?

Bell-LaPadula Model

Where do most security errors come from?

Implementation error

What is the process of having code audited by a crowd of security experts?

Independent Verification and Validation

In cybersecurity, what is 'isolation'?

For example, when computers store program's memory in their own blocks.

What are 'good' hackers called?

White Hats (as opposed to Black Hats)

What is it called when hackers trick users into letting them in?

Social engineering

What is 'phishing'?

When hackers include a link in an email that sends users to a mirror website where personal credentials are entered.

What is 'pretexting'?

When hackers pretend to be from a company's IT department.

What is a 'Trojan Horse'?

When an email attachment appears harmless but actually contains malicious software (malware).

What is a 'buffer overflow'?

When a hacker overflows the allocated block in memory (i.e. putting excessive input inside of an input field).

How can 'buffer overflow' be prevented?

By 'bounds checking' or verifying the length of the input prior to saving it in memory.

What is 'code injection'?

Used by hackers upon data input to alter database queries.

What does it mean to 'sanitize' data?

Upon receiving new data, the server removes or modifies any special characters from the input.

What is it called when a new exploitable bug is discovered that software creators weren't of?

Zero day vulnerability

What are 'worms'?

When hackers write programs that can jump from computer to computer automatically.

What is a 'botnet'?

When a hacker takes over a large number of computers that can be used together (for sending DDoS attacks against servers, large amounts of spam, etc).

What is a 'DDoS Attack'?

When all computers in a botnet send a flood of dummy messages to knock servers offline or force owners to pay a ransom.

What is 'Defense in Depth'?

When system architects deploy a defense strategy against hackers containing multiple layers.

What is the process of making text a secret?

Encryption (as opposed to decryption)

What was one of the earliest software ciphers to become widespread?

Data Encryption Standard (1977)

How does the 'Advanced Encryption Standard' work?

It chops data into 16-byte blocks and then applies a series of substitutions and permutations based on key value, plus other operations to obscure the message. This process is repeated 10 or more times. (used today by phones and websites - https, a form of 'Public Key Cryptography')

What is a 'Key Exchange'?

An algorithm that lets 2 computers agree on a cipher key without ever sending it via one-way functions (i.e. Diffie-Hellman Key Exchange)

What is the 'Diffie-Hellman Key Exchange'?

A one-way function using modular exponentiation (B(x) mod M). The base (B) and modulas (M) are publicly known but the exponent (x) is a secret.

What is 'machine learning'?

Algorithms that give computers the ability to learn from data and then make predictions and decisions (i.e. is this email spam?).

What is a 'classification'?

When we decide if a moth is a lunar moth or an emperor moth, for example (algorithms that do this are called classifiers - reducing the complexities of real-world objects into features like wingspan and mass).

How do machine-learning algorithms use 'features'?

By collecting data on real-world objects and determining decision boundaries based on maximizing correctness (incorrectness is called 'confusion matrix').

In machine-learning, what's it called when we divide up decisions into boxes?

A 'Decision Tree' (if wingspan > 10 and mass > 5)

What are 2 common machine-learning techniques?

'Decision Trees' and 'Support Vector Machines' (based in statistics)

What are 'Artificial Neural Networks'?

Machine-learning algorithms that use neural nets (using weighting, summing, biasing and applying an activation function to inputted integer values). Can be multiple layers referred to as 'deep learning'.

What is artificial intelligence that is only good at specific tasks?

'Weak AI' or 'Narrow AI'

What would human-level artificial intelligence be referred to as?

'Strong AI'

What is 'Reinforcement Learning'?

Learning tasks through continuous repetition (like how humans learn).

What is 'Computer Vision'?

The goal of giving computers the ability to extract high-level understanding from digital images and videos.

What is a 'kernel'?

A grid containing the values for a pixel-wise multiplication, the sum of which is saved into the center pixel (used in 'Computer Vision').

What are edge-enhancing kernels called?

'Prewitt Operators' (kernels that are able to perform image transformations). Can be used to determine a person's nose, eyes or other features where light and dark contrast in predictable patterns when multiple kernels are used together.

What are 'Convulational Neural Networks'?

Using neural networks to run images through layers assigned to detect different things (e.g. edges, shapes, then mouths/eyebrows) and then combined.

What is 'Natural Language Processing'?

An interdisciplinary field combining computer science and linguistics (NLP).

What rules were developed to encapsulate the grammar of a language for computers?

'Phrase Structure Rules' - declaring different types of word combinations as viable sentences (i.e. a noun phrase followed by a verb phrase).

What is a 'parse tree'?

Breaking down a sentence into smaller chunks of data (e.g. nouns, verbs).

What is a 'Negative Feedback Loop'?

Used in robotics to sense, control and perform actions in the real world.

What is a 'Proportional-Integral-Derivative Controller'?

A widely used program that calculates the desired value (speed) to the actual value, the sum of error in the ratio, and potential future error.

What are 'Androids'?

Robots that look and act like humans.

What are robots with the intelligence and capability to take human lives?

'Lethal Autonomous Weapons'

What is 'usability'?

The degree to which a human-made artifact can be used to achieve an objective effectively and efficiently.

What does it mean for data to be 'chunked'?

When it's put together in small, meaningful groups. Humans can read, remember and process information more effectively this way (i.e. telephone numbers).

What are 'affordances'?

Affordances provide strong clues to the operations of things (door plates are for pushing, knobs are for turning, slots are for inserting things into). No additional instructions needed. Broken affordances are when pulling on a door handle when it actually needs to be pushed.

What is 'knurling'?

Texture added to objects to improve grip and show you where to best grab them (like a window's scroll bar).

Should interfaces offer multiple paths to accomplish goals?

Yes, to leverage expertise - when users gain experience with interfaces they get faster and build mental models of how to do things efficiently (i.e. copy & paste links cater to beginners and keyboard shortcuts cater to experts).

What is 'affect' in computer psychology?

When a computer adapts its behavior to respond appropriately to a user's emotional state.

What is 'computer-mediated communication (CMC)'?

Includes synchronous communication like video calls and asynchronous communication like tweets, emails and texts and studies the use of things like emoticons and language used in different channels. One finding is that people are usually more willing to reveal personal information to a computer than when in a face-to-face interaction.

What is 'augmented gaze'?

Computer vision and graphics software that can warp the head and eyes making it appear as though someone is looking into the camera rather than down at the screen (i.e. video conferencing and webcams).

In robotics, what is the dip in realism between almost-human and actually-human called?

The 'uncanny valley'

What is 'ubiquitous computing'?

Having computer involvement in every aspect of our lives.

What is 'singularity'?

Rapid technological growth especially with respect to intelligence.

What is a 'complexity brake'?

The levelling-off of progress in computer growth (particularly with respect to intelligence). As complexity increases, it becomes more difficult to make additional progress.

What is it called when a job sector is rendered obsolete by computers (such as AI and robots)?

Technological Unemployment

What is the term for when humans and technology merge?


What does it mean for an algorithm to run in 'linear time'?

That would be equal to O(n). The time required to run the algorithm would be directly proportional to the size of the data (as the data size doubles, so does the time required for the algorithm to run). An example of this would be searching for a value within an array by incrementing.

What is 'asymptotic complexity' or when an algorithm runs in 'constant time'?

Equal to O(1). The time required to run an algorithm would not be altered by the size of the data (potential downfalls could be memory or storage loss).

What does it mean for an algorithm to run in 'logarithmic time'?

Equal to O(log n)Finding an element in an already-sorted list of elements (i.e. binary search - starting with the middle element then looking left or right and continuing).

What is 'order of growth'?

For algorithms, it refers to how the time for computation increases when the input size is increased (important with larger input sizes). With larger input sizes, it's important to focus on the dominating terms (i.e. 100n vs n-squared).

What is 'asymptotic behavior'?

Regarding algorithms, it's when we drop other minor factors and focus on the largest growing term when considering performance. In f(n) = n, we're interested in the limit of function f as n tends to infinity.

What is 'recursion'?

The method of solving a problem where the solution depends on solutions to smaller instances of the same problem (as opposed to iteration). A recursive function is a function that calls itself.

What are 'profilers'?

Tools that measure the running time of programs and help to identify bottlenecks.

What is 'worst-case analysis'?

When attempting to put a run-time value on an algorithm, we always assume the worst case scenario (the most instructions/actions needed).

What would our time-based formula be if our program had a constant number of instructions?

f(n) = 1

What would be a real-life program example of f(n) = n-exponential 2?

When a program has a loop within a loop. A loop within a loop within a loop would yield f(n) = n-exponential 3

What symbol do we use when we've determined the value of 'f' asymptotically?

Θ(n) or 'theta of n'. For example, this is a true mathematical statement: n6 + 3n ∈ Θ(n6) - is theta of n to the 6. This is also known as the 'complexity' or 'time complexity' of the algorithm.

What are the 4 common algorithm 'time complexities' called?

Θ(1) is constant-time, Θ(n) is linear, Θ(n2) is quadratic and Θ(log(n)) is logarithmic.

What is the difference between 'theta of n' and 'big O of n'?

Theta simplifies the instruction set focusing on the one, highest-variable element where 'Big O' focuses on the finding the worst case scenario. O-complexity gives the 'upper bound' while theta gives us the 'tight bound' (the actual complexity).

How can complexities between theta and Big-O be considered 'tight'?

When the 2 complexities register approximately the same. (theta of n and big-O of n or theta of n and big-O of 2n). Complexities that are not considered tight can be referred to as small-o - 'small-o of n'.

What does 'big omega' tell us (i.e. 'big omega of n')?

It gives us the complexity that we know our program won't be better than (the best-case scenario - the 'lower bound'). This is good when trying to prove how poor an algorithm is. Symbol: Ω

When would we need to refer to 'small omega' (i.e. 'small omega of n')?

When the lower bound of 'big omega' can't be considered 'tight'. Symbol: ω

What are the comparable mathematical symbols for the common asymptotic comparisons?

small-o would be <, big-O would be <=, theta would be =, big-omega would be >=, small-omega would be > (as in, a number is < something or other comparisons).

What do 'logarithmic' operations do to a number?

They make the number much smaller than the original (the inverse operation of exponentiating something). In computer science, base-2 logarithms are the most common (having 2 values). Example: log(32) = 5.

What is it called when an algorithm solves a problem in the best possible way?

An 'optimal algorithm'.

In arrays, what is 'row major' ordering?

Ordering all of the array elements in a given row before continuing to the next row (e.g. 1,1 1,2 1,3 1,4 1,5 2,1 2,2 ...).

In arrays, what is 'column major' ordering?

Ordering all of the array elements in a given column before continuing to the next column (e.g. 1,1 2,1 3,1 1,2 2,2 3,2 1,3 ...).

In arrays, what is the time formula for adding and subtracting an element to the end of an array?

O(1) - order of 1 (constant time).

In arrays, what is the time formula for adding and subtracting an element to the beginning of an array?

O(n) - order of n (linear time). Each subsequent element in the array would need to be reordered. Expensive.

In arrays, what is the time formula for adding and subtracting an element to the middle of an array?

O(n) - order of n (linear time). Each subsequent element in the array would need to be reordered. Expensive.

What is the primary benefit of arrays?

Arrays provide constant-time access to its elements - reading or writing.

What are arrays?

Arrays are a contiguous area of memory consisting of equal-size elements indexed by contiguous integers.

In linked-lists, what is the time formula for PushFront() and PopFront()?

O(1) - order of 1 (constant time). A new node is created then pointed to the original first node and the head is updated to point to the new node.

In linked-lists, what is the time formula for PushBack() and PopBack()?

O(n) - order of n (linear time). A new node is created then the linked-list is iterated over to find the final node which then creates a tail pointer and points to the new node (unless a tail element has already been created which would then allow for O(1) time).

What is a doubly-linked list?

A linked list that has 2 pointers, a head and a tail. Each node contains 3 pieces of data - the value, a pointer following the path of the head (next) and a pointer following the path of the tail (previous).

What are the benefits of linked lists?

It is O(1) to insert or remove from both the front and the back, list items don't need to be contiguous, and, with doubly-linked lists, O(1) to insert or remove between nodes.

What is a stack data type?

An abstract data type with the following operations (Push, Pop, Top, Empty). They are like a stack of books - can't get to the bottom without removing all of the other books. LIFO.

What are a couple of common use cases for the stack data type?

Checking whether or not a string is balanced (i.e. '()[]') and in compilers.

How do you implement a stack data type?

By allocating an array with a maximum size and then pushing elements into the array (potential wasted space and max size) or by creating a linked list and then pushing elements into the list (no maximum size but increased overhead needing to store the pointer in addition to the value).

What is the primary benefit of the stack data type?

Each stack operation (Push, Pop, Top, Empty) is an O(1) - order of one or constant time - operation.

What is a queue data type?

An abstract data type with the following operations (Enqueue - adds, Key Dequeue - removes and returns least recently-added - FIFO, Empty).

How do you implement a queue data type?

With a linked list - use enqueue to push new values to end of list, or with an array (enqueue and dequeue wrap around an array with a set maximum size).

What is a tree data structure?

A structure that is either empty or is a node with a key and a list of child nodes/trees. It starts with a root (top node), then children/parents, then ancestors/descendants/siblings.

How do you determine the height of a tree data structure?

It is the maximum depth of a subtree node and the farthest leaf (the root's [or specific elements] farthest descendants).

How many children can a binary tree node contain?

2 - one to the left and one to the right.

How do we walk a tree data structure?

Depth-first - completely traversing a sub-tree before exploring a sibling tree (pre-order, in-order, post-order), breadth-first - traversing all nodes at one level (siblings) before progressing to the next level (children).

What are dynamic arrays?

Arrays that can change size by storing a pointer to an array and then creating a new array (and updating the pointer) when the array size increases. Also called resizable arrays. Implemented by storing the array, the capacity of the array, and the size of the array.

What is amortized cost?

Cost(n operations) / n or the average cost of the operation rather than the worst-case cost.

What is the aggregate method of amortized analysis?

When we look at the efficiency of a program through the lense of amortized cost and getting the brute-force sum.

What is the Banker's Method of amortized analysis?

When we charge extra for each cheap operation and then save the extra charges as tokens in our data structure to use to pay for the expensive operations (i.e. saving $100 month to buy a car). Tokens used only for mental calculation.

What is the Physicist's Method of amortized analysis?

When we define a potential function which maps states of the data structure to integers.

What is a Priority Queue data structure?

A queue without a beginning or an end but with each element having been assigned a priority at which elements are returned. Use case: scheduling jobs. Supports insert and extractMax.

What is a binary max-heap?

A binary tree where each parent >= value of the child. You add new nodes by attaching them to a leaf by sifting up (swapping elements) until all parents are greater than their children. You extract the max (root) by swapping its value with any leaf and then sifting down (swapping) until the tree is no longer in violation. Running time O(tree height).

What is tree data structure union by rank heuristic?

When combining 2 disjoint sets, it refers to hanging the shorter of the trees under the taller one.

What is 'direct addressing' in hashing?

The simplest form of hashing - storing all possible values in an array (i.e. phone numbers in a phone book). Not realistic - requires way too much memory.

What is a 'hash function'?

A function that maps a set of objects from 0 to a given value. Should be fast to compute, small probability of collision, allow for direct addressing with O(m).

In hashing, what is a collision?

When 2 items have the same value as the hash function.

What is 'chaining' in 'hashing'?

When you leverage mapping in hashing values.

In hashing, what is a 'map'?

A mapping from a set of objects to a set of values. Has values 'hasKey', 'get', 'set'. The objects are usually referred to as keys and values are values.

What is 'cardinality' in hashing?

The size of the hash set.

What is a 'hash table'?

An implementation of a Set or a Map using hashing.

What is a 'blockchain'?

A distributed diary that is difficult to forge by leveraging hashing. It also uses binary trees to improve efficiency of operations.

What is a 'graph'?

An ordered pair of a set of vertices and edges. (G = V, E)

What is the difference between a directed and undirected edge in a graph data structure?

Directed (ordered) edges point from one node to another where as undirected (unordered) edges point both ways. Graphs that are fully directed are referred to as 'Digraphs'.

In 'graphs', what is a 'simple path'?

A path in which no vertices (and thus no edges) are repeated. Also called a 'walk'. A 'trail' is a walk when no edges are repeated.

What is a 'strongly connected graph'?

When there is a path from any vertex to any other vertex.

In 'graphs', what is a 'closed walk'?

When a walk starts and ends at the same vertex and the length is greater than 0 (length = number of edges).

In 'graphs', what is a 'simple cycle'?

When a walk has no repetition except for the start and end vertex.

What is an 'Euler Tour'?

In graphs, when a path can be constructed where each node is visited, no edge is used more than once, and the first node is returned to. For this to be possible, every node must have an even degree (number of connected edges).

What is an 'Euler Walk'?

In graphs, when a path can be constructed where each node is visited, no edge is repeated and the ending node is different than the original node. For this to be possible, every node must have an even degree or exactly 2 nodes have an odd degree.

What are the 4 pillars of object-oriented programming?

Encapsulation, abstraction, inheritance, and polymorphism

What is encapsulation in object-oriented programming?

When we group related variables and functions into objects

What is abstraction in object-oriented programming?

When we hide properties and methods from the outside to make the interface simpler and reduce the impact of change

What is inheritance in object-oriented programming?

When we define a generic object that other objects can inherit from to reduce our code

What is polymorphism in object-oriented programming?

When an object can be used for multiple objects or forms.

What is SOLID object-oriented programming?

Single responsibility principle, Open-closed principle, Liskov substitution principle, Interface segregation principle, Dependency inversion principle

What is 'single responsibility' in object-oriented programming?

A class should have only one reason to change. If more than one, the class should be split into multiple classes.

What is 'open/close' in object-oriented programming?

Entities like classes, modules and functions should be open for extension but closed for modifications

What is 'Liskovs substitution' in object-oriented programming?

When referencing a class, it should be completely substitutable from its base class without also needing to reference the base class

What is 'interface segregation' in object-oriented programming?

A reference of a class shouldn't be forced to implement irrelevant properties or methods (i.e. robots don't need lunch breaks)

What is 'dependency inversion' in object-oriented programming?

Both high- and low-level modules and details should depend on abstractions

What is 'factorial' in mathematics?

n factorial refers to the number of possible orders of n numbers. For example, 3 factorial would be 3x2x1 or 3!. 6 factorial would be 6x5x4x3x2x1 or 6!. For each next item in order, the number of possible integers that can go in the next place is reduced by 1.

What is 'permutation' in mathematics?

Using n factorial to x number of places and in certain orders. For example, 6 permute 3 would be 6x5x4 where 3 is the number of spaces available. 10! / (10 - 4)! or n! / (n - r)! or nPr.

What is 'choose' in mathematics?

Like permutation but without a certain order, just choosing x number of items or the number of ways to select x items from a group of n. For example, 6 choose 3 would be 6C3 where nCr.

What is a 'Venn Diagram'?

An illustration of relationships between/among sets where circles overlap when items share something in common.

In probability, what does 'mutually exclusive' mean?

When 2 or more possibilities don't overlap (i.e. red spheres and blue cubes)

What is the 'addition rule' of probability?

P(A or B) = P(A) + P(B) - P(A and B). If A and B are mutually exclusive = P(A) + P(B).

What are 'independent events' in probability?

For example, each flip of a quarter carries the same 50% odds that it will land on heads. The result of the first flip does not influence the result of the second flip.

How do you compute 'compound probability'?

P(P[H] * P[H])

How do you compute probably of getting exactly X result in N flips in probability (exactly 1 head in 4 flips of quarter)?

= P(HTTT) + P(THTT) + P(TTHT) + P(TTTH) = 1/4

What is the formula for 'binomial coefficients' in probability?

n! / (k! * (n - k)!) or n factorial over k factorial times n minus k factorial

What is 'discrete mathematics'?

Referring to numbers that are separate or distinct as opposed to continuous (10 students in class as opposed to 9.5). A piano is discrete but a violin is now. A digital clock is discrete but an analog clock is not.

What does the ∈ symbol mean in discrete mathematics?

John ∈ A or John is an element of A students

What does the ⊆ symbol mean in discrete mathematics?

A ⊆ B or A is a subset of B (if all the items in A are also found in B

In a discrete mathematics set, does order matter?

No. Order does not matter so long as all items remain in set.

What is 'set-roster' notation in discrete mathematics?

When we use '...' to infer continuation when there is a clear pattern. For example, {0,2,4,6,...}.

How would you explain {x | P(x)} in discrete mathematics for even integers?

x is an even number such that x = twice an integer 3}. This expression is written in set-builder notation.

What is 'object-oriented programming'?

Everything is an object and contains state and behavior (properties and methods). Good at modeling, reusability, testing.

What is 'functional programming'?

Functions take out data and return data by creating new data instead of mutating. Data and procedures are separated. Good at low memory, testing, reusability, brevity.

What is 'logical programming'?

Based on formal logics made up of facts and clauses focused on what not how. Good at flexibility (can run backwards), constraints.

What is 'procedural programming'?

Based on routines and subroutines to be carried out.

What is 'P vs NP'?

P refers to easy to solve problems. NP refers to problems that may not be easy to solve (unsure of complexity). We need to find a way to solve any/all verifiable problems in at least polynomial time.

What is the 'Cook-Levin Theorem'?

In P vs NP, it states that SAT is the hardest problem in NP. Finding a solver for SAT would solve every other problem found in NP. If we could prove that solving SAT was easy, all NP problems would therefore be easy and NP would equal P.

What is 'NP-Complete' in P vs NP?

It refers to SAT which represents every other problem found in NP. It's the hardest problem found in NP.

What is 'EXPTIME' in P vs NP?

When a problem seems difficult to solve and there isn't an easy way to verify the solution. We know that EXPTIME doesn't equal P.

What is the 'halting problem'?

It is the problem of determining from a program and input whether the program will finish running or continue to run forever. It's impossible to solve.

What is the 'traveling salesman' problem?

An algorithm that finds the shortest path needed to visit all nodes (cities) only once and return to the original node. Currently, at its best, this algorithm runs in exponential time - O(n^2).

In P vs NP, what is 'reduction'?

Problem A reduces to problem B if we can use a solution for problem B to solve problem A. Meaning that A is no harder than B.

In graph theory, what is 'adjacency matrix'?

In graph theory and computer science, an adjacency matrix is a square matrix used to represent a finite graph. The elements of the matrix indicate whether pairs of vertices are adjacent or not in the graph.

What is in the 'memory hierarchy'?

A system's virtual memory, RAM and cache (CPU).

What is a 'cache miss'?

When the data requested is not found in the cache memory.

In programming, what is 'unit testing'?

When you test or validate individual units or part of a program.

In programming, what is 'integration testing'?

When you combine individual units and test them together as a group.

In programming, what is 'end-to-end testing'?

When you run a program from start to finish to test and validate.

In programming, what is 'Behavior Driven Development'?

An approach to building software where tests are built first and used as an outline prior to building any of the program's final code. Red > Green > Refactor.

In programming, what is 'refactoring'?

The process of rewriting code to make it cleaner and more efficient.

In programming, what is a 'sanity check'?

A simple check to be sure that the code structure is in proper order before writing code.

What is the difference between a process and a thread?

Processes are the abstractions of running programs and threads are the unit of execution within the process. Link

What is the Linux command line interpreter called?

The Linux CLI is called a shell and a language for interacting with the shell is called Bash

What is the 'call stack' in JavaScript?

The mechanism in the JavaScript engine that keeps track of the order of function calls and where they are in the program at any given moment.

In JavaScript, where do async functions go before being pushed onto the call stack?

They get pushed onto the callback queue.

In JavaScript, what is the job of the 'event loop'?

When the call stack is empty, the event loop takes the first async task from the callback queue, pushes it onto the call stack and runs it.

In JavaScript, what is a Higher Order Function?

A function that either accepts a function as an argument or returns a function.

In JavaScript, what is a 'promise'?

A promise is an object that may produce a single value some time in the future.

In JavaScript, what does the keyword 'async' do to a function?

Makes it asynchronous and forces it to return a promise instead of a value.

In JavaScript, what does the keyword 'await' do?

Always used inside of async functions, await simulates a 'then' block when assigned to a variable as it causes the pause until the function is completed.

In JavaScript, what is 'differential inheritance'?

When an instance of an object is created and a program references a property on the instance. The property doesn't exist so the program looks up the prototype chain to the parent which is Object.prototype.

In JavaScript, what are the 3 ways to create objects?

Initializers (literal notation) - setting a value equal to an object using curly brackets, Constructor Functions - using function and this keyword, Object.create - using a previously created object as a prototype object with defaults.

What is the difference between a strongly-typed and weakly-typed language?

In a strongly-typed language, the type of the variable must be declared (i.e. String).

In JavaScript, what is 'callback hell'?

When nesting callbacks inside of one another in async programming and forming a pyramid shape in the code.

In JavaScript, what is 'inversion of control'?

Having control of code in one part of the program and then handing it over to another part of the program.

What are lambda functions?

Blocks of code that can be assigned to variables, passed as an argument, or returned from a function call.

What is event-driven programming?

When a program's execution is determined by events (i.e. event listeners)

In React, what is it called when a component contains another component?


In Node.js, how do we require the full path of a module?


In Node.js, what is the potential downfall of circular dependencies?

Having incomplete versions of module properties or values depending on the loading order of the modules.

In Node.js, what is the substack pattern?

When we assign the module.exports variable as a function. It is a great way to make use of the single responsibility principle (SRP) where every module should have responsibility over a single functionality.

In Node.js, how is the observer pattern implemented?

With the 'EventEmitter' class

What is a race condition?

When two or more threads can access shared data and they try to change it at the same time.

In Node.js, what is promisification?

When we have to convert a typical callback-based function into one that returns a promise.

In programming, what is buffer mode?

When data is collected into a buffer (or temporary placeholder in memory) and then passed to a callback as soon as the entire resource has been read.

In Node.js, what do streams enable?

Streams allow you to process the data as soon as it arrives instead of storing the data temporarily into memory until the entire resource is read.

In Node.js, what are the values that streams provide?

Streams provide spatial efficiency, time efficiency and composability.

In V8, what's the maximum size of a buffer?

A little less than 1GB of data.

In Node.js, what is a readable stream?

A source of data

In Node.js, what is a writable stream?

A data destination

In Node.js streams, what is back-pressure?

When a writable stream reaches its highWaterMark, the application stops writing to the buffer. When the buffer is finally emptied, the drain event is emitted communicating that it's safe to start writing again.

In Node.js, what is a duplex stream?

A stream that is both readable and writable. It's useful when describing an entity that is both a data source and destination such as network sockets.

In Node.js, what is a transform stream?

A kind of duplex stream that is designed to handle data transformations

In Node.js, what is the benefit of a factory?

A factory allows us to separate the object creation from its implementation giving us additional flexibility

What is a controlled component in React?

A component (i.e. HTML input) whose value is controlled by React in a module's state.

In React, what is JSX?

A syntax expression to JavaScript. Similar to a template language but contains the full power of JavaScript. It gets compiled to React.createElement().

In React, what are lifecycle methods?

Custom functionality that gets executed during the different phases of a component (e.g. mounting, updates, unmounting).

In React and JSX, how do you loop through data?

Using { =>



In React, what is the virtual DOM?

A virtual representation of the in memory and synced with the real DOM by a library such as React (reconciliation).

In React, what are the benefits of a virtual DOM over the real DOM?

Faster updates, updates only to elements that change, simple DOM manipulation, no memory waste.

What is React?

A front-end JavaScript library developed by Facebook in 2011. It's a component-based approach.

Why use React?

Can be used client or server side, code readability, integration with other frameworks

Why not use React?

It's just a library not a full-blown framework, the library is large

How different is React's ES6 syntax from ES5?

import vs require, export default vs module.exports, extends vs createClass

What are the differences between React and Angular?

React is only the MVC's view - Angular is the complete MVC, React renders server-side where Angular is client-side, React uses virtual DOM where Angular uses real DOM

What are the 7 React lifecycle methods?

componentWillMount, componentDidMount, componentWillReceiveProps, shouldComponentUpdate, componentWillUpdate, componentDidUpdate, componentWillUnmount

How are events passed in React?

As camelCase and as functions instead of strings

What are refs in React?

References to elements, alternative to using state, created by createRef()

What are Higher Order Components in React?

A pattern that accepts a child component and returns a new component.

What are pure components in React?

Efficient components that perform shallow checks prior to re-rendering, written as ... extends React.PureComponent or React.Memo()

What are keys in React?

Keys are used in lists to provide a unique ID to each component, prevents React from rerendering every component and maintains order.

How does React Router work?

It uses a Switch that matches the typed URL with the defined child routes.

How does React Router differ from conventional routing?

Uses only a single HTML page, only changes the history attribute, the user doesnt actually navigate across different pages

What are reducers in Redux?

Functions that take the previous state and an action and return the next state

In Redux, what is reducer composition?

Breaking up state functions into smaller functions.

What is Redux?

A predictable state container for JavaScript apps that manages an entire app's state.

What are the 3 core principles of Redux?

A single source of truth, state is read-only, changes are made only with pure functions (state is immutable)

What are the advantages of Redux?

Predictability of outcome, maintainability, server-side rendering, developer tools, ease of testing

What is webpack?

A static module bunder for JavaScript applications. It builds a dependency graph which maps every module your project needs and generates one or more bundles.

In React, what is the difference between an element and a component?

An element is an individual HTML element (i.e.

) whereas a component can refer to a function or class of elements.

Before hooks, when would you use a class instead of a function in React?

When a component needs state or lifecycle methods.

In React, what are PureComponents or React.memo?

Components that handle the shouldComponentUpdate() method automatically. They do a shallow comparison of both props and state to determine if the component should be re-rendered.

In React, what is the difference between state and props?

While both are plain JavaScript objects that hold information influencing rendering, props get passed to the component similar to parameters whereas state is managed within the component similar to variables.

In React, why should state not be updated directly?

If the state is updated directly (i.e. = 'your name') the component won't re-render.

What is the difference between HTML and React event handling?

Lowercase vs camelCase, HTML could return false to prevent default behavior but React must use preventDefault().

In React, how can you bind methods?

You can bind 'this' to methods by calling this.functionName = this.functionName.bind(this) instead of the constructor or via arrow functions that bind automatically.

In React, what are synthetic events?

Cross-browser wrappers around the browser's native event (e.g. stopPropagation, preventDefault).

How can you inline conditional expressions in JSX?

{condition && ...}. If the condition evaluates to true than the following elements after && will be called.

In React, what are refs?

Refs are used to return a reference to an element. Not used often but can be useful when you need direct access to a DOM element. Set by const name = React.createRef() and ref={name} on element.

How does the virtual DOM work?

When data changes, the virtual DOM is re-rendered, then the virtual and real DOMs are compared and the real DOM is updated with only the values that have changed.

What is React Fiber?

Assists with animation, layout, gestures, etc. Its goal is incremental rendering - split rendering work into chunks and spread it out over multiple frames.

What is lifting state up in React?

Passing a value up from a child component via a props function sent by the parent.

In React, what is context?

Provides a way to pass data through the component tree without having to pass props manually. Providers and consumers.

How can a component accept child components in React?


What is the purpose of super(props) in the constructor method in React?

Enables the rest of the constructor function to have access to the 'this' reference. Methods outside of the constructor function can access the 'this' reference regardless.

In React, what is reconciliation?

When props or state change, React decides whether an actual DOM update is necessary.

In React, how can you use dynamic key names?

With the ES6 [keyname] bracket notation.

Why does JSX use 'className' instead of 'class' for elements?

Because 'class' is already a keyword in JavaScript.

In React, what are fragments?

Grouping JSX elements in a return statement when there is no parent element (e.g. <> or ).

In React, what are portals?

A way to render children into a DOM node that normally exist outside of the DOM hierarchy of the parent component.

In React, what are stateless and stateful components?

Components that either maintain a local state or not.

What are error boundaries in React?

Components that catch JavaScript errors in any of its nested components. They are used like regular components.

What is the React-native way to static type check?

Using PropTypes.

What does the package react-dom enable?

DOM-specific methods such as render, hydrate, createPortal, etc.

What native function do you use to place HTML in React?


In React, what error will you get if you use setState inside constructor function?

'Can only update a mounted or mounting component'

How can you use a ternary if-else statement in JSX?

{condition ?





How do you leverage prop destructuring in React?


In React, which native function allows you to memoize a component?

React.memo. Memoization is like caching for expensive function calls.

How do you implement server-side rendering (SSR) in React?

By using 'ReactDOMServer' and its 'renderToString' method.

What does the getDerivedStateFromProps lifecycle method do?

It's invoked after a component is instantiated as well as before it is re-rendered. It can return an object to update state or null to indicate that the new props do not require any state updates. Called with the 'static' keyword: static getDerivedStateFromProps(props, state) {}.

When should we pass a function to setState in React?

When the new value requires the previous value (i.e. incrementing). We would call it like: setState((prev) => {id: prev + 1})

How can you force a component to re-render in React?


How can you set global variables in React?

By creating and putting them in the .env file.

What does JSX compile to?

JSX compiles down to React.createElement() which compiles down to a JavaScript object. const element = (


) ==>> const element = React.createElement('h1', {className: 'greeting'}, 'Hello!') ==>> const element = {type: 'h1', props: { className: 'greeting', children: 'Hello!'}}

What are 2 common folder structures in React?

Grouping by features or routes (all components and elements for specific route in same folder), Grouping by file type (components together, routes together, etc).

In React, what are render props?

Passing a function as a prop to a component which returns a React element.

What 3 instances does React Router maintain?

Browser, Hash and Memory history

How can you navigate programmatically with React Router?

withRouter(), Route, or context

How can you get query params in React Router?

WIth queryString.parse() ('query-string') or new URLSearchParams().

What is shallow renderer in React?

For writing unit tests, it lets you render a component one level deep and assert facts about what its render method returns without worrying about the behavior of child components.

What is testrenderer in React?

For writing tests, it lets you render components to pure JavaScript objects.

What is flux?

An application design paradigm that complements Unidirectional data flow.

Why are Redux state functions called reducers?

Reducers always return the accumulation of state. Receiving the state and action, it reduces these and returns the next state.

With React, how do you access the Redux store?

With connect. ==>> const State = connect(mapStateToProps)(Component)

In React-Redux, what is the difference between a component and container?

A component refers to the presentational part and container the part connected to the Redux store.

What are the 5 main categories of files in Redux?

Components, containers, actions, reducers, store

In React, what are the 2 main types of components?

Classes via React.Component and function components.

How could you debug issues in React?

React Developer Tools, eslint, React - Error Boundaries, strict mode and static type checking also help.

In React, what is it called when the DOM compares and matches the virtual DOM?


Explain Synthetic Events and event pooling in React.

Synthetic Events are a wrapper around the browser's native event in React having much of the same characteristics. Event pooling is when the event is nullified - sent back to the browser - after a callback to be reused. A symptom of this is that component state cannot be set equal to an event directly.