JavaScript/Javascript MCQ Questions Set 1 Sample Test,Sample questions

Question:
 Consider the following code snippet
const pi=3.14;
var pi=4;
console.log(pi);
What will be the output for the above code snippet?

1.This will flash an error

2.Prints 4

3.Prints 3.14

4.Ambiguity

Posted Date:-2022-02-24 01:38:13


Question:
 How many parameters does the method plot() accept?

1. 7

2.8

3.9

4.10

Posted Date:-2022-02-24 02:01:30


Question:
 If para1 is the DOM object for a paragraph, what is the correct syntax to change the text within the paragraph?

1.para1="New Text"

2.para1.value="New Text";

3.para1.firstChild.nodeValue= "New Text";

4.para1.nodeValue="New Text";

Posted Date:-2022-02-24 01:29:10


Question:
 JavaScript ignores?

1.spaces

2.tabs

3.newlines

4.All of the above

Posted Date:-2022-02-24 00:32:20


Question:
 JavaScript is designed for following purpose -

1. to style HTML pages

2. to execute Queries related to databases on a server

3.to add interactivity to html pages

4.All of the above

Posted Date:-2022-02-24 00:33:51


Question:
 What is the need for bubble charts?

1.Represent 2D data

2. Represent 3D data

3.Represent 2D and 3D data

4.Represents meta data

Posted Date:-2022-02-24 03:33:24


Question:
 What should appear at the very end of your JavaScript?
The <script language="javascript"> tag

1. <script>

2.<script>

3.</script language="javascript">

4.All of the above

Posted Date:-2022-02-24 00:58:10


Question:
Among the following, which one is a ternary operator in JavaScript?

A. 

1.#

2.::

3.&:

4.?:

Posted Date:-2022-02-24 00:35:54


Question:
Among the keywords below, which one is not a statement?

1.if

2.with

3.debugger

4.use strict

Posted Date:-2022-02-24 00:58:50


Question:
Choose the correct JavaScript syntax to change the content of the following HTML code.

1.document.getElement ("letsfindcourse").innerHTML = "I am a letsfindcourse";

2.document.getElementById ("letsfindcourse").innerHTML = "I am a letsfindcourse";

3.document.getId ("letsfindcourse") = "I am a letsfindcourse";

4.document.getElementById ("letsfindcourse").innerHTML = I am a letsfindcourse;

Posted Date:-2022-02-24 00:21:03


Question:
Consider the code snippet given below
  var count = [1,,3];
What is the observation made?

1.The omitted value takes "undefined"

2.This results in an error

3.This results in an exception

4.The omitted value takes an integer value

Posted Date:-2022-02-24 01:49:41


Question:
Does JavaScript allow exception handling?

1.Yes, it provides try, catch as well as throw key word for exception handling

2.Yes, but it provides only try block

3.Yes, but it provides only Try catch block, but does not allow throw exception

4.No

Posted Date:-2022-02-24 01:20:03


Question:
Find output of below code
var a = '20';
var b = a = 30;
document.write(a+b);

1. Error in Script

2.'20'30

3.2030

4.50

Posted Date:-2022-02-24 01:08:28


Question:
Find output of below Javascript addition code
document.write("1 plus 1 is " + 1 + 1);

1.2

2.1 plus 1 is 2

3.1 plus 1 is 11

4.1 plus 1 is 1 + 1

Posted Date:-2022-02-24 01:16:08


Question:
From which version of IE is canvas supported?

1.6

2.7

3.8

4.9

Posted Date:-2022-02-24 01:59:56


Question:
HomeSite 5 is a well-liked HTML and JavaScript editor from Macromedia.

1.True

2.False

3.Can be true or false

4.Can not say

Posted Date:-2022-02-24 00:31:17


Question:
How ++ works in Javascript? Find output of below Javascript code.
var a = 1;
document.write(a--);
document.write(a);

1.00

2.01

3.11

4.10

Posted Date:-2022-02-24 01:13:46


Question:
How do we define the term Thread?

1.Device that controls input

2.Variable that controls movement

3.Controlled execution of applications

