HTML Questions & Answers – Compatibility Libraries

This set of HTML Questions and Answers for Aptitude test focuses on “Compatibility Libraries”.

1. Which one of the following is an open source JavaScript library that enables styling for HTML5 elements in versions of Internet Explorer before IE 9 ?
a) HTML5
b) HTML5 Shiv
c) HTML5 Shim
d) HTML5 Sham
View Answer

Answer: b
Explanation: HTML5 Shiv is a JavaScript workaround, invented by Sjoerd Visscher, to enable styling of HTML5 elements in versions of Internet Explorer prior to version 9, which do not allow unknown elements to be styled without JavaScript. HTML 5 defines the properties and behaviors of web page content. It is a web language.

2. Which one of the following is not a step to install a library you need to perform the compatibility in browsers?
a) Download the library from the github location
b) Uncompress the file
c) Insert the following code inside the head tag
d) None of the mentioned
View Answer

Answer: d
Explanation: All steps are required.

3. Which property is used to detect the browser’s user agent and code based on the pertinent cases?
a) navigator.userAgent
b) navigator.user
c) navigator
d) return
View Answer

Answer: a
Explanation: An old strategy was to look at the property navigator.userAgent to detect the browser’s user agent and code based on the pertinent cases.
advertisement
advertisement

4. Some users have requested tests for IE’s float double margin bug, and support for position:fixed. Which API is suitable for them?
a) mq() media Plugin API
b) addTest() Plugin API
c) testAllProps() Plugin API
d) none of the mentioned
View Answer

Answer: b
Explanation: The navigator object contains information about the browser. UseAgent property gives user-agent header sent by browser to the server. A navigator.userAgent is used to detect the browser’s user agent and code based on the pertinent cases.

5. ___________ is an open source JavaScript library that allows support for different levels of experiences based on the capabilities of each browser.
a) Navigator
b) Modernizr
c) Geolocation
d) Google API
View Answer

Answer: b
Explanation: Modernizr is an open source JavaScript library that allows support for different levels of experiences based on the capabilities of each browser using a simple feature detection model. Geolocation is the identification of geographic location of an object. The navigator object contains information about the browser. Google API, i.e set of application programming interface which allow communication with Google Services & integration to other services.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

6. ____________ allows you to add custom styles to the document and test an element afterwards.
a) hasEvent()
b) testAllProps()
c) testProp()
d) modernizr.testStyles()
View Answer

Answer: d
Explanation: Modernizr.testStyles() allows you to add custom styles to the document and test an element afterwards. An element with the id of “modernizr” is injected into the page.

7. Modernizr does actually add missing functionalities to browsers save for the HTML5 tags styling support.
a) True
b) False
View Answer

Answer: b
Explanation: Modernizr is a JavaScript library which is designed to detect HTML5 and CSS3 features in various browsers, which lets JavaScript avoid using unimplemented features or use a workaround such as a shim to emulate them. Modernizr, in spite of its name, does not actually add missing functionalities to browsers save for the HTML5 tags styling support.
advertisement

8. ___________ is used to test whether geolocation is supported in old browsers.
a) Modernizr
b) Modernizr.geolocation
c) Navigator.userAgent
d) Modernizr.js
View Answer

Answer: c
Explanation: Since Modernizr is a JavaScript object with methods, we can use Modernizr.geolocation to test whether geolocation is supported. Geolocation API Detects support for the Geolocation API for users to provide their location to web applications.

9. ____________ is a resource loader (CSS and JavaScript) that was made to specifically to work side-by-side with Modernizr.
a) HasEvent()
b) Navigator.userAgent
c) Modernizr.load
d) Modernizer.geolocation
View Answer

Answer: c
Explanation: Modernizr.load is optional in your build, but if you are loading polyfills, there’s a good chance it can save you some bandwidth and boost performance a bit. Modernizr.load objects print out on your page in the exact spot they should be, coming after the Modernizr.
advertisement

10. In case we want to implement a JavaScript fallback, we would need to create a conditional statement using Modernizr.
a) True
b) False
View Answer

Answer: a
Explanation: Modernizr is a JavaScript library that detects which HTML5 and CSS3 features your visitor’s browser supports. Modernizer determines whether browser has implemented a given feature. Developers take advantage of new features that browsers support, still create fallbacks for browsers that lack support.

Sanfoundry Global Education & Learning Series – HTML.

To practice all areas of HTML for Aptitude test, here is complete set of 1000+ Multiple Choice Questions and Answers.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.