JavaScript, ReactJS & MySQL – Lecture Review

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/19

flashcard set

Earn XP

Description and Tags

20 question-and-answer flashcards covering key concepts from the JavaScript, ReactJS, and MySQL lecture notes.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

20 Terms

1
New cards

Which JavaScript variable declarations are block-scoped?

let and const

2
New cards

Given the code:
let x = 5;
function foo(){ let x = 10; return () => x; }
const bar = foo();
console.log(bar());
What value is logged?

10

3
New cards

Do arrow functions have their own "this" binding?

No, they inherit "this" from their surrounding (lexical) scope.

4
New cards

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.

5
New cards

Which task type is executed first in JavaScript’s event loop microtask queue?

Promise callbacks (microtasks).

6
New cards

What are the results of "5" == 5 and "5" === 5, respectively?

true and false

7
New cards

What is the primary purpose of the React hook useState?

Managing component state.

8
New cards

When does useEffect run if no dependency array is supplied?

After every render (mount and subsequent updates).

9
New cards

Can you change props inside a React component?

No, props are read-only within the receiving component.

10
New cards

In a controlled component, how is a form element’s value managed?

Via React state that controls the element’s value and onChange handler.

11
New cards

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.

12
New cards

Name two common uses for the React hook useRef.

Accessing DOM elements and storing mutable values that persist without causing re-renders.

13
New cards

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.

14
New cards

Which SQL statement correctly inserts the name ‘A’ into the users table’s name column?

INSERT INTO users(name) VALUES ('A');

15
New cards

What does an INNER JOIN return?

Only the rows that have matching keys in both tables (the intersection).

16
New cards

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.

17
New cards

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.

18
New cards

What is a PRIMARY KEY in a relational database?

A column (or set of columns) whose value uniquely identifies each record in a table.

19
New cards

What is the main performance advantage of adding an INDEX on a column?

It speeds up data retrieval by allowing faster lookups and sorting.

20
New cards

Which clause can you add to a SELECT statement to reduce the number of rows returned and thus optimize the query?

LIMIT