JavaScript MCQ Quiz Hub

JAVASCRIPT MCQ

Choose a topic to test your knowledge and improve your JavaScript skills

Which of the following is correct about JavaScript?





✅ Correct Answer: 4

Which of the following is the correct syntax to print a page using JavaScript?





✅ Correct Answer: 1

Which of the following type of variable is visible only within a function where it is defined?





✅ Correct Answer: 2

Which built-in method returns the calling string value converted to upper case?





✅ Correct Answer: 4

Which of the following function of Number object returns the number's value?





✅ Correct Answer: 2

Which of the following function of String object returns the index within the calling String object of the first occurrence of the specified value?





✅ Correct Answer: 4

Which of the following function of String object creates an HTML anchor that is used as a hypertext target?





✅ Correct Answer: 1

Which of the following function of String object causes a string to be displayed as struck-out text, as if it were in a strike tag?





✅ Correct Answer: 3

Which of the following is true about variable naming conventions in JavaScript?





✅ Correct Answer: 3

Which of the following is the correct syntax to redirect a url using JavaScript?





✅ Correct Answer: 4

Which of the following function of String object returns a number indicating the Unicode value of the character at the given index?





✅ Correct Answer: 2

Which of the following function of String object executes the search for a match between a regular expression and a specified string?





✅ Correct Answer: 4

Which of the following function of String object returns the calling string value converted to upper case while respecting the current locale?





✅ Correct Answer: 1

Which of the following is a valid type of function javascript supports?





✅ Correct Answer: 3

How can you get the type of arguments passed to a function?





✅ Correct Answer: 1

Which of the following function of Array object removes the first element from an array and returns that element?





✅ Correct Answer: 2

....................... is a built - in JavaScript function which can be used to execute another function after a given time interval.





✅ Correct Answer: 2

Java Script entities start with ___________and end with _____________.





✅ Correct Answer: 4

Which of the following is a server-side Java Script object?





✅ Correct Answer: 2

Javascript is _________ language.





✅ Correct Answer: 3

JavaScript is ______ Side Scripting Language.





✅ Correct Answer: 3

Cost for Using JavaScript in your HTML is _________ .





✅ Correct Answer: 1

JavaScript Code is written inside file having extension __________.





✅ Correct Answer: 3

Why JavaScript is called as Lightweight Programming Language ?





✅ Correct Answer: 4

Local Browser used for validations on the Web Pages uses __________.





✅ Correct Answer: 4

State the correct place of JS Code inside HTML -





✅ Correct Answer: 4

Which of the following Attribute is used to include External JS code inside your HTML Document ?





✅ Correct Answer: 3

Which attribute is used to specifies that the script is executed when the page has finished parsing (only for external scripts) ?





✅ Correct Answer: 2

______ attribute is used to specify the character encoding used in an external script file.





✅ Correct Answer: 2

The async attribute can be set in the following ways -





✅ Correct Answer: 4

We use _______ style comment to prevent showing Java Script as Content in the old browsers.





✅ Correct Answer: 3

What will be the Output of the below Code ? <html> <body> <script type="text/javascript"> <!-- document.print("Hello"); //--> </script> </body> </html>





✅ Correct Answer: 2

Which was the first browser to support JavaScript ?





✅ Correct Answer: 4

JavaScript is invented by ________.





✅ Correct Answer: 1

JavaScript was invented at _______ Lab .





✅ Correct Answer: 1

JavaScript was originally developed under the name _______.





✅ Correct Answer: 2

In March 1996, _______________ was released, featuring support for JavaScript.





✅ Correct Answer: 3

Microsoft Developed a compatible dialect of JavaScript called _____________.





✅ Correct Answer: 1

Executable single line of Script is called as _________________.





✅ Correct Answer: 1

JavaScript Statements are executed by ________ .





✅ Correct Answer: 4

43. Java Statement terminated by ______________ .





✅ Correct Answer: 2

JavaScript code contain sequence of ___________.





✅ Correct Answer: 4

Which of the following statement is used to declare variable in JavaScript ?





✅ Correct Answer: 4

____________ is used to assign value to the variable.





✅ Correct Answer: 1

What will be printed inside webpage ? var message="Hello JS"; document.write(Message);





✅ Correct Answer: 4

Multiple JS statements are written inside pair of ________ to form a statement block.





✅ Correct Answer: 3

Below Code contain one executive Statement. Guess the Output of the Code. <script type="text/javascript"> { document.Write("<h1>This is a heading</h1>"); } </script>





✅ Correct Answer: 4

Group of JavaScript Statements is called as _________





✅ Correct Answer: 1

Single Line Comment in JavaScript Starts with _________ Symbol.





✅ Correct Answer: 2

Which of the following is considered as End of Single line comment ?





✅ Correct Answer: 1

Comments in JS are ignored by ____________.





✅ Correct Answer: 4

Comment Statement is _________________ type of statement.





✅ Correct Answer: 3

JS Comment can be used for following purposes -





✅ Correct Answer: 4

Which of the statement will be neglected by Browser ?





✅ Correct Answer: 3

Person XYZ wrote his name and date of code creation at the start , What kind of comment he has written ?





✅ Correct Answer: 3

Which of the following is not a compound assignment operator ?





✅ Correct Answer: 1

If a string cannot be converted to a number __________ will be returned.





✅ Correct Answer: 1

If the values on either side of '+' operator are numerical values then ___________.





✅ Correct Answer: 2

What will be printed ? <html> <head> <title>A Simple Page</title> <script language="JavaScript"> <!-- var A = "Compile ", B = "Error"; C = A + B; alert(C); // --> </script> </head> <body></body> </html>





✅ Correct Answer: 1

What will be the value of Variable 'output' ? var str = "Str"; var num = 10; var output = str + num;





✅ Correct Answer: 2

During addition of two numbers , suppose one of the number is NaN then output of the following code will be ?





✅ Correct Answer: 1

+Infinity in JS gets added with +Infinity then output of the code will be





✅ Correct Answer: 2

-Infinity in JS gets added with -Infinity then output of the code will be





✅ Correct Answer: 3

Variable can hold ________ value at a time.





✅ Correct Answer: 3

Integer Variable is declared using following syntax in JavaScript.





✅ Correct Answer: 2

We can declare ___________ at a time. Select most appropriate option.





✅ Correct Answer: 2

We can declare all type of variables in JavaScript with the keyword __________





✅ Correct Answer: 1

We can declare all type of variables in JavaScript with the keyword _____________.





✅ Correct Answer: 1

var num; Above Statement is called as __________ Statement.





✅ Correct Answer: 3

Variable name contain following type of characters - 1. Alphabet 2. Digits 3. Underscore 4. Special Characters Select the correct option.





✅ Correct Answer: 4

Spaces,Punctuation marks are called as __________ Symbols in JavaScript.





✅ Correct Answer: 1

Which JavaScript variable cannot be used as First character but can be use after first character ?





✅ Correct Answer: 4

Multiple Declarations of variables are separated by ___________ symbol.





✅ Correct Answer: 3

var var1 = "Pritesh"; Above variable can store value of type -





✅ Correct Answer: 2

var var1 = "Pritesh"; Above variable can store value of type -





✅ Correct Answer: 2