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 4 MCQs AI Integration in Android Applications

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 Introduction to AI in mobile apps Easy

    What is a primary benefit of integrating AI into mobile applications?

  2. Question 2 of 60 Introduction to AI in mobile apps Easy

    Which of the following is a common example of AI being used in a mobile app?

  3. Question 3 of 60 Role of AI assistants in Android Easy

    What is the primary AI assistant developed by Google for the Android platform?

  4. Question 4 of 60 Role of AI assistants in Android Easy

    Besides answering questions, what is a common function of an AI assistant on an Android device?

  5. Question 5 of 60 Overview of ChatGPT OpenAI and Gemini Google Easy

    Which company is the creator of the ChatGPT language model?

  6. Question 6 of 60 Overview of ChatGPT OpenAI and Gemini Google Easy

    Gemini is a family of powerful, multimodal AI models developed by which company?

  7. Question 7 of 60 Overview of ChatGPT OpenAI and Gemini Google Easy

    What does it mean for an AI model like Gemini to be "multimodal"?

  8. Question 8 of 60 Basics of AI APIs REST APIs and API keys Easy

    What does the acronym API stand for?

  9. Question 9 of 60 Basics of AI APIs REST APIs and API keys Easy

    What is the primary purpose of an API key when using a service like the Google Gemini API?

  10. Question 10 of 60 Basics of AI APIs REST APIs and API keys Easy

    REST APIs most commonly use which web protocol for communication?

  11. Question 11 of 60 Integrating Google Gemini API in Android Easy

    What is the most critical prerequisite for an Android developer before they can make calls to the Google Gemini API?

  12. Question 12 of 60 Integrating Google Gemini API in Android Easy

    To simplify the process of using Google's generative AI models in an Android app, what should a developer use?

  13. Question 13 of 60 Generating AI text responses Easy

    When interacting with a generative AI model, what is the term for the input text or question you provide to it?

  14. Question 14 of 60 Generating AI text responses Easy

    After sending a prompt to the Gemini API, what does your application receive back upon a successful request?

  15. Question 15 of 60 Handling user input and AI output Easy

    Which standard Android UI widget is most suitable for allowing a user to type in a multi-line prompt for an AI?

  16. Question 16 of 60 Handling user input and AI output Easy

    To display the text response received from an AI API to the user, which non-editable UI widget is the best choice?

  17. Question 17 of 60 Basic error handling and API usage limits Easy

    In the context of APIs, what is a 'rate limit'?

  18. Question 18 of 60 Basic error handling and API usage limits Easy

    If your app makes an API request but has no internet connection, what is the most likely outcome?

  19. Question 19 of 60 Basic error handling and API usage limits Easy

    What kind of response should your app expect if it uses an incorrect or expired API key?

  20. Question 20 of 60 Basics of AI APIs REST APIs and API keys Easy

    In the client-server architecture used by AI APIs, what role does your Android app play?

  21. Question 21 of 60 Introduction to AI in mobile apps Medium

    An e-commerce app wants to implement a feature to help users find products by describing them in natural language (e.g., "show me red running shoes for trails"). Which AI capability is most directly applicable to this task?

  22. Question 22 of 60 Introduction to AI in mobile apps Medium

    What is a key advantage of using a cloud-based AI model (like the Gemini API) over an on-device model (like Gemini Nano) for a complex mobile app feature?

  23. Question 23 of 60 Role of AI assistants in Android Medium

    A developer wants to allow users to say, "Hey Google, start a run in FitApp." Which Android framework is specifically designed to enable this kind of integration with the Google Assistant?

  24. Question 24 of 60 Overview of ChatGPT OpenAI and Gemini Google Medium

    What is the primary architectural and use-case difference between a model like Gemini Pro and a model like Gemini Nano?

  25. Question 25 of 60 Basics of AI APIs REST APIs and API keys Medium

    When making a REST API call to a service like the Gemini API, why is it considered more secure to send the API key in an HTTP header (e.g., x-goog-api-key) rather than as a URL query parameter?

  26. Question 26 of 60 Integrating Google Gemini API in Android Medium

    When using the Google AI SDK for Android with Kotlin, what is the main purpose of the GenerativeModel class?

  27. Question 27 of 60 Generating AI text responses Medium

    In an Android app using Kotlin Coroutines to call the Gemini API, which CoroutineScope and Dispatcher would be most appropriate for launching the network request to prevent blocking the main thread?

  28. Question 28 of 60 Basic error handling and API usage limits Medium

    Your app receives an HTTP 429 Too Many Requests error from the Gemini API. What is the most effective short-term strategy to handle this error and recover gracefully?

  29. Question 29 of 60 Handling user input and AI output Medium

    You are displaying a response from the Gemini API that is being streamed. To improve the user experience, which approach is best for updating the TextView?

  30. Question 30 of 60 Basics of AI APIs REST APIs and API keys Medium

    When making a direct REST API call to a text-generation model like Gemini, the user's prompt and other parameters like temperature are typically sent in which part of the HTTP request?

  31. Question 31 of 60 Overview of ChatGPT OpenAI and Gemini Google Medium

    What does it mean for a generative AI model like Gemini to be "multimodal"?

  32. Question 32 of 60 Integrating Google Gemini API in Android Medium

    Consider the following Kotlin code snippet for initializing the Gemini model in an Android app. What is the most significant security risk with this direct approach?

    Kotlin
    val generativeModel = GenerativeModel(
        modelName = "gemini-pro",
        apiKey = "AIzaSy...my_secret_key"
    )

  33. Question 33 of 60 Generating AI text responses Medium

    When building a chatbot feature using the Gemini Android SDK, what is the primary benefit of using generativeModel.startChat() over making repeated calls to generativeModel.generateContent()?

  34. Question 34 of 60 Basic error handling and API usage limits Medium

    To prevent unauthorized use of your Gemini API key in other applications, what is a recommended security practice available in the Google Cloud Console?

  35. Question 35 of 60 Handling user input and AI output Medium

    Your app has an EditText for user input and a Button to send a prompt to the Gemini API. What is a recommended UI/UX practice to implement immediately after the user taps the send button?

  36. Question 36 of 60 Introduction to AI in mobile apps Medium

    Which of the following is a clear example of Generative AI being used in a mobile application?

  37. Question 37 of 60 Role of AI assistants in Android Medium

    How do AI assistants like Google Assistant fundamentally enhance user interaction on Android compared to a traditional app-only interface?

  38. Question 38 of 60 Integrating Google Gemini API in Android Medium

    When adding the Google AI Client SDK for Android to your project using Gradle, in which file do you typically declare the implementation("com.google.ai.client.generativeai:generativeai:...") dependency?

  39. Question 39 of 60 Generating AI text responses Medium

    In the context of the Gemini API's generationConfig, what does the "temperature" parameter primarily control?

  40. Question 40 of 60 Basic error handling and API usage limits Medium

    When you make a request to the Gemini API and receive a response where response.text is null but no network or authentication exception was thrown, what is a likely cause related to the API's configuration?

  41. Question 41 of 60 Introduction to AI in mobile apps Hard

    An Android application for real-time video analysis needs to apply a complex, computationally intensive object detection model. The app must function with minimal latency even with intermittent network connectivity. What is the most optimal AI model deployment strategy?

  42. Question 42 of 60 Basic error handling and API usage limits Hard

    Your Android app, using the Gemini API, suddenly starts receiving HTTP 429 Too Many Requests errors. You've implemented a simple retry mechanism, but it's not resolving the issue. What is the most robust strategy to handle this specific error and ensure service resilience?

  43. Question 43 of 60 Integrating Google Gemini API in Android Hard

    When building a conversational chat feature in an Android app using the Google Gemini SDK, you need to maintain the context of the entire conversation. Which Gemini SDK component is specifically designed for this purpose, and how does it manage the history?

  44. Question 44 of 60 Overview of ChatGPT OpenAI and Gemini Google Hard

    You are designing an application that requires generating both creative text and analyzing the content of user-uploaded images in a single API call. Which model and API feature would be most suitable for this "multimodal" task?

  45. Question 45 of 60 Handling user input and AI output Hard

    An AI model is designed to return a JSON object representing a user's flight booking intent. However, due to model "hallucinations" or variations in prompting, the response is sometimes a natural language sentence describing the JSON instead of the JSON itself. What is the most resilient parsing strategy on the Android client?

  46. Question 46 of 60 Basics of AI APIs REST APIs and API keys Hard

    You need to store a Google Gemini API key in your Android project. Which of the following methods provides the strongest security against the key being extracted from a reverse-engineered APK?

  47. Question 47 of 60 Generating AI text responses Hard

    You are using an LLM to generate code snippets. To get more deterministic and focused results, you want to reduce the randomness of the output. Which combination of API parameters should you adjust?

  48. Question 48 of 60 Role of AI assistants in Android Hard

    To enable Google Assistant to deep-link into a specific feature of your app and pass parameters (e.g., "Hey Google, order a pizza from MyPizzaApp"), your app needs to declare specific capabilities. What Android framework component is primarily used to achieve this integration?

  49. Question 49 of 60 Basic error handling and API usage limits Hard

    Your application makes streaming requests to the Gemini API to display text as it's generated. During a stream, the connection is lost. The Gemini SDK for Android throws an exception. What is the most appropriate recovery strategy to provide a seamless user experience?

  50. Question 50 of 60 Integrating Google Gemini API in Android Hard

    You are implementing a feature using the Gemini API that requires processing both an image and a text prompt. Using the generative-ai SDK for Android, how would you structure the input Content for the generateContent call?

  51. Question 51 of 60 Overview of ChatGPT OpenAI and Gemini Google Hard

    When comparing the underlying architecture and training data cutoff of OpenAI's GPT-4 and Google's Gemini models (as of early 2024), what is a key differentiating factor that affects their ability to answer questions about very recent events?

  52. Question 52 of 60 Basics of AI APIs REST APIs and API keys Hard

    In the context of REST APIs for AI services, what is the primary purpose of an Idempotency-Key header, and in which scenario would it be most critical?

  53. Question 53 of 60 Handling user input and AI output Hard

    Your app uses an LLM to summarize long articles. You need to ensure the AI's output is always under 200 tokens to fit in a UI element. However, the model sometimes ignores the instruction "summarize in under 200 tokens". What is the most reliable technical constraint to enforce this limit?

  54. Question 54 of 60 Introduction to AI in mobile apps Hard

    A mobile health app uses an on-device TensorFlow Lite model for real-time heart rate analysis from a camera feed. The developers want to personalize the model for each user over time without sending sensitive health data to the cloud. Which AI technique is best suited for this scenario?

  55. Question 55 of 60 Basic error handling and API usage limits Hard

    You are designing a feature that allows users to make up to 100 AI generation requests per day. What is the most scalable and reliable way to enforce this user-specific limit in a multi-device scenario (i.e., user is logged in on a phone and a tablet)?

  56. Question 56 of 60 Integrating Google Gemini API in Android Hard

    Your app uses the Gemini SDK's streaming feature (generateContentStream) to display text. The design requires showing a "Stop Generating" button. How would you correctly implement the cancellation of an in-flight streaming request in a Kotlin Coroutine?

    Kotlin
    // Assume 'viewModelScope' is the CoroutineScope
    var job: Job? = null
    fun startGeneration() {
        job = viewModelScope.launch {
            generativeModel.generateContentStream(...)
                .collect { ... }
        }
    }

  57. Question 57 of 60 Generating AI text responses Hard

    You are building a chatbot that must avoid discussing certain sensitive topics. Which Gemini API feature is specifically designed to enforce content policies and prevent the model from generating harmful, unethical, or off-topic responses?

  58. Question 58 of 60 Role of AI assistants in Android Hard

    A productivity app wants to proactively suggest a "Create new project" action to the user via Google Assistant when the user receives an email about a new client. This requires the app's AI to operate based on contextual signals from other apps. What Android concept describes this type of proactive, on-device intelligence?

  59. Question 59 of 60 Overview of ChatGPT OpenAI and Gemini Google Hard

    In the context of large language models, what is the fundamental difference between how top_p (nucleus) sampling and top_k sampling control token generation?

  60. Question 60 of 60 Handling user input and AI output Hard

    You're building an Android app where the Gemini API generates markdown-formatted text. To render this in a TextView, you need to convert the markdown to a Spanned object. What is a critical consideration for performance and user experience when handling a streamed markdown response?

That's unit 4

Answer a few questions and your score shows up here.