JavascriptQuestion Answer

Hello friends in this post we are going to discuss about javascript MCQ with answers | javascript Multiple choice questions with answer | JavaScript Wipro TrendNXT MySkillz

If you are looking for more Dumps for MYSKILLZ Visit Here

1. Where is the correct place to insert a JavaScript?
answer : Both the <head> section and the <body> section are correct

2. What is the correct syntax for referring to an external script called "xxx.js"? 
answer : <script src="xxx.js">

3. The external JavaScript file must contain the <script> tag.
answer : False

4. How do you create a function in JavaScript?
answer : function myFunction()

5. How to write an IF statement for executing some code if "i" is NOT equal to 5?
answer : if (i != 5)

6. How can you add a comment in a JavaScript?
answer : //This is a comment

7. How to insert a comment that has more than one line?
answer :  /*This comment has
more than one line*/

8. How do you declare a JavaScript variable?
answer: var carName;

9.output for this(check this logic same qus will not cum)
var x = 16 + 4 + "Volvo";
document.getElementById("demo").innerHTML = x;

answer: 20Volvo

10.output for this(check this logic same qus will not cum)
var x = "Volvo" + 16 + 4;
document.getElementById("demo").innerHTML = x;

answer: Volvo164

11.which style is not used in javascript

answer: Hyphens

12.null === undefined------------->>false
   null == undefined--------------->>true

13.  switch(sample) {                             switch(sample) {
    case "1"                                      case "1"
      text = "thirteen";                          text = "thirteen";
    case "2"                                      case "2"
      text = "forteen";                           text = "forteen";
BREAK;                                            BREAK;
    case "3"                                      case "3"
      text = "fifteen";                           text = "fifteen";
BREAK;                                            BREAK;                                             
default                                           default                                             
      text = "default.";                          text = "default.";
  }                                               BREAK }


ANS:-DEFAULT                                      THIRTEEN FORTEEN

15.output for this(check this logic same qus will not cum)
var x = 5 + C + 5*3;
document.getElementById("demo").innerHTML = x;


16.How to write using console in browser?

answer: console.log()

17.How java script code will be written?

answer: inside curly braces {}

18.How will you assign a value to variable?

answer: (=)assignment operator.

19.Without <script> tags if java script is written how it will consider?

1.ignore the lines.
2.print as plain text.
3.print in web page.
4.consider as html code

answer:print as plain text.

20.what is the correct keyword to declare a function?


21.which program is correct when user clicks on a button?


<p id="demo">A Paragraph</p>

<button type="button" onclick="myFunction()">Try it</button>

function myFunction() {
   document.getElementById("demo").innerHTML = "Paragraph changed.";

22. <script>
document.getElementById(typeof false);               

answer: boolean.

Leave a Reply

Your email address will not be published. Required fields are marked *