Javascript MCQ Questions

Javascript MCQs :

This section focuses on javascript mcq. These Multiple Choice Questions should be practiced to improve the Javascript skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

1. Which of the following is not JavaScript Data Types?

A. Undefined
B. Number
C. Boolean
D. Float

View Answer


2. Which company developed JavaScript?

A. Netscape
B. Bell Labs
C. Sun Microsystems
D. IBM

View Answer


3. Inside which HTML element do we put the JavaScript?

A. <script>
B. <head>
C. <meta>
D. <style>

View Answer


4. Which of the following is correct about features of JavaScript?

A. It can not Handling dates and time.
B. JavaScript is a object-based scripting language.
C. JavaScript is not interpreter based scripting language.
D. All of the above

View Answer


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

A. document.getElement ("letsfindcourse").innerHTML = "I am a letsfindcourse";
B. document.getElementById ("letsfindcourse").innerHTML = "I am a letsfindcourse";
C. document.getId ("letsfindcourse") = "I am a letsfindcourse";
D. document.getElementById ("letsfindcourse").innerHTML = I am a letsfindcourse;

View Answer


If you are getting started in JavaScript, you can check out this free course for beginners.

6. Which of the following are advantages of JavaScript?

A. Less server interaction
B. Increased interactivity
C. Richer interfaces
D. All of the above

View Answer


7. Which of the following true about Javascript?

A. Client-side JavaScript does not allow the reading or writing of files
B. JavaScript cannot be used for networking applications
C. JavaScript doesn't have any multi-threading or multiprocessor capabilities
D. All of the above

View Answer


8. Microsoft has developed a popular HTML editor called?

A. Dreamweaver
B. FrontPage
C. HomeSite
D. Macromedia

View Answer


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

A. True
B. False
C. Can be true or false
D. Can not say

View Answer


10. JavaScript ignores?

A. spaces
B. tabs
C. newlines
D. All of the above

View Answer


11. JavaScript is designed for following purpose -

A. to style HTML pages
B. to execute Queries related to databases on a server
C. to add interactivity to html pages
D. All of the above

View Answer


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

A. Letsfindcourse 30
B. 30
C. Letsfindcourse30
D. Exception

View Answer


13. Among the following, which one is a ternary operator in JavaScript?

A. #
B. ::
C. &:
D. ?:

View Answer


14. What are the three important manipulations done in a for loop on a loop variable in javascript?

A. the initialization, the Incrementation, and update
B. the initialization, the test, and the update
C. the initialization, the test, and Incrementation
D. All of the above

View Answer


15. What does javascript use instead of == and !=?

A. It uses bitwise checking
B. It uses === and !== instead
C. It uses equals() and notequals() instead
D. It uses equalto()

View Answer


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

A. <script>
B. <script>
C. </script language="javascript">
D. All of the above

View Answer


17. Among the keywords below, which one is not a statement?

A. if
B. with
C. debugger
D. use strict

View Answer


18. How do we define the term Thread?

A. Device that controls input
B. Variable that controls movement
C. Controlled execution of applications
D. None of the above

View Answer


19. Which symbol is used for comments in Javascript?

A. \\
B. //
C. \* *\
D. \* */

View Answer


20. Which of them is not the looping structures in JavaScript?

A. for
B. while
C. forwhich
D. dowhile

View Answer


21. What is defination of an undefined value in JavaScript?

A. Variable used in the code doesn't exist
B. Variable is not assigned to any value
C. Property doesn't exist
D. All of the above

View Answer


22. What are the types of Pop up boxes available in JavaScript?

A. Alert
B. Prompt
C. Confirm
D. All of the above

View Answer


23. what is the disadvantage of using innerHTML in JavaScript?

A. Content can not be replaced everywhere
B. We can use like "appending to innerHTML"
C. Even if you use +=like "innerHTML = innerHTML + 'html'" still the old content is replaced by html
D. The entire innerHTML content is not re-parsed and build into elements, therefore its not slower

