JS 1

Understood. I'll structure it using the 80/20 (Pareto) principle—the smallest set of concepts that gives the biggest practical understanding of JavaScript.

JavaScript Chapters (No Topic Breakage)

  1. JavaScript Introduction & Execution

  2. Variables (let, const, var)

  3. Data Types

  4. Operators

  5. Type Conversion & Coercion

  6. Comparison Operators

  7. Truthy & Falsy Values

  8. Conditional Statements (if, else, switch)

  9. Loops (for, while, do...while)

  10. Functions

  11. Scope

  12. Hoisting

  13. Closures

  14. Arrays

  15. Array Methods

  16. Objects

  17. Object Methods

  18. Destructuring

  19. Spread & Rest Operators

  20. Template Literals

  21. Strings

  22. Numbers & Math

  23. Dates

  24. Error Handling (try...catch)

  25. ES Modules

  26. Callbacks

  27. Promises

  28. Async/Await

  29. Timers (setTimeout, setInterval)

  30. DOM Selection

  31. DOM Manipulation

  32. Events

  33. Event Delegation

  34. Forms

  35. Local Storage & Session Storage

  36. JSON

  37. Fetch API

  38. Classes

  39. Prototypes

  40. this Keyword

  41. Arrow Functions

  42. Map

  43. Set

  44. WeakMap & WeakSet

  45. Regular Expressions

  46. Optional Chaining

  47. Nullish Coalescing

  48. Iterators & Generators

  49. Symbols

  50. BigInt

  51. Performance Basics

  52. Memory Management

  53. Debugging

  54. Modern JavaScript Best Practices


Chapter 1 — JavaScript Introduction & Execution

MCQ 1

You save this code in app.js.

console.log("Pizza Delivered");

Nothing appears on the screen after double-clicking the file.

What is the most likely reason?

A. JavaScript only works with HTML pages.

B. console.log() is broken.

C. JavaScript needs internet.

D. The file must be named main.js.

✅ Answer: A


MCQ 2

You write:

console.log("Order Received");

Where will this message normally appear?

A. Browser URL bar

B. Browser Console

C. Browser Address Bar

D. Task Manager

✅ Answer: B


MCQ 3

You open an HTML page.

<script>
console.log("Welcome");
</script>

When does JavaScript execute?

A. Only after clicking something

B. Immediately when browser reaches the script

C. After 10 seconds

D. Only after internet connects

✅ Answer: B


MCQ 4

A restaurant website loads.

JavaScript is responsible for:

A. Storing electricity

B. Making buttons interactive

C. Printing paper menus

D. Increasing internet speed

✅ Answer: B


MCQ 5

A webpage contains only HTML.

What happens?

A. The page can still display content.

B. Browser crashes.

C. JavaScript is automatically added.

D. CSS becomes mandatory.

✅ Answer: A


MCQ 6

Which language mainly controls webpage behavior?

A. HTML

B. CSS

C. JavaScript

D. SQL

✅ Answer: C


MCQ 7

Which statement is TRUE?

A. HTML adds interaction.

B. CSS stores database.

C. JavaScript makes webpages respond to user actions.

D. JavaScript replaces HTML.

✅ Answer: C


MCQ 8

A login button changes color when hovered.

Which technology is mainly responsible?

A. HTML

B. CSS

C. JavaScript

D. MySQL

✅ Answer: B


MCQ 9

A login button checks whether password is correct.

Which technology mainly performs this logic?

A. CSS

B. HTML

C. JavaScript

D. SVG

✅ Answer: C


MCQ 10

You write:

console.log("One");
console.log("Two");
console.log("Three");

Output order?

A.
Three
Two
One

B.
One
Two
Three

C.
Random

D.
Depends on browser

✅ Answer: B


MCQ 11

You write:

console.log("Morning");
alert("Breakfast");
console.log("Office");

Which statement is TRUE?

A. JavaScript skips alert.

B. Execution pauses until alert is closed.

C. alert runs last.

D. console.log waits forever.

✅ Answer: B


MCQ 12

A shopping website loads JavaScript.

Which is executed first?

console.log("A");
console.log("B");
console.log("C");

A. C

B. B

C. A

D. Random

✅ Answer: C


MCQ 13

You accidentally write:

Console.log("Hi");

Result?

A. Works normally

B. Error because JavaScript is case-sensitive

C. Browser converts automatically

D. Prints nothing silently

✅ Answer: B


MCQ 14

Which is the correct function?

A.

console.Log()

B.

Console.log()

C.

console.log()

D.

CONSOLE.LOG()

✅ Answer: C


MCQ 15

A webpage has this:

<script>
console.log("A");
</script>

<script>
console.log("B");
</script>

Output?

A.
B
A

B.
A
B

C.
Only A

D.
Only B

✅ Answer: B


MCQ 16

JavaScript executes code:

A. Bottom to top

B. Randomly

C. Line by line

D. Alphabetically

✅ Answer: C


MCQ 17

Which is NOT a common place to run JavaScript?

A. Browser

B. Node.js

C. Calculator

D. Browser Developer Tools

✅ Answer: C


MCQ 18

You press F12 in Chrome.

Why?

A. To increase internet speed

B. To open Developer Tools

C. To restart browser

D. To clear history

✅ Answer: B


MCQ 19

Where is JavaScript executed when using Chrome?

A. Inside the browser's JavaScript engine

B. Inside HTML tags only

C. Inside CSS

D. Inside Excel

✅ Answer: A


MCQ 20

You refresh a webpage.

JavaScript inside the page:

A. Runs again

B. Is deleted forever

C. Runs only once in lifetime

D. Needs manual installation

✅ Answer: A


MCQ 21

You write:

console.log("Payment Started");
console.log("Payment Successful");

If the first line runs successfully, the second line will:

A. Never run

B. Usually run immediately after the first

C. Run before the first

D. Run only after browser restart

✅ Answer: B


MCQ 22

JavaScript is mainly used to:

A. Paint walls

B. Add logic and interactivity

C. Design buildings

D. Store clothes

✅ Answer: B


MCQ 23

Which file extension is commonly used for JavaScript?

A. .java

B. .js

C. .javascript

D. .script

✅ Answer: B


MCQ 24

You create:

app.js

How do you connect it to HTML?

A.

<script src="app.js"></script>

B.

<link src="app.js">

C.

<javascript app.js>

D.

<js file="app.js">

✅ Answer: A


MCQ 25

Which statement best describes JavaScript execution?

A. Browser reads JavaScript instructions one by one and performs them in order unless instructed otherwise.

B. Browser guesses the entire program before running.

C. Browser executes the last line first.

D. Browser ignores JavaScript until CSS finishes.

✅ Answer: A

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.