logo
  • Home
  • Test & Rank
  • About
  • Training
  • Programming
  • CS
  • IT
  • IS
  • ECE
  • EEE
  • EE
  • Civil
  • Mechanical
  • Chemical
  • Metallurgy
  • Instrumentation
  • Aeronautical
  • Aerospace
  • Biotechnology
  • Mining
  • Marine
  • Agriculture
  • MCA
  • BCA
  • Internship
  • Jobs
  • Contact

JavaScript Multiple Choice Questions | MCQs | Quiz

Javascript Interview Questions and Answers
Practice Javascript questions and answers for interviews, campus placements, online tests, aptitude tests, quizzes and competitive exams.

Get Started

•   Lexical Structure
•   Types, Values & Variables
•   Expressions & Operators
•   Statements
•   JavaScript Loops
•   Object Attributes
•   Array & Related Methods
•   Invoking Functions
•   Functional Programming
•   Closures
•   JavaScript Classes
•   Augmentation of Classes
•   JavaScript Modules
•   Pattern Matching
•   JavaScript Subsets
•   JavaScript Extentions
•   Shorthand Functions
•   Server-Side JavaScript
•   Scripting Java - Rhino
•   Asynchronous I/O - Rhino
•   Client-Side JavaScript
•   Embedding JavaScript
•   JavaScript-Web Browsers-1
•   JavaScript-Web Browsers-2
•   Client-Side Frameworks
•   Document Object Model
•   Window Object
•   Error Handling - 1
•   Error Handling - 2
•   Scripting Documents
•   Scripting CSS
•   Handling Events
•   Mouse Events
•   Text Events
•   Drag & Drop Events
•   Keyboard Events
•   Node Operations - 1
•   Node Operations - 2
•   Cookies
•   Scripted HTTP
•   The jQuery Library
•   Client-Side Storage
•   Client-Side Databases
•   Scripted Media
•   Graphics
•   Browser Rendering - 1
•   Browser Rendering - 2
•   JavaScript Performance - 1
•   JavaScript Performance - 2
•   JavaScript - FireBug
•   JavaScript - YSlow
•   JavaScript - WebPagetest
•   JavaScript Minification - 1
•   JavaScript Minification - 2
•   Web Sockets
•   JavaScript History
•   Getting Started with R - 1
•   Getting Started with R - 2
•   Getting Started with R - 3
•   Enhanced JavaScript with R
•   WebPagetest API Access
•   Configuration File Creation
•   Parsing Values - 1
•   Parsing Values - 2
•   JavaScript Benchmarking-1
•   JavaScript Benchmarking-2
•   Public API Crafting
•   Remote Logging
•   Object Invocation
•   PerfLogger Performance
•   Navigation & Memory - 1
•   Navigation & Memory - 2
•   BottleNecks Optimization
•   Script Loading - 1
•   Script Loading - 2
•   Lazy Loading - 1
•   Lazy Loading - 2
•   Cache Variable & Properties
•   Closure Compiler
•   Web Workers
•   JavaScript Blobs
•   JavaScript & Memory Leak
•   External JavaScript & PHP
•   HTML APIs
•   HTML DOM
•   Animation
•   Validation
•   Image Map
•   Debugging Forms
•   JavaScript vs Frameworks-1
•   JavaScript vs Frameworks-2

Best Reference Books

Javascript Books

JavaScript Tests

Certification Test
Internship Test
Job Test
All Tests
Top Rankers
Practice Test 1
Practice Test 2
Practice Test 3
Practice Test 4
Practice Test 5
Practice Test 6
Practice Test 7
Practice Test 8
Practice Test 9
Practice Test 10
Mock Test 1
Mock Test 2
Mock Test 3
Mock Test 4
Mock Test 5
Mock Test 6
Mock Test 7
Mock Test 8
Mock Test 9
Mock Test 10
« Prev Page
Next Page »

JavaScript Questions & Answers – Scripted Media

Posted on August 29, 2013 by Manish

This set of Javascript Multiple Choice Questions & Answers (MCQs) focuses on “Scripted Media”.

1. What is the advantage of the code produced graphics being smaller than the images themselves?
a) Bandwidth saving
b) Increase in bandwidth
c) Dynamic advantages
d) Static advantage
View Answer

