JavaScript Comments

Qus. 1 : How do you correctly link an external JavaScript file to an HTML document?

  1. <script src="script.js"></script>
  2. <javascript src="script.js"></javascript>
  3. <link href="script.js" rel="script">
  4. <script href="script.js"></script>
Qus. 2 : What is the correct way to embed JavaScript directly within an HTML file?

  1. <script href="script.js"></script>
  2. <script> alert('Hello, World!'); </script>
  3. <js> alert('Hello, World!'); </js>
  4. <style> alert('Hello, World!'); </style>
Qus. 3 : Which of the following is true about the <script> tag in HTML?

  1. Multiple <script> tags can be used in the same HTML document
  2. The <script> tag can only be placed in the <head> section
  3. The <script> tag can only be used once in an HTML document
  4. The <script> tag must always reference an external file
Qus. 4 : Which of the following is true about the placement of JavaScript in HTML?

  1. JavaScript must always be placed inside the <head> tag
  2. JavaScript can be placed either in the <head> or <body> tag
  3. JavaScript can only be placed in external files
  4. JavaScript cannot be placed in the <head> tag

Programs

JavaScript code that calculates the squares and cubes from 0 to 10

View Solution


Latest Current Affairs 2025 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad