codebypc
2.09K subscribers
210 photos
59 videos
160 files
250 links
Html, css3, javascript, reactjs, express, Fullstack, backend, Bootstrap, mongodb
Download Telegram
๐Ÿฅฐ3
๐Ÿ‘1
๐Ÿ‘2๐Ÿ”ฅ1
๐Ÿ”ฅ1
10 JavaScript MCQs
### Question 1:
What is the correct syntax to print a message in the console in JavaScript?

a) console.log("Hello World");
b) print("Hello World");
c) echo "Hello World";
d) console.print("Hello World");

Answer: a) console.log("Hello World");

### Question 2:
Which of the following is not a valid JavaScript variable name?

a) 2names
b) _name
c) firstName
d) name2

Answer: a) 2names

### Question 3:
What is the output of typeof NaN in JavaScript?

a) number
b) undefined
c) NaN
d) object

Answer: a) number

### Question 4:
Which built-in method removes the last element from an array and returns that element?

a) last()
b) get()
c) pop()
d) None of the above

Answer: c) pop()

### Question 5:
How do you write a comment in JavaScript?

a) <!-- This is a comment -->
b) // This is a comment
c) /* This is a comment */
d) Both b) and c)

Answer: d) Both b) and c)

### Question 6:
Which method is used to create a new array from an existing array with only elements that pass a test provided by a function?

a) reduce()
b) filter()
c) map()
d) forEach()

Answer: b) filter()

### Question 7:
What will the following code output? console.log(0.1 + 0.2 == 0.3);

a) true
b) false
c) undefined
d) NaN

Answer: b) false

### Question 8:
Which of the following is a JavaScript library ?

a) Django
b) Rails
c) React
d) Laravel

Answer: c) React

### Question 9:
How do you declare a JavaScript variable?

a) var carName;
b) variable carName;
c) v carName;
d) carName;

Answer: a) var carName;

### Question 10:
Which operator is used to assign a value to a variable in JavaScript?

a) *
b) =
c) -
d) x

Answer: b) =
๐Ÿ‘7โค4๐Ÿ‘1
100+ JavaScript projects ๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡ for beginners to advanced..
๐Ÿ‘2
codebypc pinned ยซhttps://www.100jsprojects.com/ยป
๐Ÿ‘1
๐Ÿ‘1
๐Ÿ‘1
๐Ÿ‘1
๐Ÿ‘2