Agreed. The previous MCQs were too basic. From now on, every chapter will be designed like you're learning by debugging real software, not memorizing definitions.
The rules I'll follow from now on:
Every MCQ teaches exactly one important JavaScript concept.
Questions are based on real-world apps (Amazon, Swiggy, WhatsApp, Instagram, Banking, UPI, Games, etc.).
Lots of code-reading, because that's how developers actually learn.
Wrong options are believable, not obviously wrong.
Every question is unique—no repeated patterns.
We'll cover the entire language through MCQs alone (Pareto style).
Chapter 3 — Data Types
MCQ 1
A food delivery app stores the customer's age.
let age = 25;
Which statement is true?
A. age stores text because numbers are written without quotes.
B. age stores a Number.
C. age stores a Boolean.
D. age stores an Object.
✅ Answer: B
MCQ 2
An OTP service sends this code.
let otp = "483921";
Why might the developer intentionally store it inside quotes?
A. OTP is a String because leading zeros or exact digits should be preserved.
B. JavaScript cannot store numbers larger than 100.
C. OTPs must always be Objects.
D. Quotes make the program faster.
✅ Answer: A
MCQ 3
An e-commerce website checks whether a user is logged in.
let isLoggedIn = false;
What data type is stored?
A. String
B. Number
C. Boolean
D. Null
✅ Answer: C
MCQ 4
A developer accidentally writes:
let balance = "5000";
let withdraw = 1000;
console.log(balance - withdraw);
What is printed?
A. "50001000"
B. 4000
C. Error
D. NaN
✅ Answer: B
MCQ 5
Now the developer changes only one line.
let balance = "5000";
let deposit = 1000;
console.log(balance + deposit);
Output?
A. 6000
B. "50001000"
C. Error
D. NaN
✅ Answer: B
MCQ 6
A payment hasn't been received yet.
Which value best represents "no value assigned yet"?
A.
0
B.
""
C.
undefined
D.
false
✅ Answer: C
MCQ 7
A shopping app intentionally clears a coupon.
let coupon = null;
What does null communicate?
A. Coupon hasn't been created.
B. Coupon is intentionally empty.
C. Coupon is false.
D. Coupon is a String.
✅ Answer: B
MCQ 8
Predict the output.
console.log(typeof "OpenAI");
A.
text
B.
string
C.
String
D.
object
✅ Answer: B
MCQ 9
Predict the output.
console.log(typeof 999);
A.
integer
B.
number
C.
float
D.
Number
✅ Answer: B
MCQ 10
A banking app stores this.
let verified = true;
console.log(typeof verified);
Output?
A.
boolean
B.
Boolean
C.
true
D.
logic
✅ Answer: A
MCQ 11
Instagram stores a user profile.
let user = {
name: "Priya",
followers: 1820
};
What data type is user?
A. String
B. Object
C. Array
D. Boolean
✅ Answer: B
MCQ 12
Spotify stores today's top songs.
let songs = [
"Believer",
"Shape of You",
"Perfect"
];
What is the data type of songs?
A. List
B. Array
C. String
D. Number
✅ Answer: B
MCQ 13
Predict the output.
console.log(typeof []);
A.
array
B.
list
C.
object
D.
collection
✅ Answer: C
This surprises almost every beginner.
MCQ 14
Predict the output.
console.log(typeof null);
A.
null
B.
empty
C.
undefined
D.
object
✅ Answer: D
One of JavaScript's oldest historical quirks.
MCQ 15
A game stores the player's nickname.
let player = "ShadowHunter";
Which operation makes the most sense?
A.
player + "007"
B.
player / 5
C.
player - 2
D.
player % 4
✅ Answer: A
MCQ 16
Predict the output.
console.log(typeof NaN);
A.
NaN
B.
undefined
C.
number
D.
error
✅ Answer: C
Another famous JavaScript interview question.
MCQ 17
A travel app stores whether a seat is available.
let available = false;
if (available) {
console.log("Book Seat");
} else {
console.log("Sold Out");
}
What is printed?
A.
Book Seat
B.
Sold Out
C.
false
D.
undefined
✅ Answer: B
MCQ 18
Predict the output.
let product = "Laptop";
console.log(typeof product);
console.log(typeof 45000);
console.log(typeof false);
Output?
A.
string
number
boolean
B.
String
Number
Boolean
C.
text
number
logic
D.
object
number
boolean
✅ Answer: A
MCQ 19
A developer wants to know the type of any variable while debugging.
Which tool should they use?
A.
checkType(variable)
B.
typeof variable
C.
variable.type
D.
getType(variable)
✅ Answer: B
MCQ 20 (Code Detective ⭐)
A Swiggy developer writes:
let orderId = "9876";
let amount = 450;
let delivered = true;
console.log(typeof orderId);
console.log(typeof amount);
console.log(typeof delivered);
Which output is correct?
A.
string
number
boolean
B.
String
Number
Boolean
C.
text
integer
boolean
D.
string
integer
bool
✅ Answer: A
This is the quality level I'll maintain going forward. As the chapters progress, the MCQs will become increasingly realistic—reading production-style code, spotting bugs, predicting outputs, and making design decisions—so that by the end, you'll be able to read and write JavaScript confidently without relying on traditional theory.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.