JavaScript/JAVASCRIPT MCQ Sample Test,Sample questions

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

1.+Infinity

2.NaN

3.-Infinity

4.None of the above

Posted Date:-2022-06-09 09:35:54


Question:
	
Comments in JS are ignored by ____________.

1.Compiler

2.Operating System

3. JVM

4.Browser

Posted Date:-2022-06-09 08:20:24


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

1.using typeof operator

2.using getType function

3.Both of the above.

4.None of the above

Posted Date:-2022-06-08 16:18:49


Question:
	
JavaScript code contain sequence of ___________.

1.HTML Tags

2.Method Calls

3.Executable Statements

4.All of the these

Posted Date:-2022-06-09 07:26:14


Question:
	
JS Comment can be used for following purposes -

1.to Hide Non-usable line

2.to Hide Non-usable Multiline Code

3.used for Documentation

4.All of these

Posted Date:-2022-06-09 08:28:16


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

1. Functional Comment

2.Code Hiding Comment

3. Documentation Comment

4.None of These

Posted Date:-2022-06-09 08:42:02


Question:
	
State the correct place of JS Code inside HTML -

1.Inside Body

2.Inside Head

3.Inside Single JavaScript File

4.All of these

Posted Date:-2022-06-08 16:33:13


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

1.concat()

2.match()

3.replace()

4.search()

Posted Date:-2022-06-08 16:15:37


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

1.named function

2.anonymous function

3.Both of the above

4.None of the above

Posted Date:-2022-06-08 16:17:55


Question:
	
Which of the following is not a compound assignment operator ?

1.===

2.<<=

3.+=

4.>>=

Posted Date:-2022-06-09 09:12:50


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

1.NaN

2.+Infinity

3.-Infinity

4.Null

Posted Date:-2022-06-09 09:34:50


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

1.Timeout( )

2.TimeInterval( )

3.setTimeout ( )

4.All of the above

Posted Date:-2022-06-08 16:20:50


Question:
43.	
Java Statement terminated by ______________ .

1.Slash

2.Semicolon

3.Full Stop

4.Comma

Posted Date:-2022-06-09 07:25:15


Question:
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>

1."This is a heading" will be printed in H1 heading

2.Just "This is a heading" will be printed because HTML tags are not allowed

3.Will not print anything

4.None of these

Posted Date:-2022-06-09 08:15:44


Question:
Comment Statement is _________________ type of statement.

1.Executive

2.Non Important

3.Non Executable

4. Non Usable

Posted Date:-2022-06-09 08:22:18


Question:
Cost for Using JavaScript in your HTML is _________ .

1.Its Free !!!

2. $10 / Year

3.$15 / Year

4. $5 / Year

Posted Date:-2022-06-08 16:27:05


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

1.NaN

2.Zero

3.Infinite

4.Null

Posted Date:-2022-06-09 09:33:06


Question:
Executable single line of Script is called as _________________.

1.Statement in JavaScript

2.Breakpoint in JS

3.Line in JS

4.None of These

Posted Date:-2022-06-09 07:23:05


Question:
Group of JavaScript Statements is called as _________

1.Statement Block

2.Group

3.Cluster

4. Code Block

Posted Date:-2022-06-09 08:16:54


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

1. NaN

2.Infinite

3.Null

4.Zero

Posted Date:-2022-06-09 09:15:08


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

1.values are concatenated together

2.values are added together

3.no effect

4.None of These

Posted Date:-2022-06-09 09:28:52


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

1.Netscape Navigator 1.0

2.Internet Explorer 2.0

3.Netscape Navigator 2.0

4.Internet Explorer 1.0

Posted Date:-2022-06-09 07:20:53


Question:
Integer Variable is declared using following syntax in JavaScript.

1. Integer num;

2.var num;

3. int num;

4.integer num;

Posted Date:-2022-06-09 09:41:00


Question:
Java Script entities start with ___________and end with _____________.

1. Semicolon, colon

2.Semicolon, Ampersand

3.Ampersand, colon

4.Ampersand, semicolon

Posted Date:-2022-06-08 16:22:09


Question:
JavaScript Code is written inside file having extension __________.

1..jvs

2..javascript

3. .js

4. .jsc

Posted Date:-2022-06-08 16:28:29


