MCQs / Computer Science / HTML5 for Mobiles

HTML5 for Mobiles MCQs — Computer Science (page 2)

39 multiple-choice questions on HTML5 for Mobiles from Computer Science, each with the correct answer and, where available, a teacher's explanation. Read through them to revise the chapter, then practise the same questions one by one to test yourself.

26. Device pixel ratio (DPR) is:

  1. RAM ÷ storage
  2. Screen width ÷ height
  3. Battery level ÷ brightness
  4. Physical pixels ÷ CSS pixels

Answer: D) Physical pixels ÷ CSS pixels

Explanation: DPR tells how many physical pixels make one CSS pixel on high-density screens.

Discuss this question

27. To load internet pages in a WebView, the manifest must contain:

  1. The INTERNET permission
  2. No permission at all
  3. The CAMERA permission
  4. The SENDSMS permission

Answer: A) The INTERNET permission

Explanation: Network access requires android.permission.INTERNET.

Discuss this question

28. iOS apps display web content with:

  1. SafariFragment
  2. WebActivity
  3. WKWebView
  4. UIWebBrowser

Answer: C) WKWebView

Explanation: WKWebView is the modern iOS web view.

Discuss this question

29. Which API opens the phone's native share sheet from a web page?

  1. Fetch API
  2. History API
  3. Clipboard API
  4. Web Share API (navigator.share)

Answer: D) Web Share API (navigator.share)

Explanation: navigator.share() triggers the system share dialog on supported mobiles.

Discuss this question

30. Which element represents self-contained content such as a news post or card?

  1. span
  2. article
  3. nav
  4. div

Answer: B) article

Explanation: article is used for independent, self-contained content.

Discuss this question

31. A PWA can work offline because of its:

  1. manifest.json
  2. Service worker caching files
  3. CSS Grid
  4. Viewport tag

Answer: B) Service worker caching files

Explanation: The service worker intercepts requests and serves cached files when offline.

Discuss this question

32. Which file lets a PWA be installed to the home screen with an icon and name?

  1. sitemap.xml
  2. Web app manifest (manifest.json)
  3. robots.txt
  4. style.css

Answer: B) Web app manifest (manifest.json)

Explanation: The manifest provides name, icons, start URL and display mode.

Discuss this question

33. Which JavaScript call gets the current position of a device?

  1. device.getLatLng()
  2. navigator.gps.read()
  3. window.location.get()
  4. navigator.geolocation.getCurrentPosition()

Answer: D) navigator.geolocation.getCurrentPosition()

Explanation: The Geolocation API's getCurrentPosition() returns coordinates after user permission.

Discuss this question

34. The meta charset="UTF-8" tag is important for Pakistani sites because it:

  1. Allows characters of all languages, including Urdu, to display correctly
  2. Prevents zooming
  3. Makes the page load faster
  4. Enables GPS

Answer: A) Allows characters of all languages, including Urdu, to display correctly

Explanation: UTF-8 encoding supports Unicode characters of all languages.

Discuss this question

35. Which input type shows a phone dial pad on mobile keyboards?

  1. text
  2. email
  3. tel
  4. number

Answer: C) tel

Explanation: type="tel" opens a numeric telephone keypad.

Discuss this question

36. Which attribute prevents a form from being submitted when a field is empty?

  1. autofocus
  2. readonly
  3. placeholder
  4. required

Answer: D) required

Explanation: required makes the field mandatory before submission.

Discuss this question

37. The Android component that displays web pages inside a native app is:

  1. WebView
  2. TextView
  3. ImageView
  4. ListView

Answer: A) WebView

Explanation: android.webkit.WebView renders web content inside an app.

Discuss this question

38. In mobile-first CSS, media queries for larger screens usually use:

  1. max-width
  2. device-height
  3. min-width
  4. print

Answer: C) min-width

Explanation: Base styles target phones; min-width queries add styles for larger screens.

Discuss this question

39. Data saved in localStorage:

  1. Is sent to the server with every request
  2. Is deleted when the tab closes
  3. Can store unlimited gigabytes
  4. Remains until it is cleared by the site or the user

Answer: D) Remains until it is cleared by the site or the user

Explanation: localStorage is persistent; sessionStorage is cleared when the tab closes.

Discuss this question

Previous Page 2 of 2

Practise HTML5 for Mobiles MCQs

More Computer Science chapters