JavaScript Fundamentals Quiz
Test your knowledge of JavaScript basics including syntax, operators, functions, variables, and core language features
Questions
What is the correct syntax for adding comments in JavaScript?
- <!–This is a comment–>
- //This is a comment
- –This is a comment
- This is a comment
What will be the output of the following code? document.write(typeof(24.49));
- float
- number
- integer
- double
How is the function called in JavaScript?
- Geekfunc();
- call Geekfunc();
- function Geekfunc();
- call function GeekFunc();
What is the JavaScript syntax for printing values in Console?
- console.log(5);
- console.print(5);
- print(5)
- print.console(5);
Which of the following is not a reserved word in JavaScript?
- interface
- throws
- short
- program
Predict the output of the following JavaScript code : a = 8 + "8"; document.write(a);
- 16
- Complilation Error
- 88
- Run Time Error
Which of the following is the correct syntax to display “GeeksforGeeks” in alert box using JS?
- alertbox(“GeeksforGeeks”);
- alert(“GeeksforGeeks”);
- msg(“GeeksforGeeks”);
- msgbox(“GeeksforGeeks”);
What is the HTML tag under which one can write the JavaScript code?
- <javascript>
- <script>
- <scripted>
- <js>
Predict the output: function geek() { if(true) { var a = 5; } document.write(a); } geek();
- Compilation Error
- Runtime error
- Nothing will be printed as output
- 5
JavaScript is a ________ Side Scripting Language.
- Server
- Browser
- ISP
- None of the above