4.None of the above

Posted Date:-2022-02-24 00:59:49


Question:
How to get a particular value using the tagged name?

1. getElementbyID()

2.getElementsbyName()

3.getElementsbyTagName()

4.getTagName()

Posted Date:-2022-02-24 03:35:04


Question:
Inside which HTML element do we put the JavaScript?

1.<script>

2.<head>

3.<meta>

4.<style>

Posted Date:-2022-02-24 00:17:53


Question:
JavaScript can be written __________

1.directly into JS file and included into HTML

2.directly on the server page

3.directly into HTML pages

4.directly into the css file

Posted Date:-2022-02-24 02:17:34


Question:
Javascript is ideal to?

1.make computations in HTML simpler

2.minimize storage requirements on the web server

3. increase the download time for the client

4.None of the mentioned

Posted Date:-2022-02-24 01:43:37


Question:
Microsoft has developed a popular HTML editor called?

1.Dreamweaver

2.FrontPage

3.HomeSite

4.Macromedia

Posted Date:-2022-02-24 00:25:46


Question:
Syntax for creating a RegExp object:
1. var txt=new RegExp(pattern,attributes);
2. var txt=/pattern/attributes;
Which of the above mentioned syntax will correct?

1.1 only

2.2 only

3.Both 1 and 2

4.None of the above

Posted Date:-2022-02-24 01:28:05


Question:
The meaning for Augmenting classes is that:

1.objects inherit prototype properties even in dynamic state

2. objects inherit prototype properties only in dynamic state

3.objects inherit prototype properties in static state

4.object doesn’t inherit prototype properties in static state

Posted Date:-2022-02-24 01:46:43


Question:
The pop() method of the array does which of the following task ?

1.decrements the total length by 1

2.increments the total length by 1

3.prints the first element but no effect on the length

4.updates the element

Posted Date:-2022-02-24 03:22:33


Question:
The syntax of Eval is ________________

1. [objectName.]eval(numeric)

2.[objectName.]eval(string)

3.[EvalName.]eval(string)

4.[EvalName.]eval(numeric)

Posted Date:-2022-02-24 01:30:18


Question:
The _______ method of an Array object adds and/or removes elements from an array.

1.Reverse

2.Shift

3.Slice

4.Splice

Posted Date:-2022-02-24 01:35:49


Question:
What are the three important manipulations done in a for loop on a loop variable in javascript?

1.the initialization, the Incrementation, and update

2. the initialization, the test, and the update

3.the initialization, the test, and Incrementation

4.All of the above

Posted Date:-2022-02-24 00:56:14


Question:
What are the two basic groups of dataypes in JavaScript?

1.Primitive

2.Reference types.

3.All of the above

4.None of the above

Posted Date:-2022-02-24 01:04:32


Question:
What are the types of Pop up boxes available in JavaScript?

1.Alert

2.Prompt

3.Confirm

4.All of the above

Posted Date:-2022-02-24 01:01:31


Question:
What does javascript use instead of == and !=?

1.It uses bitwise checking

2.It uses === and !== instead

3. It uses equals() and notequals() instead

4.It uses equalto()

Posted Date:-2022-02-24 00:57:13


Question:
What does the interpreter do when you reference variables in other scopes?

1.Traverses the queue

2.Traverses the stack

3. Finds the bugs

4.Traverse the array

Posted Date:-2022-02-24 01:52:12


Question:
What if we put ++ operator inside if condition? find the output of below code
< script>
var a = 10;
if(a == a++)
document.write(a);

1.Error

2.Nothing is printed

3.10

4.11

Posted Date:-2022-02-24 01:25:35


Question:
What if you use parseInt() to convert a string containing decimal value?

1.Throws Error

2. It returns the decimal values in string form

3.If returns only the integer portion of the number

4.None of the listed option

Posted Date:-2022-02-24 01:22:40


Question:
What if you use parseInt() to convert a string containing decimal value?

1.Throws Error

2.It returns the decimal values in string form

3.If returns only the integer portion of the number

4.None of the listed option

Posted Date:-2022-02-24 01:23:36


