R4RIN
Articles
Java 8
MCQS
JavaScript MCQ Quiz Hub
Javascript MCQ Questions Set 1
Choose a topic to test your knowledge and improve your JavaScript skills
1. Which of the following is not JavaScript Data Types?
Undefined
Number
Boolean
Float
2. Which company developed JavaScript?
Netscape
Bell Labs
Sun Microsystems
IBM
3. Inside which HTML element do we put the JavaScript?
<script>
<head>
<meta>
<style>
4. Which of the following is correct about features of JavaScript?
It can not Handling dates and time.
JavaScript is a object-based scripting language.
JavaScript is not interpreter based scripting language.
All of the above
5. Choose the correct JavaScript syntax to change the content of the following HTML code.
document.getElement ("letsfindcourse").innerHTML = "I am a letsfindcourse";
document.getElementById ("letsfindcourse").innerHTML = "I am a letsfindcourse";
document.getId ("letsfindcourse") = "I am a letsfindcourse";
document.getElementById ("letsfindcourse").innerHTML = I am a letsfindcourse;
6. which of the following are advantages of JavaScript?
Less server interaction
Increased interactivity
Richer interfaces
All of the above
7. Which of the following true about Javascript?
A. Client-side JavaScript does not allow the reading or writing of files
JavaScript cannot be used for networking applications
JavaScript doesn't have any multi-threading or multiprocessor capabilities
All of the above
8. Microsoft has developed a popular HTML editor called?
Dreamweaver
FrontPage
HomeSite
Macromedia
9. HomeSite 5 is a well-liked HTML and JavaScript editor from Macromedia.
True
False
Can be true or false
Can not say
10. JavaScript ignores?
spaces
tabs
newlines
All of the above
11. JavaScript is designed for following purpose -
to style HTML pages
to execute Queries related to databases on a server
to add interactivity to html pages
All of the above
12. What will be the output of the following Javascript code? var string1 = "Letsfindcourse"; var intvalue = 30; alert( string1 + intvalue );
Letsfindcourse 30
30
Letsfindcourse30
Exception
13. Among the following, which one is a ternary operator in JavaScript? A.
#
::
&:
?:
14. What are the three important manipulations done in a for loop on a loop variable in javascript?
the initialization, the Incrementation, and update
the initialization, the test, and the update
the initialization, the test, and Incrementation
All of the above
15. What does javascript use instead of == and !=?
It uses bitwise checking
It uses === and !== instead
It uses equals() and notequals() instead
It uses equalto()
16. What should appear at the very end of your JavaScript? The <script language="javascript"> tag
&lt;script&gt;
&lt;script&gt;
&lt;/script language=&quot;javascript&quot;&gt;
All of the above
17. Among the keywords below, which one is not a statement?
if
with
debugger
use strict
18. How do we define the term Thread?
Device that controls input
Variable that controls movement
Controlled execution of applications
None of the above
19. Which symbol is used for comments in Javascript?
\
//
* *
* */
20. What are the types of Pop up boxes available in JavaScript?
Alert
Prompt
Confirm
All of the above
21. what is the disadvantage of using innerHTML in JavaScript?
Content can not be replaced everywhere
We can use like &quot;appending to innerHTML
Even if you use +=like &quot;innerHTML = innerHTML + &#039;html&#039;&quot; still the old content is replaced by html
The entire innerHTML content is not re-parsed and build into elements, therefore its not slower
22. What are the two basic groups of dataypes in JavaScript?
Primitive
Reference types.
All of the above
None of the above
23. Which of the following are the functional components in JavaScript?
First-class functions
Encapsulated-class functions
Fixed-class functions
All of the above
24. Which of the following is not the properties of screen objects in JavaScript?
AvailHeight
ColorsDepth
AvailWidth
ColorDepth
25. Find output of below code var a = '20'; var b = a = 30; document.write(a+b);
Error in Script
&#039;20&#039;30
2030
50
26. What is divide by 0 in Javascript? var a = 10; var b = 0; document.write(a/b);
Nothing is printed
0 is printed
Infinity is printed
Some Garbage Value
27. 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?
pop()
reduce()
push()
reduceRight()
28. What is the output of following Javascript? var a = 'letsfind'; var b = 'course'; var c = a/b; document.write(c);
letsfindcourse
letsfind/course
NaN
None of the above
29. How ++ works in Javascript? Find output of below Javascript code. var a = 1; document.write(a--); document.write(a);
00
01
11
10
30. Find output of below Javascript addition code document.write("1 plus 1 is " + 1 + 1);
2
1 plus 1 is 2
1 plus 1 is 11
1 plus 1 is 1 + 1
31. Does JavaScript allow exception handling?
Yes, it provides try, catch as well as throw key word for exception handling
Yes, but it provides only try block
Yes, but it provides only Try catch block, but does not allow throw exception
No
32. Which of the following method checks if its argument is not a number?
isNaN()
nonNaN()
NaN()
None of the above
33. What if you use parseInt() to convert a string containing decimal value?
Throws Error
It returns the decimal values in string form
If returns only the integer portion of the number
None of the listed option
34. What if you use parseInt() to convert a string containing decimal value?
Throws Error
It returns the decimal values in string form
If returns only the integer portion of the number
None of the listed option
35. What is the output of below Javascript code? alert (typeof new Date() );
Throws Error
object
Displays Nothing
Current Date
36. What if we put ++ operator inside if condition? find the output of below code < script> var a = 10; if(a == a++) document.write(a);
Error
Nothing is printed
10
11
37. Which of the following is true?
If onKeyDown returns false, the key-press event is cancelled.
If onKeyPress returns false, the key-down event is cancelled.
If onKeyDown returns false, the key-up event is cancelled.
If onKeyPress returns false, the key-up event is canceled.
38. 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 only
2 only
Both 1 and 2
None of the above
39. If para1 is the DOM object for a paragraph, what is the correct syntax to change the text within the paragraph?
para1=&quot;New Text&quot;
para1.value=&quot;New Text&quot;;
para1.firstChild.nodeValue= &quot;New Text&quot;;
para1.nodeValue=&quot;New Text&quot;;
40. The syntax of Eval is ________________
[objectName.]eval(numeric)
[objectName.]eval(string)
[EvalName.]eval(string)
[EvalName.]eval(numeric)
41. The _______ method of an Array object adds and/or removes elements from an array.
Reverse
Shift
Slice
Splice
42. Which tag(s) can handle mouse events in Netscape?
&lt;IMG&gt;
&lt;A&gt;
&lt;BR&gt;
&lt;span&gt;
43. 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?
This will flash an error
Prints 4
Prints 3.14
Ambiguity
44. What is the default value of the asyc attribute?
0
1
False
True
45. What is the purpose of the Attr object in the HTML DOM?
Used to focus on a particular part of the HTML page
HTML Attribute
Used to arrange elements
None of the mentioned
46. What is the purpose of the Attr object in the HTML DOM?
A. Used to focus on a particular part of the HTML page
HTML Attribute
Used to arrange elements
None of the mentioned
47. Which among the following POSIX signals generate events?
SIGDOWN
SIGFLOAT
SIGINT
SIGSHORT
48. Javascript is ideal to?
make computations in HTML simpler
minimize storage requirements on the web server
increase the download time for the client
None of the mentioned
49. The meaning for Augmenting classes is that:
objects inherit prototype properties even in dynamic state
objects inherit prototype properties only in dynamic state
objects inherit prototype properties in static state
object doesn’t inherit prototype properties in static state
50. Which is the handler method used to invoke when uncaught JavaScript exceptions occur?
Onhalt
Onerror
Both onhalt and onerror
Onsuspend
51. Consider the code snippet given below var count = [1,,3]; What is the observation made?
The omitted value takes &quot;undefined&quot;
This results in an error
This results in an exception
The omitted value takes an integer value
52. What does the interpreter do when you reference variables in other scopes?
Traverses the queue
Traverses the stack
Finds the bugs
Traverse the array
53. What must be done in order to implement Lexical Scoping?
Get the object
Dereference the current scope chain
Reference the current scope chain
Return the value
54. What must be done in order to implement Lexical Scoping?
Get the object
Dereference the current scope chain
Reference the current scope chain
Return the value
55. From which version of IE is canvas supported?
6
7
8
9
56. How many parameters does the method plot() accept?
7
8
9
10
57. What is the purpose of script loading?
Load Scripts programmatically
Load JavaScript files manually
Load JavaScript files programmatically
All of the mentioned
58. JavaScript can be written __________
directly into JS file and included into HTML
directly on the server page
directly into HTML pages
directly into the css file
59. When a class B can extend another class A, we say that:
A is the superclass and B is the subclass
B is the superclass and A is the subclass
Both A and B are the superclass
Both A and B are the subclass
60. Which method receives the return value of setInterval() to cancel future invocations?
clearInvocation()
cancelInvocation()
clearInterval()
clear()
61. The pop() method of the array does which of the following task ?
decrements the total length by 1
increments the total length by 1
prints the first element but no effect on the length
updates the element
62. What will be the return value of the write() method when the Node cannot write the data immediately and has to buffer it internally?
0
1
True
False
63. What will happen if you reference document.location from within an object?
Traverses the queue
Finds the bugs
Traverses the stack
Traverses the array
64. What is a closure?
Function objects
Scope where function’s variables are resolved
Both Function objects and Scope where function’s variables are resolved
Function return value
65. Which is the method invoked to connect the last vertex back to the first?
closePath()
close()
connectlast(first)
connect()
66. What is the need for bubble charts?
Represent 2D data
Represent 3D data
Represent 2D and 3D data
Represents meta data
67. How to get a particular value using the tagged name?
getElementbyID()
getElementsbyName()
getElementsbyTagName()
getTagName()
68. Which of the following is the correct syntax to display "Letsfindcourse" in an alert box using JavaScript?
alert-box(&quot;Letsfindcourse&quot;); B.
confirm(&quot;Letsfindcourse&quot;);
msgbox(&quot;Letsfindcourse&quot;);
alert(&quot;Letsfindcourse&quot;);
69. What is the correct syntax for referring to an external script called "LFC.js"?
&lt;script src=&quot;LFC.js&quot;&gt;
&lt;script source=&quot;LFC.js&quot;&gt;
&lt;script ref=&quot;LFC.js&quot;&gt;
&lt;script type=&quot;LFC.js&quot;&gt;
70. Which of the following is not Javascript frameworks or libraries?
Polymer
Meteor
Cassandra
jQuery
71. Why so JavaScript and Java have similar name?
JavaScript is a stripped-down version of Java .
JavaScript&#039;s syntax is loosely based on Java&#039;s
They both originated on the island of Java
None of the above
72. What is the original name of JavaScript?
LiveScript
EScript
Mocha
JavaScript
Submit