Question:
JavaScript is invented by ________.

1.Brendan Eich

2.Helsinki, Linus

3.W3 Group

4.James Gosling

Posted Date:-2022-06-09 07:17:48


Question:
JavaScript is ______ Side Scripting Language.

1. Server

2.ISP

3.Browser

4.None of the these

Posted Date:-2022-06-08 16:25:50


Question:
Javascript is _________ language.

1.Programming

2.Application

3.Scripting

4.None of These

Posted Date:-2022-06-08 16:24:38


Question:
JavaScript Statements are executed by ________ .

1.Server

2.JVM

3.Compiler

4.Browser

Posted Date:-2022-06-09 07:24:00


Question:
JavaScript was invented at _______ Lab .

1.Netscape

2.Google Lab

3.AT&T Bell Lab

4.Sun Microsystem

Posted Date:-2022-06-09 07:18:44


Question:
JavaScript was originally developed under the name _______.

1.ActionScript

2.Mocha

3.Oak

4.Sencha

Posted Date:-2022-06-09 07:19:40


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

1.Java

2.CSS

3.HTML

4.JS

Posted Date:-2022-06-08 16:32:25


Question:
Microsoft Developed a compatible dialect of JavaScript called _____________.

1.JScript

2.MS JavaScript

3.MJavaScript

4.Advanced JavaScript

Posted Date:-2022-06-09 07:21:57


Question:
Multiple Declarations of variables are separated by ___________ symbol.

1.Semicolon

2.Colon

3.Comma

4.Asterisk

Posted Date:-2022-06-09 10:32:20


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

1. Pair of Square Brackets

2.Pair of Round Brackets

3.Pair of Curly braces

4.None of these

Posted Date:-2022-06-09 07:31:27


Question:
Single Line Comment in JavaScript Starts with _________ Symbol.

1.""

2. "//"

3. "$$"

4."#"

Posted Date:-2022-06-09 08:18:34


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

1. Special

2.Punctual

3.Mandetory

4. None of these

Posted Date:-2022-06-09 10:29:31


Question:
The async attribute can be set in the following ways -

1.<script async>

2.<script async="">

3.<script async="async">

4.All of the these

Posted Date:-2022-06-09 07:13:24


Question:
var num;
Above Statement is called as __________ Statement.

1.Instantization

2.Globalization

3. Declaration

4.Initialization

Posted Date:-2022-06-09 10:25:59


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

1.Integer

2.String

3.Any Type

4.None of these

Posted Date:-2022-06-09 10:33:22


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

1.Integer

2.String

3.Any Type

4.None of These

Posted Date:-2022-06-09 10:36:11


Question:
Variable can hold ________ value at a time.

1. Multiple

2.Double

3.Single

4.None of These

Posted Date:-2022-06-09 09:39:39


Question:
Variable name contain following type of characters -

1. Alphabet
2. Digits
3. Underscore
4. Special Characters

Select the correct option.

1.3 4 2

2.4 3 1

3.1 2 3 4

4.1 2 3

Posted Date:-2022-06-09 10:27:56


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

1.var

2.obj

3.jvar

4.None of these

Posted Date:-2022-06-09 09:44:50


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

1. var

2.obj

3.jvar

4.None of These

Posted Date:-2022-06-09 10:24:16


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

1.One Variable Only

2.One or more Variables

3.More than One Variables

4.None of these

Posted Date:-2022-06-09 09:43:16


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

1.JS

2.CSS

3.HTML

4.C

Posted Date:-2022-06-09 07:14:34


Question:
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>

1."Compile Error" will be printed

2."Compile" will be printed

3.Nothing will be printed

4.None of the above

Posted Date:-2022-06-09 09:30:31


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

1.It will crash browser since No Error handler is provided

2.Hello JS

3."Hello JS" will be printed multiple times

4.Nothing Will be printed because Code is not error free

Posted Date:-2022-06-09 07:30:17


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

1.Will Throw Error

2.Hello

3.Will not print anything because of Comment

4.None of These

Posted Date:-2022-06-09 07:15:43


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

var output = str + num;

1.Nothing will be printed

2.Str10

3.Null

4.NaN

Posted Date:-2022-06-09 09:32:06


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

1. type

