JavaScript Fundamentals Quiz

Test your knowledge of JavaScript basics including syntax, operators, functions, variables, and core language features

10 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

What is the correct syntax for adding comments in JavaScript?

  1. <!–This is a comment–&gt
  2. //This is a comment
  3. –This is a comment
  4. This is a comment
Question 2 Multiple Choice (Single Answer)

What will be the output of the following code? document.write(typeof(24.49));

  1. float
  2. number
  3. integer
  4. double
Question 3 Multiple Choice (Single Answer)

How is the function called in JavaScript?

  1. Geekfunc();
  2. call Geekfunc();
  3. function Geekfunc();
  4. call function GeekFunc();
Question 4 Multiple Choice (Single Answer)

What is the JavaScript syntax for printing values in Console?

  1. console.log(5);
  2. console.print(5);
  3. print(5)
  4. print.console(5);
Question 5 Multiple Choice (Single Answer)

Which of the following is not a reserved word in JavaScript?

  1. interface
  2. throws
  3. short
  4. program
Question 6 Multiple Choice (Single Answer)

Predict the output of the following JavaScript code : a = 8 + "8"; document.write(a);

  1. 16
  2. Complilation Error
  3. 88
  4. Run Time Error
Question 7 Multiple Choice (Single Answer)

Which of the following is the correct syntax to display “GeeksforGeeks” in alert box using JS?

  1. alertbox(“GeeksforGeeks”);
  2. alert(“GeeksforGeeks”);
  3. msg(“GeeksforGeeks”);
  4. msgbox(“GeeksforGeeks”);
Question 8 Multiple Choice (Single Answer)

What is the HTML tag under which one can write the JavaScript code?

  1. <javascript>
  2. <script>
  3. <scripted>
  4. <js>
Question 9 Multiple Choice (Single Answer)

Predict the output: function geek() { if(true) { var a = 5; } document.write(a); } geek();

  1. Compilation Error
  2. Runtime error
  3. Nothing will be printed as output
  4. 5
Question 10 Multiple Choice (Single Answer)

JavaScript is a ________ Side Scripting Language.

  1. Server
  2. Browser
  3. ISP
  4. None of the above