JavaScript, often abbreviated JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS.

JavaScript MCQs: This section contains JavaScript Multiple-Choice Questions with Answers. These JavaScript MCQs are written for beginners as well as advanced, practice these MCQs to enhance and test the knowledge of JavaScript.

questions

Title
JavaScript is the programming language of the _____

JavaScript is the programming language of the _____.


  1. Desktop
  2. Mobile
  3. Web
  4. Server
discuss
Which type of JavaScript language is _____?

 Which type of JavaScript language is _____?


  1. Object-oriented
  2. Object-based
  3. Functional programming
  4. All of the above
discuss
Which of the following statement(s) is true about the JavaScript?

 Which of the following statement(s) is true about the JavaScript?


  1. It is a scripting language used to make the website interactive
  2. It is an advanced version of Java for Desktop and Mobile application development
  3. It is a markup language of Java to develop the webpages
  4. All of the above
discuss
In which HTML element, we put the JavaScript code?

In which HTML element, we put the JavaScript code?


  1. <javascript>...</javascript>
  2. <js>...</js>
  3. <script>...</script>
  4. <css>...</css>
discuss
JavaScript code can be written in ____

 JavaScript code can be written in ____.


  1. JavaScript file (.js file)
  2. HTML document directly
  3. JavaScript file and in HTML document directly
  4. In style sheets (.css file)
discuss
Which symbol is used separate JavaScript statements?

Which symbol is used separate JavaScript statements?


  1. Comma (,)
  2. Colon (:)
  3. Hyphen (_)
  4. Semicolon (;)
discuss
JavaScript ignores?

 JavaScript ignores?


  1. newlines
  2. tabs
  3. spaces
  4. All of the above
discuss
Which is the correct syntax to call an external JavaScript file in the current HTML document?

 Which is the correct syntax to call an external JavaScript file in the current HTML document?


  1. <script src="jsfile.js"></script>
  2. <script href=" jsfile.js"></script>
  3. <import src=" jsfile.js"></import>
  4. <script link=" jsfile.js"></script>
discuss
Which JavaScript method is used to access an HTML element by id?

 Which JavaScript method is used to access an HTML element by id?


  1. getElementById()
  2. getElement(id)
  3. getElementById(id)
  4. elementById(id)
discuss
Which property is used to define the HTML content to an HTML element with a specific id?

Which property is used to define the HTML content to an HTML element with a specific id?


  1. innerText
  2. innerContent
  3. elementText
  4. innerHTML
discuss
Which JavaScript method is used to write HTML output?

Which JavaScript method is used to write HTML output?


  1. document.write()
  2. document.output()
  3. console.log()
  4. document.writeHTML()
discuss
Which JavaScript method is used to write on browser's console?

Which JavaScript method is used to write on browser's console?


  1. console.write()
  2. console.output()
  3. console.log()
  4. console.writeHTML()
discuss
Which JavaScript method is used to write into an alert box?

Which JavaScript method is used to write into an alert box?


  1. window.alertHTML()
  2. window.alert()
  3. window.alertBox()
  4. window.alertContent()
discuss
Which is the correct JavaScript statement to display "Hello Boss!" into an alert box?

Which is the correct JavaScript statement to display "Hello Boss!" into an alert box?


  1. alert("Hello Boss!");
  2. alert('Hello Boss!');
  3. alert(Text:'Hello Boss!');
  4. Both A. and B.
discuss
Which is the correct JavaScript statement to print the addition of two numbers 10 and 20 in a paragraph whose id is 'result'?

 Which is the correct JavaScript statement to print the addition of two numbers 10 and 20 in a paragraph whose id is 'result'?


  1. getElementById("result").innerHTML = 10+20;
  2. getElementById("result").innerHTML = "10+20";
  3. getElementById("#result").innerHTML = 10+20;
  4. All of the above
discuss
What is the use of this JavaScript statement?

What is the use of this JavaScript statement?

<button onclick="window.print()">Submit</button>


  1. It will write "Submit" on the current Window
  2. It will print the content of the current page
  3. It will write the content of the current page in the browser’s console
  4. None of the above
discuss
In JavaScript, single line comment begins with ___

 In JavaScript, single line comment begins with ___.


  1. #
  2. /*
  3. $
  4. //
discuss
In JavaScript, multi-line comments start with __ and end with ___

In JavaScript, multi-line comments start with __ and end with ___.


  1. /* and */
  2. <!—and -->
  3. ## and ##
  4. // and //
discuss
Which JavaScript keyword is used to declare a variable?

Which JavaScript keyword is used to declare a variable?


  1. Var
  2. var
  3. Let
  4. All of the above
discuss
How many keywords are there in JavaScript to declare variables or constants?

 How many keywords are there in JavaScript to declare variables or constants?


  1. 1
  2. 2
  3. 3
  4. 4
discuss
total MCQs: 87

MCQs

87

Views

170

Best Answers

299

Points

5