View Answer


24. What are the two basic groups of dataypes in JavaScript?

A. Primitive
B. Reference types.
C. All of the above
D. None of the above

View Answer


25. Which of the following are the errors in JavaScript?

A. Load time errors
B. Run time errors:
C. Logical Errors:
D. All of the above

View Answer


26. Which of the following are the functional components in JavaScript?

A. First-class functions
B. Encapsulated-class functions
C. Fixed-class functions
D. All of the above

View Answer


27. Which of the following is not the properties of screen objects in JavaScript?

A. AvailHeight
B. ColorsDepth
C. AvailWidth
D. ColorDepth

View Answer


28. Javascript string using double quotes is exactly the same as a string using single quotes?

A. True
B. False

View Answer


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

A. Error in Script
B. '20'30
C. 2030
D. 50

View Answer


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

A. Nothing is printed
B. 0 is printed
C. Infinity is printed
D. Some Garbage Value

View Answer


31.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?

A - pop()
B - reduce()
C - push()
D - reduceRight()

View Answer


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

A. letsfindcourse
B. letsfind/course
C. NaN
D. None of the above

View Answer


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

A. 00
B. 01
C. 11
D. 10

View Answer


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

A. 2
B. 1 plus 1 is 2
C. 1 plus 1 is 11
D. 1 plus 1 is 1 + 1

View Answer


35.In JavaScript, Arrays are data type. State True or False

A. True
B. False

View Answer


36. Does JavaScript allow exception handling?

A. Yes, it provides try, catch as well as throw key word for exception handling
B. Yes, but it provides only try block
C. Yes, but it provides only Try catch block, but does not allow throw exception
D. No

View Answer


37. Which of the following method checks if its argument is not a number?

A. isNaN()
B. nonNaN()
C. NaN()
D. None of the above

View Answer


38. What if you use parseInt() to convert a string containing decimal value?

A. Throws Error
B. It returns the decimal values in string form
C. If returns only the integer portion of the number
D. None of the listed option

View Answer


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

A. Throws Error
B. object
C. Displays Nothing
D. Current Date

View Answer


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

A. Error
B. Nothing is printed
C. 10
D. 11

View Answer


41.Which of the following is true?

A. If onKeyDown returns false, the key-press event is cancelled.
B. If onKeyPress returns false, the key-down event is cancelled.
C. If onKeyDown returns false, the key-up event is cancelled.
D. If onKeyPress returns false, the key-up event is canceled.

View Answer


42. 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?

A. 1 only
B. 2 only
C. Both 1 and 2
D. None of the above

View Answer


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

A. para1="New Text"
B. para1.value="New Text";
C. para1.firstChild.nodeValue= "New Text";
D. para1.nodeValue="New Text";

View Answer


44. The syntax of Eval is ________________

A. [objectName.]eval(numeric)
B. [objectName.]eval(string)
C. [EvalName.]eval(string)
D. [EvalName.]eval(numeric)

View Answer


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

A. Reverse
B. Shift
C. Slice
D. Splice

View Answer


46. Which tag(s) can handle mouse events in Netscape?

A. <IMG>
B. <A>
C. <BR>
D. <span>

View Answer


47. 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?

A. This will flash an error
B. Prints 4
C. Prints 3.14
D. Ambiguity

View Answer


48. What is the default value of the asyc attribute?

A. 0
B. 1
C. False
D. True

View Answer


49. What is the purpose of the Attr object in the HTML DOM?

A. Used to focus on a particular part of the HTML page
B. HTML Attribute
C. Used to arrange elements
D. None of the mentioned

View Answer


50. Which among the following POSIX signals generate events?

A. SIGDOWN
B. SIGFLOAT
C. SIGINT
D. SIGSHORT

View Answer


51.Javascript is ideal to?

