About JavaScript

Following are some of the multiple choice questions on the JavaScript with answers that will help the students in developing their knowledge.

JavaScript MCQ

1. In javascript what is a block of statement

2. Which one of the following also known as conditional expression in javascript

3. Is this correct syntax to include JS Code inside HTML Page ?<script type="text/javascript">...</script>

  • Yes
  • No

4. File extension for external JS files

  • .javascript
  • .js
  • .jscript
  • .script

5. Which type of javascript language is ___

6. When does the function name become optional in javascript

7. What is the correct javascript syntax to change the content of the html element below?

8. In asps, the code to tie the database to the web site is typically written in javascript or ____.

9. The main purpose of javascript in web browser is to

10. Use the ________ element to associate javascript with a web page.

11. We cannot Place JS Code in the body tag . Say true/false.

  • True
  • False.

12. The ____ object allows you to change to a new web page from within javascript code.

13. Window.googlejavascriptredirect=1var n={navigateto:function(b,a,d){if(b!=a&&b.google){if(b.google.r

14. The external javascript file must contain the tag.

15. Is JavaScript case sensitive language?

  • Yes
  • No
  • Depends on the browser
  • Depends on the platform

16. What will be the output of the following javascript code

17. JavaScript is designed for following purpose -

  • To Style HTML Pages
  • To Perform Server Side Scripting Opertion
  • To add interactivity to HTML Pages.
  • To Execute Query Related to DB on Server

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

  • <js>
  • <script>
  • <scripting>
  • <javascript>

19. Which of the following is NOT a valid starting character for JS variable names?

  • Uppercase Letter
  • Lowercase Letter
  • Dollar Sign
  • Underscore

20. ______ tag is an extension to HTML that can enclose any number of JavaScript statements.

  • <SCRIPT>
  • <BODY>
  • <HEAD>
  • <TITLE>

21. Var num;Above Statement is called as __________ Statement.

  • Instantization
  • Globalization
  • Declaration
  • Declaration

22. What is the correct JavaScript syntax to write "Hello World"?

  • System.out.println("Hello World")
  • println ("Hello World")
  • document.write("Hello World")
  • response.write("Hello World")

23. Which of the following is not a feature of javascript?

  • Lightweight
  • Good for the applications which are network-centric
  • Object oriented
  • Open source
  • Complementary to HTML

24. Conditional Operator shown in the following example is _____________.

  • Unary Operator
  • Ternary Operator
  • Binary Operator
  • Ternary Operator

25. What will be the output of the following script ?

  • 5
  • true
  • 1
  • false

26. Adding String and Integer always results in _________.

  • Character
  • String
  • Integer
  • String

27. JavaScript contains a _________________ that assigns a value to a variable based on some condition.

  • Bitwise Operator
  • Logical Operator
  • Assignment operator
  • Conditional operator

28. Guess the ternary operator used in the following example !!!

  • Conditional Operator
  • Logical Operator
  • Bitwise Operator
  • Conditional Operator

29. Which of the following is not an logical operator ?

  • &&
  • ||
  • !
  • |

30. "+=" operator can operate on following data values.

  • Float
  • String
  • Integer
  • All Options

31. "===" operator is _______________.

  • Is equal to
  • Is identical (is equal to and is of the same type)
  • Is identical (is equal to and is of the different type)
  • Is identical (is equal to and is of the same type)

32. "Add and Assignment" operator is shown by this symbol.

  • +==
  • +=
  • ==+
  • +=

33. Assignment Operators is following type of operator ______________.

  • Binary
  • Unary
  • Ternary
  • Binary

34. Which of the following operator is used to concatenate two strings.

  • Dot
  • Arrow
  • Comma
  • Plus

35. What type of value gets printed if we add following two variables ?var a = "1";var b = 5;

  • Integer
  • Long
  • Number
  • Text

36. "++" is __________ type of operator.

  • Ternary
  • Binary
  • Unary
  • Unary

37. "++" can operate only on ________________.

  • Constants
  • Variables
  • Text
  • Variables

38. Integer Variable + Character Variable + Undefined Variable = ______________ Value

  • Undefined Value
  • Integer
  • Character
  • Undefined Value

39. What will be the value of Variable - "num3" ?var num1;var num2 = 10;var num3 = num1 + num2;

  • 10
  • undefine10
  • undefine
  • undefine

40. What will be the output of the following ?

  • Nothing will be printed
  • Pritesh
  • Error
  • Pritesh

41. Local Variables are Destroyed as soon as ______________.

  • user closes the browser
  • page gets completely loaded
  • control comes outside the method
  • control comes outside the method

42. Variables declared inside function are visible _______________.

  • Inside the function in which it is declared
  • to all the functions
  • All the scripts inside save JS File
  • Inside the function in which it is declared

43. What will be the output of the following code ?

  • 56
  • Error
  • No Output
  • 11

44. Variable declared without a value will have the value ______________.

  • null
  • undefined
  • 0
  • undefined

45. In the following code, value of Z is

  • 21.450
  • 21.451
  • 812.451
  • 812.451

46. When you assign a text value to a variable, we put text value in the pair of _________.

  • Single Quote
  • Double Quote
  • Square Bracket
  • Both a and b

47. Non Initialized Variable have value "undefine", What value be printed in following case -var carname="Volvo";var carname;

  • undefined
  • Error
  • Volvo
  • Volvo

48. Variable name contain following type of characters -1. Alphabet2. Digits3. Underscore4. Special CharactersSelect the correct option.

  • 3 4 2
  • 4 3 1
  • 1 2 3 4
  • 1 2 3

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

  • Special
  • Punctual
  • Mandetory
  • Special

50. Which JavaScript variable cannot be used as First character but can be use after first character ?

  • Asterisk
  • Dollar Sign
  • Underscore
  • Digit

Enjoyed the Quiz. Share this with friends

Comments

Add Your Review

Your email address will not be published.

Subscribe to Newsletter!

Subscribe to get latest updates and information.