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.
Title | |
---|---|
JavaScript is the programming language of the _____JavaScript is the programming language of the _____.
The answer is:
A. Desktop
|
|
Which type of JavaScript language is _____?Which type of JavaScript language is _____?
The answer is:
B. Object-based
|
|
Which of the following statement(s) is true about the JavaScript?Which of the following statement(s) is true about the JavaScript?
The answer is:
A. It is a scripting language used to make the website interactive
|
|
In which HTML element, we put the JavaScript code?In which HTML element, we put the JavaScript code?
The answer is:
C. <script>...</script>
|
|
JavaScript code can be written in ____JavaScript code can be written in ____.
The answer is:
C. JavaScript file and in HTML document directly
|
|
Which symbol is used separate JavaScript statements?Which symbol is used separate JavaScript statements?
The answer is:
D. Semicolon (;)
|
|
JavaScript ignores?JavaScript ignores?
The answer is:
D. All of the above
|
|
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?
The answer is:
A. <script src="jsfile.js"></script>
|
|
Which JavaScript method is used to access an HTML element by id?Which JavaScript method is used to access an HTML element by id?
The answer is:
C. getElementById(id)
|
|
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?
The answer is:
D. innerHTML
|
|
Which JavaScript method is used to write HTML output?Which JavaScript method is used to write HTML output?
The answer is:
A. document.write()
|
|
Which JavaScript method is used to write on browser's console?Which JavaScript method is used to write on browser's console?
The answer is:
C. console.log()
|
|
Which JavaScript method is used to write into an alert box?Which JavaScript method is used to write into an alert box?
The answer is:
B. window.alert()
|
|
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?
The answer is:
D. Both A. and B.
|
|
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'?
The answer is:
A. getElementById("result").innerHTML = 10+20;
|
|
What is the use of this JavaScript statement?What is the use of this JavaScript statement? <button onclick="window.print()">Submit</button>
The answer is:
B. It will print the content of the current page
|
|
In JavaScript, single line comment begins with ___ |
|
In JavaScript, multi-line comments start with __ and end with ___In JavaScript, multi-line comments start with __ and end with ___.
The answer is:
A. /* and */
|
|
Which JavaScript keyword is used to declare a variable?Which JavaScript keyword is used to declare a variable?
The answer is:
B. var
|
|
How many keywords are there in JavaScript to declare variables or constants?How many keywords are there in JavaScript to declare variables or constants?
The answer is:
C. 3
|
MCQs
Views
Best Answers
Points