JavaScript MCQs with answers Page - 37

Here, you will find a collection of MCQ questions on JavaScript. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 833K Points
Coach

Q. What will the following JavaScript code snippet do? If not, what will be the error?

Code:
function letsfindcourse(lfc)
{
for (; lfc.next; lfc = lfc.next) ;
return lfc;
}
  • (A) No, this will result in a runtime error with the message Cannot use Linked List
  • (B) No, this will not iterate
  • (C) Yes, this will work
  • (D) No, this will throw an exception as only numerics can be used in a for loop

A

Admin • 833K Points
Coach

Q. What will be the output of the following JavaScript code?

Code:
function fun_range(int l)
{
int p=2;
for(int x=0;x {
console.log(p);
}
}
range(4);
  • (A) 2
  • (B) 4
  • (C) 2222
  • (D) error

A

Admin • 833K Points
Coach

Q. What will be the output of the following JavaScript code?

Code:
int x=0;
for(x;x<10;x++);
console.log(x);
  • (A) 0
  • (B) 9
  • (C) 10
  • (D) error

A

Admin • 833K Points
Coach

Q. JavaScript strings are for ________ text.

  • (A) storing
  • (B) manipulating
  • (C) Both A and B
  • (D) none of the above

A

Admin • 833K Points
Coach

Q. To find the length of a string, use the built-in _______ property.

  • (A) strlen
  • (B) area
  • (C) length
  • (D) size

A

Admin • 833K Points
Coach

Q. code is used for?

  • (A) Carriage Return
  • (B) New Line
  • (C) Form Feed
  • (D) Backspace

A

Admin • 833K Points
Coach

Q. The _________ keyword complicates the code and slows down execution speed

  • (A) this
  • (B) let
  • (C) new
  • (D) none of the above

A

Admin • 833K Points
Coach

Q. Comparing two JavaScript objects always returns?

  • (A) True
  • (B) False
  • (C) Can be true or false
  • (D) Can not say

A

Admin • 833K Points
Coach

Q. _______ extracts a part of a string and returns the extracted part in a new string.

  • (A) slice()
  • (B) strlen()
  • (C) substr()
  • (D) substring()

A

Admin • 833K Points
Coach

Q. JavaScript counts positions from?

  • (A) -1
  • (B) 0
  • (C) 1
  • (D) Can not say

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