JavaScript - Programming Language (MCQ) questions

Dear Readers, Welcome to JavaScript multiple choice questions and answers with explanation. These objective type JavaScript questions are very important for campus placement test and job interviews.

Specially developed for the JavaScript freshers and professionals, these model questions are asked in the online technical test and interview of many IT companies.

1)   The general definition of a(n) ____ is a set of linked documents with shared attributes, such as related topics, a similar design, or a shared purpose.
- Published on 26 Feb 17

a. index
b. website
c. Internet
d. Homepage
Answer  Explanation 

ANSWER: website

Explanation:
No explanation is available for this question!


2)   To enable data tainting, the end user sets the _________ environment variable.
- Published on 26 Feb 17

a. ENABLE_TAINT
b. MS_ENABLE_TAINT
c. NS_ENABLE_TAINT
d. ENABLE_TAINT_NS
Answer  Explanation 

ANSWER: NS_ENABLE_TAINT

Explanation:
No explanation is available for this question!


3)   The following is a web-page:

<html>
     <head> <title>JavaScript</title> </head>
      <body bgcolor=""#0000ff"">
          <script language=""JavaScript"">
               <!-- document.write(""<h1> hello world </h1>""); //-->
          </script>
     </body>
</html>

When the above web page is loaded into a browser, what will happen?

- Published on 26 Feb 17

a. The body of the web page will not contain any text
b. The body of the web page will contain the text “hello world” as an H1 heading
c. The background color of the web page will be green
d. document.write("<h1> hello world </h1 >”); is a comment.
Answer  Explanation 

ANSWER: The body of the web page will not contain any text

Explanation:
No explanation is available for this question!


4)   _________ keyword is used to declare variables in javascript.
- Published on 26 Feb 17

a. Var
b. Dim
c. String
d. None of the above
Answer  Explanation 

ANSWER: Var

Explanation:
No explanation is available for this question!


5)   Which of the following JavaScript cannot do?
- Published on 26 Feb 17

a. JavaScript can react to events
b. JavaScript can manipulate HTML elements
c. JavaScript can be use to validate data
d. All of the Above
Answer  Explanation 

ANSWER: All of the Above

Explanation:
No explanation is available for this question!


6)   The _______ method of an Array object adds and/or removes elements from an array.
- Published on 26 Feb 17

a. Reverse
b. Shift
c. Slice
d. Splice
Answer  Explanation 

ANSWER: Splice

Explanation:
No explanation is available for this question!


7)   Which of the following is the structure of an if statement?
- Published on 26 Feb 17

a. if (conditional expression is true) thenexecute this codeend if
b. if (conditional expression is true)execute this codeend if
c. if (conditional expression is true)   {then execute this code>->}
d. if (conditional expression is true) then {execute this code}
Answer  Explanation 

ANSWER: if (conditional expression is true)   {then execute this code>->}

Explanation:
No explanation is available for this question!


1