JavaScript MCQ Questions with Answers – Part 3

JavaScript MCQ Techhyme Part 3

JavaScript is a MUST for students and working professionals to become a great Software Engineer and Web Developer specially when they are working in Web Development Domain.

Also Read:

This article contains 50 JavaScript Multiple-Choice Questions with Answers. These JavaScript MCQs are written for beginners as well as advanced, practice these MCQs to enhance and test the knowledge of JavaScript. You will have to read all the given answers.

1. True or False. A frameset can be loaded with a static web page.

A. True
B. False

Correct Answer – B

2. What attribute is used to specify the web page that is loaded into a frame?

A. source
B. src
C. topPage
D. bottomPage

Correct Answer – B

3. How can you hide the borders of a frame?

A. frameborder=”0″
B. toPageborder=”0″ bottomPageborder=”0″
C. borders=hide
D. Borders cannot be hidden.

Correct Answer – A

4. What attributes can be used to change the source of a child window from a JavaScript?

A. source
B. src
C. parent.frame.location.source
D. parent.frame.location.href

Correct Answer – B

5. What frame receives focus by default?

A. First frame that is built
B. Last frame that is built
C. No frame has focus
D. None of the above

Correct Answer – B

6. How do you set the number of frames that appear in a frameset?

A. Set the rows and cols values.
B. Set the frame value.
C. Set the frameset value.
D. Set the child window value

Correct Answer – A

7. True or False. You specify the name of the frame whenever you want to reference the contents of the frame.

A. True
B. False

Correct Answer – A

8. True or False. A child window cannot change the content of another child window if they are on different domains.

A. True
B. False

Correct Answer – A

9. True or False. A child window cannot call JavaScript functions that are defined in another child window if they are on different domains.

A. True
B. False

Correct Answer – A

10. If you have two vertical frames, how do you make one frame smaller than the other frame?

A. Make one of the rows values smaller than the other.
B. Make one of the cols values smaller than the other.
C. Make one of the bar values smaller than the other.
D. Make one of the bar values larger than the other

Correct Answer – B

11. True or False. The browser automatically replaces a rollover image with the original image when the mouse cursor moves away from an object.

A. True
B. False

Correct Answer – B

12. What is assigned an action to perform when the mouse cursor leaves an object?

A. onmouseout event
B. onmouseover event
C. onmouseout attribute
D. onmouseout attribute

Correct Answer – C

13. Where is a good place to trap a rollover event in a text object?

A. <IMG> tag
B. Anchor tag
C. Name tag
D. src tag

Correct Answer – B

14. How do you reference a specific c object on a document?

A. Use the unique position of the object.
B. Use the unique source of the object.
C. Use the unique name or ID of the object.
D. None of the above.

Correct Answer – C

15. How do you load rollover images into memory?

A. Rollover Load
B. Load Rollover
C. Assign an image file to an image object in a JavaScript
D. Call the Load Rollover () method from a JavaScript

Correct Answer – C

16. What is the value of document.images if the browser does not support the Image object?

A. 1
B. null
C. The number of images on the page
D. The number of images that must be loaded from the server

Correct Answer – B

17. True or False. You can open a new window directly from the onmouseover attribute.

A. True
B. False

Correct Answer – A

18. True or False. All images on a web page are reflected in the document .images array.

A. True
B. False

Correct Answer – A

19. True or False. You can use JavaScript to write to a window that is opened as a result of an onmouseover event if the window is in the same domain.

A. True
B. False

Correct Answer – A

20. You can create a rollback of an image by reacting to which event?

A. onmouse event
B. onmouserollback event
C. onmouserestore event
D. None of the above

Correct Answer – D

21. True or False. Banners are typically displayed on the status bar.

A. True
B. False

Correct Answer – B

22. You change the content of the status bar when

A. The visitor adjusts the width and height of the web page
B.  visitor moves the mouse cursor over an object on the web page
C. A visitor submits a form
D. All of the above

Correct Answer – D

23. What is the purpose of the first parameter of the set Timeout () function?

A. Sets the timeout period in milliseconds
B. Sets the timeout period in seconds
C. Identifies the function that is to be called at the conclusion of the timeout period
D. Identifies the function that called the timeout period

Correct Answer – C

24. Why is the set Timeout () function called when displaying banners?

A. To control the interval when banners are displayed
B. To control the loading of banners
C. To give the browser time to display the banner
D. To wait for the visitor to respond to the banner

Correct Answer – A

25. How do you load all banners before the first banner is displayed?

