JavaScript MCQs with answers Page - 41

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 be the output of the following JavaScript code?

Code:
System.out.println( Pattern.matches("[lfc]", "lets") );
  • (A) l
  • (B) true
  • (C) false
  • (D) undefined

A

Admin • 833K Points
Coach

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

Code:
System.out.println( Pattern.matches("[lfc]?", "l") ); 
  • (A) true
  • (B) false
  • (C) undefined
  • (D) l

A

Admin • 833K Points
Coach

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

Code:
System.out.println( Pattern.matches("d", "9") );
  • (A) true
  • (B) false
  • (C) 9
  • (D) undefined

A

Admin • 833K Points
Coach

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

Code:
System.out.println( Pattern.matches("[lfc]+", "f") );
  • (A) true
  • (B) false
  • (C) undefined
  • (D) 1

A

Admin • 833K Points
Coach

Q. What among the following is an appropriate when an event occurs when the user clicks on an element?

  • (A) onblur
  • (B) onkeyup
  • (C) onchange
  • (D) onclick

A

Admin • 833K Points
Coach

Q. Consider the below code:
Identify the correct code in order to fetch the value entered in username text field?

Code:
< body>
< form name="register">
Enter username < input value="John" id="name" name="username">
< /form>
< /body>
  • (A) document.register.name.value
  • (B) document.getElementById ("name").value
  • (C) document.getElementByName ("name").value
  • (D) None of the above

A

Admin • 833K Points
Coach

Q. Consider the below code:
Identify the correct code in order to fetch the value entered in username text field?

Code:
< body>
< form name="login">
Enter Your Name< input value="Akash" id="p_name" name="uname">
< /form>
< /body>
  • (A) document.getElementByName ("name").value
  • (B) document.login.uname.value
  • (C) document.getElementById ("p_name").value
  • (D) Both B and C

A

Admin • 833K Points
Coach

Q. Which of the following statements is/are TRUE about DOM?

  • (A) W3C standard
  • (B) form elements can be accessed using the form object
  • (C) Each page can have multiple Document objects
  • (D) Both A and B

A

Admin • 833K Points
Coach

Q. What is the full form DOM?

  • (A) Document Oriented Management
  • (B) Document Oriented Model
  • (C) Document Onhalt Model
  • (D) Document Object Model

A

Admin • 833K Points
Coach

Q. What is the purpose of the Legacy DOM?

  • (A) Makes the scripting easier
  • (B) Allows access to few keys and elements
  • (C) Making the script modular
  • (D) Modify the nodes

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