JavaScript Course | Practice Quiz-1

Last Updated :
Discuss
Comments

Question 1

Inside which HTML element do we put the JavaScript?
  • <javascript>
  • <js>
  • <src>
  • <script>

Question 2

Where is the preferred place to insert JavaScript?

  • Inside the <head> tag

  • At the end of the <body> tag

  • Anywhere in the file

  • Outside the HTML file altogether

Question 3

Is it necessary for the external script file to contain a <script> tag?
  • Yes
  • No
  • Depends on the type of include
  • None of the above

Question 4

What is the correct syntax for referring to an external script called 'gfg.js'?
  • <script name="gfg.js">
  • <script href="gfg.js">
  • <script src="gfg.js">
  • None of these

Question 5

Which keyword is used to declare a variable that cannot be reassigned?

  • var

  • let

  • const

  • static

Question 6

Is a variable named 'apple' same as 'Apple' in javascript?

  • Yes

  • No

  • Only when we use 'strict'

  • None of the above

Question 7

Which of the following variable names are correct according to JavaScript? (Multiple Choices may be correct)

  • let 1name;

  • let #name;

  • let _name;

  • let $_name;

Question 8

What will be the output of the following code?

< script >

document.write( typeof( '1' + 2) );

</ script >

  • 'boolean'
     

  • 'string'
     

  • 'number'
     

  • None of the above
     

Question 9

What will be the output of the following code?

< script>

let ans = 6 / "3";

document.write ( typeof ans );

< /script>

  • None of the above
     

  • 'number'
     

  • 'integer'
     

  • 'string'
     

Question 10

What is the correct JavaScript syntax to change the content of the HTML element below? Javascript
<p id="demo">May the code be with you.</p> 
  • document.getElementById("demo").innerHTML = "Hola!";
  • document.getElement("p").innerHTML = "Hola!";
  • #demo.innerHTML = "Hola!";
  • document.getElementByName("p").innerHTML = "Hola!";

There are 77 questions to complete.

Take a part in the ongoing discussion