1/19
20 question-and-answer flashcards covering key concepts from the JavaScript, ReactJS, and MySQL lecture notes.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Which JavaScript variable declarations are block-scoped?
let and const
Given the code:
let x = 5;
function foo(){ let x = 10; return () => x; }
const bar = foo();
console.log(bar());
What value is logged?
10
Do arrow functions have their own "this" binding?
No, they inherit "this" from their surrounding (lexical) scope.
What two main benefits does async/await provide compared with plain promises?
It lets you write code that looks synchronous and helps avoid callback-hell.
Which task type is executed first in JavaScript’s event loop microtask queue?
Promise callbacks (microtasks).
What are the results of "5" == 5 and "5" === 5, respectively?
true and false
What is the primary purpose of the React hook useState?
Managing component state.
When does useEffect run if no dependency array is supplied?
After every render (mount and subsequent updates).
Can you change props inside a React component?
No, props are read-only within the receiving component.
In a controlled component, how is a form element’s value managed?
Via React state that controls the element’s value and onChange handler.
Why must each element rendered in a list have a unique key prop?
To uniquely identify items so React can efficiently reconcile and update the DOM.
Name two common uses for the React hook useRef.
Accessing DOM elements and storing mutable values that persist without causing re-renders.
When is it appropriate to use the React Context API?
When you need to share data globally across many components and want to avoid prop drilling.
Which SQL statement correctly inserts the name ‘A’ into the users table’s name column?
INSERT INTO users(name) VALUES ('A');
What does an INNER JOIN return?
Only the rows that have matching keys in both tables (the intersection).
How does a LEFT JOIN differ from an INNER JOIN?
It returns all rows from the left table plus the matching rows from the right table; non-matches on the right are filled with NULLs.
What is the purpose of the SQL GROUP BY clause?
To group rows that share the same values in specified column(s) so aggregate functions can be applied to each group.
What is a PRIMARY KEY in a relational database?
A column (or set of columns) whose value uniquely identifies each record in a table.
What is the main performance advantage of adding an INDEX on a column?
It speeds up data retrieval by allowing faster lookups and sorting.
Which clause can you add to a SELECT statement to reduce the number of rows returned and thus optimize the query?
LIMIT