Question:
What is a closure?

1.Function objects

2.Scope where function’s variables are resolved

3.Both Function objects and Scope where function’s variables are resolved

4.Function return value

Posted Date:-2022-02-24 03:29:24


Question:
What is divide by 0 in Javascript? var a = 10;
var b = 0;
document.write(a/b);

1.Nothing is printed

2.0 is printed

3. Infinity is printed

4.Some Garbage Value

Posted Date:-2022-02-24 01:09:07


Question:
What is the correct syntax for referring to an external script called "LFC.js"?

1.<script src="LFC.js">

2.<script source="LFC.js">

3.<script ref="LFC.js">

4.<script type="LFC.js">

Posted Date:-2022-02-24 03:39:01


Question:
What is the default value of the asyc attribute?

1.0

2.1

3.False

4.True

Posted Date:-2022-02-24 01:38:53


Question:
what is the disadvantage of using innerHTML in JavaScript?

1.Content can not be replaced everywhere

2.We can use like "appending to innerHTML

3.Even if you use +=like "innerHTML = innerHTML + 'html'" still the old content is replaced by html

4.The entire innerHTML content is not re-parsed and build into elements, therefore its not slower

Posted Date:-2022-02-24 01:03:39


Question:
What is the original name of JavaScript?

1.LiveScript

2.EScript

3.Mocha

4.JavaScript

Posted Date:-2022-02-24 03:43:14


Question:
What is the output of below Javascript code?
alert (typeof new Date() );


1.Throws Error

2.object

3. Displays Nothing

4.Current Date

Posted Date:-2022-02-24 01:24:36


Question:
What is the output of following Javascript?
var a = 'letsfind';
var b = 'course';
var c = a/b;
document.write(c);

1.letsfindcourse

2.letsfind/course

3.NaN

4.None of the above

Posted Date:-2022-02-24 01:13:04


Question:
What is the purpose of script loading?

1. Load Scripts programmatically

2.Load JavaScript files manually

3.Load JavaScript files programmatically

4.All of the mentioned

Posted Date:-2022-02-24 02:02:43


Question:
What is the purpose of the Attr object in the HTML DOM?

1.Used to focus on a particular part of the HTML page

2.HTML Attribute

3.Used to arrange elements

4.None of the mentioned

Posted Date:-2022-02-24 01:39:53


Question:
What is the purpose of the Attr object in the HTML DOM?

1. A. Used to focus on a particular part of the HTML page

2.HTML Attribute

3.Used to arrange elements

4.None of the mentioned

Posted Date:-2022-02-24 01:41:16


Question:
What must be done in order to implement Lexical Scoping?

1. Get the object

2.Dereference the current scope chain

3.Reference the current scope chain

4.Return the value

Posted Date:-2022-02-24 01:57:53


Question:
What must be done in order to implement Lexical Scoping?

1. Get the object

2.Dereference the current scope chain

3.Reference the current scope chain

4.Return the value

Posted Date:-2022-02-24 01:59:10


Question:
What will be the output of the following Javascript code?
    var string1 = "Letsfindcourse";
    var intvalue = 30;
    alert( string1 + intvalue );

1. Letsfindcourse 30

2.30

3.Letsfindcourse30

4.Exception

Posted Date:-2022-02-24 00:35:04


Question:
What will be the return value of the write() method when the Node cannot write the data immediately and has to buffer it internally?

1. 0

2.1

3.True

4.False

Posted Date:-2022-02-24 03:23:58


Question:
What will happen if you reference document.location from within an object?

1.Traverses the queue

2.Finds the bugs

3.Traverses the stack

4.Traverses the array

Posted Date:-2022-02-24 03:24:54


Question:
When a class B can extend another class A, we say that:

1. A is the superclass and B is the subclass

2.B is the superclass and A is the subclass

3. Both A and B are the superclass

4. Both A and B are the subclass

Posted Date:-2022-02-24 02:19:23


Question:
Which among the following POSIX signals generate events?

1.SIGDOWN

2.SIGFLOAT

3.SIGINT