2.defer

3.async

4. parse

Posted Date:-2022-06-08 16:35:56


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

1. toUpperCase()

2.toUpperCase()

3.changeCase(case)

4.None of the above

Posted Date:-2022-06-08 16:05:35


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

1.Asterisk

2.Dollar Sign

3.Underscore

4.Digit

Posted Date:-2022-06-09 10:30:42


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

1.link

2.script

3.ext

4.ext

Posted Date:-2022-06-08 16:34:17


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

1.reverse()

2. shift()

3. slice()

4.some()

Posted Date:-2022-06-08 16:19:45


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

1. toString()

2.valueOf()

3.toLocaleString()

4.toPrecision()

Posted Date:-2022-06-08 16:06:37


Question:
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?

1.sup()

2.small

3.strike()

4. sub()

Posted Date:-2022-06-08 16:09:33


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

1.anchor()

2.link()

3.blink()

4.big()

Posted Date:-2022-06-08 16:08:28


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

1. charAt()

2.charCodeAt()

3.concat()

4.indexOf()

Posted Date:-2022-06-08 16:14:33


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

1.toLocaleUpperCase()

2. toUpperCase()

3. toString()

4.substring()

Posted Date:-2022-06-08 16:16:48


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

1.substr()

2.search()

3.lastIndexOf()

4.indexOf()

Posted Date:-2022-06-08 16:07:38


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

1.Function

2.File

3.FileUpload

4.Date

Posted Date:-2022-06-08 16:23:17


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

1.End of Line

2.Semicolon

3.End of Statement

4."*/" Symbol

Posted Date:-2022-06-09 08:19:37


Question:
Which of the following is correct about JavaScript?

1.JavaScript is a lightweight, interpreted programming language.

2.JavaScript has object-oriented capabilities that allows you to build interactivity into otherwise static HTML pages.

3.The general-purpose core of the language has been embedded in Netscape, Internet Explorer, and other web browsers.

4.All of the above

Posted Date:-2022-06-08 15:59:48


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

1.window.print();

2.browser.print();

3.navigator.print();

4.document.print();

Posted Date:-2022-06-08 16:00:48


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

1.document.location='http://www.newlocation.com';

2.browser.location='http://www.newlocation.com';

3. navigator.location='http://www.newlocation.com';

4.window.location='http://www.newlocation.com';

Posted Date:-2022-06-08 16:11:57


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

1.You should not use any of the JavaScript reserved keyword as variable name.

2.JavaScript variable names should not start with a numeral (0-9).

3.Both of the above.

4.None of These

Posted Date:-2022-06-08 16:10:41


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

1.Assignment Statement

2.Conditional Statement

3.Executable Statement

4.Declaration Statement

Posted Date:-2022-06-09 07:27:12


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

1. global variable

2. local variable

3. Both of the above.

4.None of the above

Posted Date:-2022-06-08 16:02:56


Question:
Which of the statement will be neglected by Browser ?

1.<p>Google</p>

2.<p>Yahoo</p>

3.<h1>Heading</h1>

4.All Statements

Posted Date:-2022-06-09 08:40:57


Question:
Which was the first browser to support JavaScript ?

1.Mozilla Firefox

2.Google Chrome

3.IE

4.Netscape

Posted Date:-2022-06-09 07:16:42


Question:
Why JavaScript is called as Lightweight Programming Language ?

1.because JS is available free of cost

2.because JS is client side scripting

3.because we can add programming functionality inside JS

4.because JS can provide programming functionality inside but up to certain extend

Posted Date:-2022-06-08 16:30:15


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

1.type

2.charset

3.character

4.None of These

Posted Date:-2022-06-09 07:11:49


Question:
____________ is used to assign value to the variable.

1.Assignment Statement in JavaScript

2.Declaration Statement

3.Conditional Statement

4.Executable Statement

Posted Date:-2022-06-09 07:29:09


More MCQS

  1. JavaScript MCQ Questions And Answers
  2. JavaScript MCQ Questions And Answers Set 2
  3. JavaScript MCQ Set 1
  4. JavaScript MCQ Set 2
  5. Javascript MCQ Questions Set 1
  6. Javascript Multiple Choice Questions
  7. JAVASCRIPT MCQ
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!