Answer: a
Explanation: The code used to produce graphics on the client side is typically much smaller than the images themselves, creating substantial bandwidth savings.
advertisement

2. Which of the following uses a lot of CPU cycles?
a) GUI
b) Statically generated graphics
c) Dynamically generated graphics
d) Images
View Answer

Answer: c
Explanation: Dynamic graphics for data, means simulating motion or movement using the computer. It may also be thought of as multiple plots linked by time. Dynamically generating graphics from real-time data uses a lot of CPU cycles.

3. Which HTML element is used to include images?
a) image
b) img
c) src
d) sourcing
View Answer

Answer: b
Explanation: Web pages include images using the HTML img element. src tag is used to include the image link.

4. What is the purpose of image replacement?
a) To replace an image
b) To implement special effects
c) Removal of image rollovers
d) Implementation of image rollovers
View Answer

Answer: d
Explanation: Image replacement is a technique developed to allow designers to use image-based typesetting while meeting accessibility requirements. One common use for image replacement is to implement image rollovers, in which an image changes when the mouse pointer moves over it.

5. When is JavaScript called obtrusive?
a) JavaScript code is medium sized
b) JavaScript code is small
c) JavaScript code is so large
d) JavaScript code is Very small
View Answer

Answer: c
Explanation: When the amount of JavaScript code is so large that it effectively obscures the HTML, we call JavaScript as obtrusive. On the other hand unobtrusive JavaScript is a best practice methodology for attaching JavaScript to the front-end of a website.

6. Which is a possible way of finding all the img elements in the document?
a) document(images)
b) document.images[]
c) document(img)
d) doc(img)
View Answer

Answer: b
Explanation: The best suited option is document.image[] to find all img elements in the document.[index] is used to specify the index of which img tag is to be selected.

7. Which of the following elements are used to include audio?
a) audio
b) video
c) svg
d) aud
View Answer

Answer: a
Explanation: The audio tag is used to include audio in the HTML document. The audio tag includes method like play(), pause() etc.

8. Which of the following attributes are common to both audio and video?
a) enter
b) control
c) controls
d) add
View Answer

Answer: c
Explanation: Both audio and video support a controls attribute. When present, it specifies that audio controls should be displayed. Both audio and video support a controls attribute.

9. Which of the following is not the property of the video tag?
a) width
b) height
c) breadth
d) area
View Answer

Answer: c
Explanation: The video tag does not contain a breadth property. The width and height property specifies the width and height of the video.
advertisement

10. Which of the following is the parameter used to invoke the Audio() constructor?
a) File type
b) Music type
c) Both File and Music
d) Video type
View Answer

Answer: c
Explanation: The HTMLAudioElement interface provides access to the properties of <audio> elements, as well as methods to manipulate them. It derives from the HTMLMediaElement interface. The parameter type of the Audio() constructor is any file type that contains audio to be played.

11. What will be the output of the following JavaScript code?

<p id="demo"></p>
<script>
function myFunction() 
{
   var num = 098;
   var n = num.valueOf()
   document.getElementById("demo").innerHTML = n;
}
</script>

a) 098
b) 98
c) Error
d) Undefined
View Answer

Answer: b
Explanation: The valueOf() method returns the primitive value of a number. The value of num in the above case would be 98.

12. What will be the output of the following JavaScript code?

<p id="demo"></p>
<script>
function myFunction() 
{
   var num = 3+2;
   var n = num.valueOf()
   document.getElementById("demo").innerHTML = n;
}
</script>

a) 5
b) 3+2
c) Error
d) Undefined
View Answer

Answer: a
Explanation: The valueOf() method returns the primitive value of a number. It performs the calculations in the number and then displays the result.

13. What will be the output of the following JavaScript code?

advertisement
<p id="demo"></p>
<script>
function myFunction() 
{
   var num = 13.3714;
   document.getElementById("demo").innerHTML = num.toPrecision(3);
}
</script>

a) 13
b) 13.3714
c) 13.3
d) 13.4
View Answer

Answer: d
Explanation: The toPrecision() method formats a number to a specified length. A decimal point and nulls are added (if needed), to create the specified length.

