Which event occurs when a user closes a browser?
Answer : B
> ''The `unload` event is fired when the document or a child resource is being unloaded. This includes closing the browser window or navigating away from the page.''
>
> ''Events like `submit`, `abort`, and `reset` are related to form actions, not page unloads.''
* MDN Web Docs: Window unload event
* HTML Living Standard: GlobalEventHandlers
---
Which application programming interface (API) should a developer use to store data on a user's local device?
Answer : C
> ''The File System API allows web applications to store and retrieve data on a user's local device. It enables persistent, sandboxed access to a portion of the user's local file system.''
>
> This API is designed for local storage beyond temporary in-memory or cookie-based solutions.
* MDN Web Docs: File System API
* W3C File API Specification
---
What does a form field default to if the type attribute is omitted from a form?
Answer : B
If the type attribute is omitted from an <input> element, it defaults to text.
HTML Input Default Type:
Default Type: The default value for the type attribute in an <input> element is text.
Example:
Given the HTML:
<input>
This will render as a text input field.
MDN Web Docs - <input>
W3Schools - HTML Input Types
Given the following JavaScript code:
```javascript
var n1 = 10;
var n2 = "20.39";
```
Which function should a developer use to convert the content of the variable `n2` from a string to a number while keeping the decimal places?
Answer : C
> ''`parseFloat()` parses a string and returns a floating-point number. Unlike `parseInt()`, it retains the decimal portion.''
>
> Example:
```javascript
parseFloat('20.39') // returns 20.39
```
* `parseInt()` would return `20`
* `isNaN()` checks if a value is Not-a-Number
* `toUpperCase()` is for string case conversion
* MDN Web Docs: parseFloat()
* JavaScript Number Conversion Functions
---
Here are the verified and properly formatted answers for Questions 41 to 44, following your requested structure:
---
A developer tests a website on a tablet and notices that the font is small and unreadable.
What should this developer do to fix the issue?
Answer : D
> ''To improve readability on tablets and mobile screens, developers should apply responsive design principles. This involves using relative font sizes, media queries, and viewport settings to build the site for mobile devices.''
> Updating the HTML version or SSL has no effect on font size or layout.
* MDN Web Docs: Responsive Design
* Google Developer Guidelines: Mobile-Friendly Sites
---
Which HTML segment should a developer use to enable the Offline AppCache application programming interface (API)?
Answer : D
> ''To enable the AppCache feature, a `manifest` attribute must be specified in the opening `<html>` tag.''
>
> Example:
```html
<html manifest='date.appcache'>
```
> Note: Although AppCache is deprecated in favor of service workers, this was the correct method in older HTML5 standards.
* HTML5 Specification (Deprecated): Application Cache
* MDN Web Docs: Using the application cache
---
What is an advantage that a mobile has over a mobile app?
Answer : C
A mobile website has the advantage of being automatically available to all users without the need for installation. Users can access it through their web browsers on any device with internet connectivity.
Accessibility: Mobile websites can be accessed by simply entering a URL in a web browser. There is no need to visit an app store and install an application.
Cross-Platform Compatibility: Mobile websites are designed to work across various devices and platforms, ensuring a broader reach.
Automatic Updates: Updates to mobile websites are immediately available to users without requiring them to download and install new versions.
MDN Web Docs on Responsive Web Design
W3C Mobile Web Application Best Practices