JavaScript Set 1 (40 mcqs)

1. Scripting language is
A.High Level Programming language
B.Assembly Level programming language
C.Machine level programming language
D.None of the above

2. Which of the following is not true about document object in JavaScript?
A.It may contain array of forms object.
B.We can reference the forms object from document
C.A document object always keeps single form objec
D.Position of first forms object begins from zero.

3. Javascript is a ______________
A.server side scripting language.
B.client side scripting language.
C.Either (A) or (B)
D.Neither (A) nor (B)

4. Using which tag we insert an JavaScript in HTML page?
A.<JavaScript type=”text/javascript”>
B.<script type=”text/javascript”><
C.<JScript type=”text/javascript”>&l
D.<HTMLScript type=”text/javascript”>

5. Which of the following is not true about JavaScript?
A.It is a scripting language.
B.It execute with preliminary compilation.
C.It is a lightweight programming language.
D.It can be embedded directly into HTML pages.

6. Which of the following JavaScript cannot do?
A.JavaScript can react to events.
B.JavaScript can manipulate HTML elements.
C.JavaScript can be use to validate data.
D.All of the Above

7. What is the output of the following javascript code? <script type=”text/javascript”> x=4+”4″; document.write(x); </script>
A.44
B.8
C.4
D.Error output

8. Script in an external file and then include in
A.<body>…</body> section
B.<head>…</head> section
C.<html>…</html> section
D.<form>…</form> section

9. Which section where javascript code can be placed?
A.<body>…</body> section
B.<head>…</head> section
C.Either (A) or (B)
D.Neither (A) nor (B)

10. What is the First name of JavaScript ?
A.Oak
B.Mocha
C.JScript
D.JSL
11. What is the correct syntax for referring to an external script called ” abc.js”?
A.<script href=” abc.js”>
B.<script name=” abc.js”>
C.<script src=” abc.js”>
D.None of the above

12. What is meant by “this” keyword in JavaScript?
A.It refers current object
B.It referes previous object
C.It is variable which contains value
D.None of the above

13. Who is to be introduced JavaScript?
A.Microsoft
B.IBM
C.Google
D.Sun Microsystem

14. In JavaScript, common uses is
A.Interact with user using prompt(), alter
B.Client side validation like checking for
C.Creation of complex user interfaces.
D.All of the above

15. _________ keyword is used to declare variables in javascript.
A.Var
B.Dim
C.String
D.None of the above

16. How do you create a new object in JavaScript?
A.var obj = {};
B.var obj = Object();
C.var obj=new {};
D.None of the above

17. Which one is the advantages of JavaScript?
A.Simplicity
B.Speed
C.Versatility
D.All of the above

18. Choose the external object among the following:
A.Date
B.Option
C.Layer
D.Checkbox

19. Javascript has capability to interact with
A.user
B.control the browser
C.alter the document content
D.All of the above

20. Being client-side reduces the demand on the website server
A.Server Load
B.Client Load
C.endclient load
D.endserver load
21. The JavaScript file inside the ________ tag in ________ section of HTML document.
A.</script>,</head>
B.<script>,<head>
C.<script>,<title>
D.<script>,<body>

22. _________ keyword is used to declare variables in javascript.
A.Var
B.Dim
C.String
D.None of the above
23. Which operator creates a new object from the specified object type?
A.obj
B.new
C.create
D.None of the above
24. We can store the JavaScript code seperately from the HTML document with using –
A.import external script file
B.import external cashcading file
C.import external image file
D.None of the above

25. Which is the extension of javascript file?
A..js
B..jv
C..jc
D..jp

26. _____ JavaScript statements embedded in an HTML page can respond to user events such as mouse-clicks, form input, and page navigation.
A.Client-side
B.Server-side
C.Local
D.Native

27. What are variables used for in JavaScript Programs?
A.Storing numbers, dates, or other values
B.Varying randomly
C.Causing high-school algebra flashbacks
D.None of the above

28. What is the correct JavaScript syntax to write “Hello World”?
A.System.out.println(“Hello World”)
B.println (“Hello World”)
C.document.write(“Hello World”)
D.response.write(“Hello World”)

29. What should appear at the very end of your JavaScript? The <script LANGUAGE=”JavaScript”>tag
A.The </script>
B.The <script>
C.The END statement
D.None of the above
30. How does JavaScript store dates in a date object?
A.The number of milliseconds since January 1st, 19
B.The number of days since January 1st, 1900
C.The number of seconds since Netscape’s public st
D.None of the above
31. Which of the following way can be used to indicate the LANGUAGE attribute?
A.<LANGUAGE=”JavaScriptVersion”>
B.<SCRIPT LANGUAGE=”JavaScriptVersion”>
C.<SCRIPT LANGUAGE=”JavaScriptVersion”> J
D.<SCRIPT LANGUAGE=”JavaScriptVersion”!>

32. Which operator can be used to performs a bitwise exclusive OR opration on two operands and assigns the result to the first operand?
A.&*
B.=^
C.^=
D.*&
33. Which operator can be used to performs a zero-fill right-shift operation on two operands and assigns the result to the first operand?
A.>>>=
B.>===
C.==>>
D.=>>>
34. Which of the following statements are false for Java Script?
A.Variables names are not case sensitive.
B.Variable names must begin with a letter or the u
C.Var is used to declare a variable.
D.Both b and c above.

35. Which operator can be used to Joins(concatenates) two strings and assigns the joined string to the first operand?
A.&
B.+=
C.+
D.&&

36. To insert a JavaScript into an HTML page, which tag is used?
A.<script=?java?>
B.<javascript>
C.<script>
D.<js>
37. What language defines the behavior of a web page?
A.HTML
B.CSS
C.XML
D.Java Script

38. A single-line comments starts with
A./
B.//
C.///
D.////
39. Which of these comment lines are used in JavaScript? (1) // , /* …… **/ (2) / , /** ……./ , /* (3) /*……*/ , // (4) \*……*\ , //
A.Only (4)
B.Only (3)
C.Either (3) or (4)
D.Only (2)
40. Which best describes void?
A.A method
B.A function
C.A statement
D.An operator

Answers

1.A 2.C 3.B 4.B 5.B 6.D
7.A 8.B 9.C 10.B 11.C 12.A
13.D 14.D 15.A 16.A 17.D 18.D
19.D 20.A 21.B 22.A 23.B 24.A
25.A 26.A 27.A 28.D 29.A 30.A
31.C 32.C 33.A 34.A 35.B 36.C
37.D 38.B 39.B 40.D

Sharing is caring!

Leave a Comment

Your email address will not be published. Required fields are marked *

shares