4.SIGSHORT

Posted Date:-2022-02-24 01:42:22


Question:
Which company developed JavaScript?

1.Netscape

2.Bell Labs

3.Sun Microsystems

4.IBM

Posted Date:-2022-02-24 00:12:32


Question:
Which is the handler method used to invoke when uncaught JavaScript exceptions occur?

1.Onhalt

2.Onerror

3.Both onhalt and onerror

4.Onsuspend

Posted Date:-2022-02-24 01:47:51


Question:
Which is the method invoked to connect the last vertex back to the first?

1. closePath()

2.close()

3.connectlast(first)

4. connect()

Posted Date:-2022-02-24 03:32:11


Question:
Which method receives the return value of setInterval() to cancel future invocations?

1.clearInvocation()

2.cancelInvocation()

3.clearInterval()

4. clear()

Posted Date:-2022-02-24 03:21:32


Question:
which of the following are advantages of JavaScript?

1.Less server interaction

2.Increased interactivity

3.Richer interfaces

4.All of the above

Posted Date:-2022-02-24 00:22:39


Question:
Which of the following are the functional components in JavaScript?

1.First-class functions

2.Encapsulated-class functions

3.Fixed-class functions

4.All of the above

Posted Date:-2022-02-24 01:05:28


Question:
Which of the following function of Array object applies a function simultaneously against two values of the array (from right-to-left) as to reduce it to a single value?

1.pop()

2.reduce()

3.push()

4.reduceRight()

Posted Date:-2022-02-24 01:12:06


Question:
Which of the following is correct about features of JavaScript?

1.It can not Handling dates and time.

2.JavaScript is a object-based scripting language.

3.JavaScript is not interpreter based scripting language.

4.All of the above

Posted Date:-2022-02-24 00:19:07


Question:
Which of the following is not JavaScript Data Types?

1.Undefined

2.Number

3.Boolean

4.Float

Posted Date:-2022-02-24 00:11:40


Question:
Which of the following is not Javascript frameworks or libraries?

1.Polymer

2.Meteor

3.Cassandra

4.jQuery

Posted Date:-2022-02-24 03:39:56


Question:
Which of the following is not the properties of screen objects in JavaScript?

1.AvailHeight

2.ColorsDepth

3.AvailWidth

4.ColorDepth

Posted Date:-2022-02-24 01:07:27


Question:
Which of the following is the correct syntax to display "Letsfindcourse" in an alert box using JavaScript?

1.alert-box("Letsfindcourse"); B.

2.confirm("Letsfindcourse");

3.msgbox("Letsfindcourse");

4.alert("Letsfindcourse");

Posted Date:-2022-02-24 03:37:02


Question:
Which of the following is true?

1. If onKeyDown returns false, the key-press event is cancelled.

2. If onKeyPress returns false, the key-down event is cancelled.

3. If onKeyDown returns false, the key-up event is cancelled.

4. If onKeyPress returns false, the key-up event is canceled.

Posted Date:-2022-02-24 01:27:02


Question:
Which of the following method checks if its argument is not a number?

1.isNaN()

2. nonNaN()

3.NaN()

4.None of the above

Posted Date:-2022-02-24 01:21:32


Question:
Which of the following true about Javascript?

1. A. Client-side JavaScript does not allow the reading or writing of files

2. JavaScript cannot be used for networking applications

3.JavaScript doesn't have any multi-threading or multiprocessor capabilities

4.All of the above

Posted Date:-2022-02-24 00:24:20


Question:
Which symbol is used for comments in Javascript?

1.\

2. //

3.* *

4. * */

Posted Date:-2022-02-24 01:00:45


Question:
Which tag(s) can handle mouse events in Netscape?

1. <IMG>

2.<A>

3. <BR>

4.<span>

Posted Date:-2022-02-24 01:37:07


Question:
Why so JavaScript and Java have similar name?

1.JavaScript is a stripped-down version of Java .

2. JavaScript's syntax is loosely based on Java's

3.They both originated on the island of Java

4.None of the above

Posted Date:-2022-02-24 03:42:14


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!