A. Use the load () function.
B. Use the loadMem () function.
C. Store banners in an array when the web page loads.
D. Store banners in an array after the web page loads.

Correct Answer – C

26. What is the difference between a slideshow and a banner display?

A. Banners display advertisements and slideshows don’t contain advertisements.
B. Banners are automatically displayed. The visitor controls the slideshow.
C. Banners use images and text while the slideshow uses only text.
D. None of the above.

Correct Answer – B

27. True or False. The current date and time of the Date object must be converted to a string when used on the status bar.

A. True
B. False

Correct Answer – A

28. True or False. Only JPG files can be displayed as a banner.

A. True
B. False

Correct Answer – B

29. True or False. Only one rotating banner can be shown on a web page at the same time.

A. True
B. False

Correct Answer – B

39. A file name containing a banner that is directly assigned to the scrattribute

A. Gets loaded before the web page is displayed
B. Gets loaded when the browser encounters the src attribute
C. Gets loaded after the visitor selects the image
D. None of the above

Correct Answer – B

31. True or False. Bots are programs that scan dynamically built web pages for information.

A. True
B. False

Correct Answer – B

32. You reduce the likelihood that a visitor can view your web page source through a context menu by

A. Changing the View Source context menu option
B. Deleting the View Source context menu option
C. Redirecting the action taken when the left mouse button is clicked
D. Redirecting the action taken when the right mouse button is clicked

Correct Answer – D

33. If the document. Layers value is null

A. The visitor is using the Netscape browser
B. The visitor is using the Internet Explorer browser
C. A bot is accessing the web page
D. None of the above

Correct Answer – B

34. You define empty functions when hiding a JavaScript to

A. Confuse bots
B. Confuse visitors who read the source code
C. Prevent older browsers from displaying an error
D. Prevent new browsers from displaying an error

Correct Answer – C

35. The main purpose of using an external JavaScript file is to

A. Confuse bots
B. Confuse visitors who read the source code
C. Hide JavaScript
D. Share JavaScript with multiple web pages

Correct Answer – D

36. An external JavaScript file is

A. Stored on a web server in the same domain as the calling page
B. Stored in a web page
C. Dynamically built
D. Built by the web page

Correct Answer – A

37. True or False. You reference an external JavaScript file in the src attribute of the <script> tag.

A. True
B. False

Correct Answer – A

38. True or False. You call functions that are defined in an external JavaScript file the same way as if those functions were defined in a JavaScript contained in the web page.

A. True
B. False

Correct Answer – A

39. True or False. The purpose of concealing an e-mail address in your web page is to prevent a visitor from seeing the code that generates the e-mail address.

A. True
B. False

Correct Answer – B

40. Which of the following in an e-mail can you generate from a JavaScript?

A. TO
B. CC
C. BCC
D. All of the above

Correct Answer – D

41. True or False. Options selected from a pull-down menu cannot be validated by a JavaScript.

A. True
B. False

Correct Answer – B

42. A JavaScript function can instruct the browser to submit a form by

A. Returning a false to the onsubmit attribute of the form
B. Returning a true to the onsubmit attribute of the form
C. Returning a true to the submit attribute of the form
D. None of the above

Correct Answer – B

43. What does it mean when the value of the selected menu option is an empty string?

A. The form cannot be submitted.
B. A browser error occurred.
C. No value was assigned to the value attribute of the option.
D. The ESC key was pressed in error.

Correct Answer – C

44. The selected Index

A. References the index of the selected menu option
B. References the name of the form
C. References the name of the menu option
D. References the link to the menu option

Correct Answer – A

45. You can dynamically change a menu by

A. Creating an array and then using new Option to assign array elements to the options menu
B. Creating an array and then using onload to assign array elements to the options menu
C. Creating an array and then using onchange to assign array elements to the options menu
D. None of the above

Correct Answer – A

46. You validate a menu selection by using the

A. onerr attribute
B. onstorage attribute
C. onvalidate attribute
D. onsubmit attribute

Correct Answer – D

47. True or False. Dynamically changing menu items helps reduce clutter on a web page.

A. True
B. False

Correct Answer – A

48. True or False. You set options for a dynamic menu in response to an onchange event.

A. True
B. False

Correct Answer – A

49. True or False. Statements within this if statement are executed if the value of the Page value is not null: if (Page! = “”

A. True
B. False

Correct Answer – A

50. What attribute is used to load a web page from within a JavaScript?

A. location
B. upload
C. dnload
D. None of the above

Correct Answer – A

You may also like:

Related Posts