A. make computations in HTML simpler
B. minimize storage requirements on the web server
C. increase the download time for the client
D. none of the mentioned

View Answer


52. The meaning for Augmenting classes is that:

A. objects inherit prototype properties even in dynamic state
B. objects inherit prototype properties only in dynamic state
C. objects inherit prototype properties in static state
D. object doesn't inherit prototype properties in static state

View Answer


53. Which is the handler method used to invoke when uncaught JavaScript exceptions occur?

A. Onhalt
B. Onerror
C. Both onhalt and onerror
D. Onsuspend

View Answer


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

A. The omitted value takes "undefined"
B. This results in an error
C. This results in an exception
D. The omitted value takes an integer value

View Answer


55. Which among the following POSIX signals generate events?

A. SIGDOWN
B. SIGFLOAT
C. SIGINT
D. SIGSHORT

View Answer


56. What does the interpreter do when you reference variables in other scopes?

A. Traverses the queue
B. Traverses the stack
C. Finds the bugs
D. Traverse the array

View Answer


57. What must be done in order to implement Lexical Scoping?

A. Get the object
B. Dereference the current scope chain
C. Reference the current scope chain
D. Return the value

View Answer


58. From which version of IE is canvas supported?

A. 6
B. 7
C. 8
D. 9

View Answer


59. How many parameters does the method plot() accept?

A. 7
B. 8
C. 9
D. 10

View Answer


60.What is the purpose of script loading?

A. Load Scripts programmatically
B. Load JavaScript files manually
C. Load JavaScript files programmatically
D. All of the mentioned

View Answer


61.JavaScript can be written __________

A. directly into JS file and included into HTML
B. directly on the server page
C. directly into HTML pages
D. directly into the css file

View Answer


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

A. A is the superclass and B is the subclass
B. B is the superclass and A is the subclass
C. Both A and B are the superclass
D. Both A and B are the subclass

View Answer


63. Which method receives the return value of setInterval() to cancel future invocations?

A. clearInvocation()
B. cancelInvocation()
C. clearInterval()
D. clear()

View Answer


64. The pop() method of the array does which of the following task ?

A. decrements the total length by 1
B. increments the total length by 1
C. prints the first element but no effect on the length
D. updates the element

View Answer


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

A. 0
B. 1
C. True
D. False

View Answer


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

A. Traverses the queue
B. Finds the bugs
C. Traverses the stack
D. Traverses the array

View Answer


67. What is a closure?

A. Function objects
B. Scope where function’s variables are resolved
C. Both Function objects and Scope where function’s variables are resolved
D. Function return value

View Answer


68. Which is the method invoked to connect the last vertex back to the first?

A. closePath()
B. close()
C. connectlast(first)
D. connect()

View Answer


69. What is the need for bubble charts?

A. Represent 2D data
B. Represent 3D data
C. Represent 2D and 3D data
D. Represents meta data

View Answer


70. How to get a particular value using the tagged name?

A. getElementbyID()
B. getElementsbyName()
C. getElementsbyTagName()
D. getTagName()

View Answer


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

A. alert-box("Letsfindcourse");
B. confirm("Letsfindcourse");
C. msgbox("Letsfindcourse");
D. alert("Letsfindcourse");

View Answer


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

A. <script src="LFC.js">
B. <script source="LFC.js">
C. <script ref="LFC.js">
D. <script type="LFC.js">

View Answer


73. Which of the following is not Javascript frameworks or libraries?

A. Polymer
B. Meteor
C. Cassandra
D. jQuery

View Answer


74. Why so JavaScript and Java have similar name?

A. JavaScript is a stripped-down version of Java
B. JavaScript's syntax is loosely based on Java's
C. They both originated on the island of Java
D. None of the above

View Answer


75. What is the original name of JavaScript?

A. LiveScript
B. EScript
C. Mocha
D. JavaScript

View Answer






Also check :


Discussion


* You must be logged in to add comment.