Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 6 MCQs Web-Based Content

CSE227 — Advanced Android App Development 60 questions. Pick an option to check it.

Read the notes Subjective questions

0 of 60 answered 0 right 0 wrong , 60 left

  1. Question 1 of 60 Building and Managing Web Apps in WebView Easy

    What is the primary Android View component used to display web pages directly inside an application?

  2. Question 2 of 60 Building and Managing Web Apps in WebView Easy

    Which method is called to load a specific URL into a WebView?

  3. Question 3 of 60 Building and Managing Web Apps in WebView Easy

    What permission must be added to the AndroidManifest.xml file for a WebView to access the internet?

  4. Question 4 of 60 Building and Managing Web Apps in WebView Easy

    By default, what happens when a user clicks a link inside a WebView?

  5. Question 5 of 60 Advance android programming Easy

    How do you enable JavaScript execution within a WebView?

  6. Question 6 of 60 Supporting Different Screens in web Apps Easy

    Which HTML meta tag is essential for creating responsive web pages that adapt to different screen sizes within a WebView?

  7. Question 7 of 60 Supporting Different Screens in web Apps Easy

    What does width=device-width in the viewport meta tag signify?

  8. Question 8 of 60 Supporting Different Screens in web Apps Easy

    In CSS, which type of unit is recommended for font sizes to ensure they scale properly across different screen densities in a WebView?

  9. Question 9 of 60 Migrating to WebView in Android Easy

    What is a major advantage of using a WebView to display certain content instead of building a fully native UI?

  10. Question 10 of 60 Advance android programming Easy

    What is the purpose of the addJavascriptInterface() method in WebView?

  11. Question 11 of 60 Building and Managing Web Apps in WebView Easy

    Which class should you extend to handle events like page loading finished or URL navigation within your WebView?

  12. Question 12 of 60 Migrating to WebView in Android Easy

    A business wants to migrate their 'Terms of Service' page from a native TextView to a WebView. What is the primary benefit of this change?

  13. Question 13 of 60 Supporting Different Screens in web Apps Easy

    What is a common CSS technique used to apply different styles for different devices or screen sizes?

  14. Question 14 of 60 Migrating to WebView in Android Easy

    What is a potential disadvantage of migrating a complex, interactive screen from native code to a WebView?

  15. Question 15 of 60 Advance android programming Easy

    What is the primary role of the WebChromeClient?

  16. Question 16 of 60 Building and Managing Web Apps in WebView Easy

    How can you load locally stored HTML content from your app's assets folder into a WebView?

  17. Question 17 of 60 Migrating to WebView in Android Easy

    When considering migrating a feature to a WebView, what type of content is generally the best fit?

  18. Question 18 of 60 Supporting Different Screens in web Apps Easy

    If a web page appears too zoomed out in a WebView on a high-density screen, which setting might be missing?

  19. Question 19 of 60 Advance android programming Easy

    To navigate back through the history of a WebView, what method should you call?

  20. Question 20 of 60 Advance android programming Easy

    Before calling webView.goBack(), which method should you check to see if there is a page to go back to?

  21. Question 21 of 60 Building and Managing Web Apps in WebView Medium

    An Android application uses a WebView to display a modern web application. By default, the web app's interactive JavaScript components are not working. What is the most likely reason and how do you fix it?

  22. Question 22 of 60 Building and Managing Web Apps in WebView Medium

    You want to prevent a WebView from opening external links in the device's default browser, and instead handle all URL loading within the app itself. Which method should you override?

  23. Question 23 of 60 Supporting Different Screens in web Apps Medium

    A web page designed for desktops looks too wide and requires horizontal scrolling when loaded in a WebView on a mobile device. Which HTML meta tag is essential to add to the web page's <head> to make it adapt to the device's screen width?

  24. Question 24 of 60 Advance android programming Medium

    What is the correct and secure way to expose a method from your Android Kotlin/Java code to be callable by JavaScript running inside a WebView?

  25. Question 25 of 60 Building and Managing Web Apps in WebView Medium

    A developer needs to display a progress bar that updates as a web page loads in a WebView. Which client and method are most appropriate for this task?

  26. Question 26 of 60 Migrating to WebView in Android Medium

    You are migrating a web application that relies heavily on HTML5 localStorage to an Android app using WebView. After loading the app, you notice that data saved in localStorage does not persist between app sessions. Which WebSettings call is required to fix this?

  27. Question 27 of 60 Supporting Different Screens in web Apps Medium

    To ensure a non-mobile-optimized webpage is initially zoomed out to fit the screen's width when loaded in a WebView, which pair of WebSettings methods should be set to true?

  28. Question 28 of 60 Advance android programming Medium

    How can you programmatically execute a JavaScript function from your native Android code and asynchronously receive its string result?

  29. Question 29 of 60 Building and Managing Web Apps in WebView Medium

    In your WebView-based app, you want the physical back button to navigate the WebView's history first, and only exit the app if there is no history to go back to. Where should this logic be implemented?

  30. Question 30 of 60 Migrating to WebView in Android Medium

    A migrated web application includes a file upload feature using an <input type="file"> element. This feature does not work in the WebView. What must be implemented to support file selection?

  31. Question 31 of 60 Supporting Different Screens in web Apps Medium

    To deliver the best quality images for a web app running in a WebView on high-density displays (e.g., XHDPI, XXHDPI), what is the recommended web development practice?

  32. Question 32 of 60 Advance android programming Medium

    A user logs out of your app, and you need to completely clear all data associated with the WebView, including cookies, cache, and local storage. Which of the following approaches is most effective?

  33. Question 33 of 60 Building and Managing Web Apps in WebView Medium

    To improve WebView rendering performance, especially for pages with complex CSS animations and transitions, what setting should be enabled for the Activity hosting the WebView in AndroidManifest.xml?

  34. Question 34 of 60 Migrating to WebView in Android Medium

    A web app that works in modern desktop browsers uses cutting-edge JavaScript (ES2020) features. When loaded into a WebView on an older Android device (e.g., API 21), these features cause errors. What is the most likely reason?

  35. Question 35 of 60 Supporting Different Screens in web Apps Medium

    You are debugging a responsive layout in a WebView. What CSS media query is specifically used to target devices based on their screen's pixel density?

  36. Question 36 of 60 Advance android programming Medium

    To mitigate the risk of Cross-Site Scripting (XSS) when loading potentially untrusted third-party content in a WebView, which two WebSettings properties should be set to false unless absolutely necessary?

  37. Question 37 of 60 Building and Managing Web Apps in WebView Medium

    Your WebView loads a page over HTTPS, but some resources on that page (like images or scripts) are loaded over HTTP. The WebView blocks this mixed content by default on newer Android versions. How can you change this behavior to allow mixed content?

  38. Question 38 of 60 Advance android programming Medium

    You need to intercept network requests made by a WebView to modify headers or provide a cached response from your app's native cache. Which WebViewClient method is designed for this purpose?

  39. Question 39 of 60 Migrating to WebView in Android Medium

    When converting a web app to a WebView-based Android app, you want to replace the standard browser alert() dialogs with native Android AlertDialogs. Which client and method must you implement?

  40. Question 40 of 60 Supporting Different Screens in web Apps Medium

    A web app in a WebView uses CSS vh units (viewport height) for layout. When the Android soft keyboard appears, the WebView resizes, causing the layout to break. What windowSoftInputMode setting in AndroidManifest.xml for the Activity can help prevent this resizing behavior?

  41. Question 41 of 60 Building and Managing Web Apps in WebView Hard

    You are using WebView.evaluateJavascript() to invoke a JavaScript function that returns a large JSON object. To avoid performance issues on the main thread, you want to process the result on a background thread. Which of the following approaches is the most robust and correct for handling the asynchronous result off the main thread?

  42. Question 42 of 60 Advance android programming Hard

    When implementing WebViewClient.shouldInterceptRequest(WebView view, WebResourceRequest request), you decide to replace the network call with a response from a local, encrypted database. To avoid blocking the UI thread, you perform the database query and decryption on a background thread. What is the primary challenge with this asynchronous approach and how is it correctly solved?

  43. Question 43 of 60 Supporting Different Screens in web Apps Hard

    To ensure your web content respects the display cutout (notch) area on modern Android devices, you need to pass the safe area insets from the native layout to the web app's CSS. What is the most effective technique to achieve this?

  44. Question 44 of 60 Migrating to WebView in Android Hard

    You are migrating a native login flow, which uses OkHttp with a custom Authenticator for automatic refresh token logic, to a WebView-based flow. How can you replicate the automatic token refresh functionality for network requests originating from the WebView?

  45. Question 45 of 60 Building and Managing Web Apps in WebView Hard

    Consider a WebView in a Fragment. Which of the following is the most robust method to prevent WebView-related memory leaks, especially concerning the Context?

  46. Question 46 of 60 Advance android programming Hard

    What is a key security implication of Android's multi-process WebView (active by default on Android O+) regarding the @JavascriptInterface?

  47. Question 47 of 60 Supporting Different Screens in web Apps Hard

    You have a web page with <meta name="viewport" content="width=device-width, initial-scale=1.0">. In your Android app, you set webView.settings.setUseWideViewPort(true) and webView.settings.setLoadWithOverviewMode(true). What will be the resulting behavior of the WebView's viewport?

  48. Question 48 of 60 Building and Managing Web Apps in WebView Hard

    You are implementing a custom WebChromeClient to handle file uploads from a <input type="file"> tag. Your implementation of onShowFileChooser correctly launches an Intent to pick a file. What is a critical, and often missed, step to ensure your implementation works correctly across all scenarios, including when the user cancels the file picker or the app is backgrounded?

  49. Question 49 of 60 Advance android programming Hard

    You observe that your WebView crashes intermittently, and the WebViewRenderProcessClient.onRenderProcessUnresponsive callback is triggered. Your app needs to be extremely resilient. What is the best strategy to recover from this state?

  50. Question 50 of 60 Migrating to WebView in Android Hard

    You are migrating a native app screen to a WebView. The native screen had complex back-press logic managed by OnBackPressedDispatcher. How do you correctly integrate the WebView's own history stack (canGoBack()/goBack()) with the Activity's back-press handling?

  51. Question 51 of 60 Building and Managing Web Apps in WebView Hard

    Your WebView needs to load a page that uses Service Workers for offline caching. Which WebViewClient callback is most critical for debugging and managing the interaction between the WebView and the Service Worker, especially for intercepting network requests handled by the worker?

  52. Question 52 of 60 Advance android programming Hard

    You are using a @JavascriptInterface to expose a native method postData(String json). This method is called frequently with large JSON payloads from JavaScript. You notice performance degradation. What is the most likely cause and the best optimization?

  53. Question 53 of 60 Supporting Different Screens in web Apps Hard

    To achieve a pixel-perfect layout where a 1px CSS border in your web content renders as exactly one physical pixel on a xxhdpi device (which has a density of 3.0), what calculation and communication between JavaScript and native code is required?

  54. Question 54 of 60 Building and Managing Web Apps in WebView Hard

    What is the fundamental difference in purpose between WebViewClient.onPageCommitVisible() and WebChromeClient.onProgressChanged()?

  55. Question 55 of 60 Advance android programming Hard

    Your WebView must securely load content from a server that uses a client SSL certificate for authentication. How do you configure the WebView to provide this certificate during the TLS handshake?

  56. Question 56 of 60 Migrating to WebView in Android Hard

    While migrating a feature to a WebView, you need to maintain two-way data synchronization between a native component (e.g., a SeekBar) and a JavaScript element in the WebView. Which of the following describes the most efficient and responsive implementation?

  57. Question 57 of 60 Building and Managing Web Apps in WebView Hard

    You set a strict Content Security Policy (CSP) via HTTP headers for your web app. Now, you need to execute a specific, trusted script from your native Android code using evaluateJavascript. The CSP blocks inline scripts (script-src 'self'), causing the evaluation to fail. What is the correct way to allow this single execution without globally weakening your CSP?

  58. Question 58 of 60 Supporting Different Screens in web Apps Hard

    Your WebView displays content that needs to adapt when the user enters Android's split-screen mode. Standard CSS @media queries based on viewport width are not sufficient as the width might not change significantly, but the aspect ratio and available space do. How can the web content be reliably notified of the native app entering or exiting split-screen mode?

  59. Question 59 of 60 Advance android programming Hard

    When using setDownloadListener to manage file downloads with the system DownloadManager, a user reports that downloads are failing for URLs that require an authentication cookie. Why does this happen and what is the solution?

  60. Question 60 of 60 Building and Managing Web Apps in WebView Hard

    You are debugging a complex web application in a WebView and suspect a race condition between multiple JavaScript files. You want to debug the JavaScript code using Chrome DevTools. Which statement about setting up remote debugging is most accurate?

That's unit 6

Answer a few questions and your score shows up here.