14. What will be the output of the following JavaScript code?

<script>
var num = new Number(1000000).toLocaleString("fi-FI");
document.write(num);
</script>

a) 1 000 000
b) 1 0 00000
c) 100 000 0
d) Undefined
View Answer

Answer: a
Explanation: This method formats a number into a string, using language specific format. In this example we use the “fi-FI” value to specify the locale number format in FINLAND.

15. What will be the output of the following JavaScript code?

<p id="demo"></p>
<script>
function myFunction() 
{
   document.getElementById("demo").innerHTML = Number.POSITIVE_INFINITY;
}
</script>

a) 10000
b) -infinity
c) infinity
d) error
View Answer

Answer: c
Explanation: The POSITIVE_INFINITY property represents positive infinity. Positive infinity can be explained as something that is higher than any other number.

Sanfoundry Global Education & Learning Series – Javascript Programming.

To practice all areas of Javascript, here is complete set of 1000+ Multiple Choice Questions and Answers on Javascript.
« Prev Page - JavaScript Questions & Answers – Client-Side Databases
» Next Page - JavaScript Questions & Answers – Graphics

« JavaScript Questions & Answers – Client-Side Databases
JavaScript Questions & Answers – Graphics »
advertisement

Deep Dive @ Sanfoundry:

  1. Computer Graphics Questions and Answers
  2. Java Programming Examples on Event Handling
  3. CSS Questions and Answers
  4. Biomedical Instrumentation Questions and Answers
  5. Master of Computer Applications Questions and Answers
  6. HTML Questions and Answers
  7. Javascript Questions and Answers
  8. JavaScript Questions & Answers – JavaScript Benchmarking and Logging with perfLogger – I
  9. JavaScript Questions & Answers – JavaScript Subsets
  10. JavaScript Questions & Answers – Embedding JavaScript in HTML
Manish Bhojasia
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn | Facebook | Twitter

Best Careers

Developer Tracks
SAN Developer
Linux Kernel Developer
Linux Driver Developer
Linux Network Developer

Live Training Photos
Mentoring
Software Productivity
GDB Assignment
Sanfoundry is No. 1 choice for Deep Hands-ON Trainings in SAN, Linux & C, Kernel Programming. Our Founder has trained employees of almost all Top Companies in India such as VMware, Citrix, Oracle, Motorola, Ericsson, Aricent, HP, Intuit, Microsoft, Cisco, SAP Labs, Siemens, Symantec, Redhat, Chelsio, Cavium, ST-Micro, Samsung, LG-Soft, Wipro, TCS, HCL, IBM, Accenture, HSBC, Mphasis, Tata-Elxsi, Tata VSNL, Mindtree, Cognizant and Startups.

Best Trainings

SAN I - Technology
SAN II - Admin
Linux Fundamentals
Advanced C Training
Linux-C Debugging
System Programming
Network Programming
Linux Threads
Kernel Programming
Kernel Debugging
Linux Device Drivers

Best Reference Books

Computer Science Books
Algorithm & Programming Books
Electronics Engineering Books
Electrical Engineering Books
Chemical Engineering Books
Civil Engineering Books
Mechanical Engineering Books
Industrial Engineering Books
Instrumentation Engg Books
Metallurgical Engineering Books
All Stream Best Books

Questions and Answers

1000 C Questions & Answers
1000 C++ Questions & Answers
1000 C# Questions & Answers
1000 Java Questions & Answers
1000 Linux Questions & Answers
1000 Python Questions
1000 PHP Questions & Answers
1000 Hadoop Questions
Cloud Computing Questions
Computer Science Questions
All Stream Questions & Answers

India Internships

Computer Science Internships
Instrumentation Internships
Electronics Internships
Electrical Internships
Mechanical Internships
Industrial Internships
Systems Internships
Chemical Internships
Civil Internships
IT Internships
All Stream Internships

About Sanfoundry

About Us
Copyright
Terms
Privacy Policy
Jobs
Bangalore Training
Online Training
Developers Track
Mentoring Sessions
Contact Us
Sitemap
© 2011 Sanfoundry. All Rights Reserved.