Android App Components – Intents, Activities, and Broadcast Receivers Quiz Answers

Along with basic Java file I/O classes (like File and InputStream) and Android storage mechanisms, you will learn how to programme these fundamental Android elements by example.

Additionally, the Git source code management system will be taught to you. You will make incremental progress on a project that requires downloading, storing, and displaying images from distant websites throughout this MOOC.Join Now

Week 1: Android App Components – Intents, Activities, and Broadcast Receivers Quiz Answers

Quiz 1: Module 1 Quiz

Q1. Which of the following are examples of hardware elements commonly

found in Android devices (choose all that apply):

  • Central processing unit
  • Random access memory
  • Accelerometer
  • Wifi
  • Intent
  • Activity
  • Broadcast Receiver
  • Graphics processing unit

Q2. Which of the following describe the purposes of the Android Linux kernel (choose all that apply):

  • Shields OEMs from GNU Public License “virality”
  • Shields higher layers of Android from hardware diversity
  • Optimizes GNU Linux to meet the needs of mobile devices and apps
  • A set of Java-based services that form the environment in which Android apps run and are managed
  • Provides reusable capabilities that extend hardware-centric OS kernel and protocol mechanisms
  • Mediates access to–and sharing of–hardware resources

Q3. Which of the following are examples of layers and/or elements found in Android’s middleware infrastructure (choose all that apply):

  • Native C/C++ libraries
  • Power Management
  • Hardware abstraction layer
  • Android Run-Time (ART)
  • Activity Manager Service
  • Binder (IPC) Driver

Q4. Which of the following are examples of Android app components (choose all that apply):

  • Dalvik Virtual Machine
  • Content Providers
  • Package Manager
  • Activities
  • Services
  • Broadcast Receivers

Q5. Which of the following are true statements about Java threads (choose all that apply)

  • Each process can have multiple threads
  • Starting a thread takes a trivial amount of time and system resources
  • A thread is the smallest unit of execution for sequences of programmed instructions
  • Starting a Java thread is the only way to write a concurrent Android app
  • Every thread contains a call stack to keep track of method state
  • A Java thread must be given code to run when it is started

Q6. Which of the following are true statements about application

frameworks in the context of Android (choose all that apply):

  • Android frameworks enhance systematic reuse by providing canonical structure and functionality to mobile apps
  • Android frameworks enable app component to dictate the flow of control in a program, rather than the frameworks themselves
  • Android frameworks use an event-driven programming model to plug app code into them
  • Android frameworks provide an integrated set of components that provide a reusable architecture for a family of related mobile apps

Q7. Which of the following are true statements about the Android

Application Framework layer (choose all that apply):

  • It optimizes GNU Linux to meet the needs of mobile devices and apps
  • It contains system services that provide apps with the capabilities and info they need to do their work
  • Its system services run continuously during system operation
  • It shields OEMs from GNU Public License “virality”

Q8. Which of the following are true statements about the Android

apps (choose all that apply):

  • The bulk of these apps are written in C/C++
  • The bulk of these apps are written in Java
  • These apps cannot be written in C/C++
  • It’s possible to write portions of the apps in C/C++

Quiz 2: Git Module Quiz

Q1. Assuming you are using the git command line terminal: The terminal’s current location is in a folder where you want to start a local git repository. What command allows you to start that repository?

  • git begin
  • git init
  • git start
  • git commit
  • none of the above

Q2. Assuming you are using the git command line terminal: The terminal’s current location is in a folder where you have previously started a git repository. What command allows you to track new files or changes to existing files?

  • git add
  • git include
  • git also
  • git git
  • none of the above

Q3. Assuming you are using the git command line terminal: The terminal’s current location is in a folder where you have included a new file to be tracked to your current index. What command allows you to create a new snapshot of the progress you have made?

  • none of the above
  • git remove
  • git add
  • git commit
  • git status

Q4. Assuming you are using the git command line terminal: The terminal’s current location is in a folder where you have an existing repository. What command allows you to check the current status of the repository?

  • git remove
  • git add
  • git status
  • git clean
  • none of the above

Q5. Assuming you are using the git command line terminal: The terminal’s current location is in a folder where you have an existing repository. What command allows you to create new branches or see information on existing branches?

  • git look
  • git add
  • git read
  • git branch
  • git init
  • none of the above

Q6. Assuming you are using the git command line terminal: The terminal’s current location is in a folder where you have an existing repository. What command allows you to send your changes to a remote repository?

  • git push
  • git upload
  • git send
  • git download
  • none of the above

Q7. Assuming you are using the git command line terminal: The terminal’s current location is in a folder where you have an existing repository. What command allows you to download changes from a remote repository?

  • git push
  • none of the above
  • git pull
  • git acquire
  • git download

Q8. Assuming you are using the git command line terminal: The terminal’s current location is in a folder where you have an existing repository. What command allows you to combine two branches into one branch?

  • git add
  • git status
  • git merge
  • git combine
  • none of the above

Week 2: Android App Components – Intents, Activities, and Broadcast Receivers Quiz Answers

Quiz 1: Module 3 Quiz

Q1. Which of the following correctly describe what an intent is in Android (choose all that apply):

  • A message that describes an action to perform or an event that has occurred
  • An event handler that responds to system-side broadcast announcements
  • A message that provides a screen within which users can interact in order to do something
  • A component that runs in the background to perform long-running operations or access remote resources

Q2. Which of the following correctly describe benefits that an intent provides to apps in Android (choose all that apply):

  • An intent is the “glue” that helps integrate Android apps
  • An intent manages secure access to structured data
  • An intent simplifies app development since existing components can be reused as “black-boxes”
  • An intent defines the smallest unit of execution for sequences of programmed instructions

Q3. Which of the following correctly describe what is meant by an intent being a “passive” data structure (choose all that apply):

  • An intent just consists of fields and field access/mutator methods
  • An intent only contains public fields
  • An intent only contains static getter/setter methods
  • An intent cannot be used in a concurrent program

Q4. Which of the following correctly describe what is meant by an intent enabling “late runtime binding” of apps to components (choose all that apply):

  • App components started by intents are slow to launch
  • App components can be discovered and used at compile-time vs. runtime
  • App components can be discovered and used at runtime vs compile-time
  • App components started by intents must run in separate processes

Q5. Which of the following correctly describe the benefits of runtime discovery of app component (choose all that apply):

  • It enables apps with loosely-coupled components that can be extended and integrated dynamically
  • It enhances the security and robustness of apps by disallowing trojan horses
  • It enables systematic reuse that creates apps from predefined software components
  • It ensures that developers know at compile-time which component implementations their app will use

Q6. Which of the following are elements in an Android intent (choose all that apply):

  • Name
  • Extras
  • URL
  • Data
  • Service
  • Flags
  • Stack
  • Action

Q7. Which of the following statements are true for an “implicit” intent (choose all that apply):

  • The category must not be specified
  • The name must not be specified
  • The action must not be specified
  • The data must not be specified

Q8. Which of the following are true statements about implicit and explicit intent (choose all that apply):

  • Explicit intents are typically used to interact with components residing in other apps
  • Implicit intents are used to “tightly couple” activity and broadcast receiver components
  • Implicit intents are typically used to interact with components residing in other apps
  • Android delivers an implicit intent to a target component only if it matches one of its intent filters in the AndroidManifest.xml file
  • Explicit intents are particularly important when starting or binding to services
  • Android delivers an explicit intent to a target component without consulting filters in the AndroidManifest.xml file

Q9. Which of the following elements must match during implicit intent filtering for an intent to be delivered to a target component (choose all that apply):

  • Data
  • Extras
  • Name
  • Action
  • Category
  • Flags

Q10. Which of the following correctly describe what Android’s IntentService does (choose all that apply):

  • It is a component that provides a screen within which users can interact in order to do something
  • It expresses requests as intents & passes them between threads and/or processes
  • It’s a framework that handles asynchronous requests on demand
  • It is an event handler that responds to system-side broadcast announcement

Week 3: Android App Components – Intents, Activities, and Broadcast Receivers Quiz Answers

Quiz 1: Module 4 Quiz

Q1. Which of the following correctly describe what an activity is in Android (choose all that apply):

  • A component that runs in the background to perform long-running operations or access remote resources
  • A message that describes an action to perform or an event that has occurred
  • A component that defines a user-facing operation that’s displayed on a device screen
  • An event handler that responds to system-side broadcast announcements

Q2. Which of the following correctly define what a hook method is (choose all that apply):

  • It is the smallest unit of execution for sequences of programmed instructions
  • It is an event handler that responds to broadcast announcements
  • It is used to customize reusable framework classes to run app-specific logic
  • It is an unnamed block of code that can be passed around and executed later

Q3. Which of the following are lifecycle hook methods provided by Android’s activity framework (choose all that apply):

  • onPause()
  • onDestroy()
  • onStop()
  • onReceive()
  • onBind()
  • onCreate()
  • onResume()
  • onStart()

Q4. Which of the following statements about the startActivityForResult() method are true (choose all that apply):

  • This method is asynchronous and two-way
  • This method is asynchronous and one-way
  • This method is synchronous and two-way
  • This method is synchronous and one-way

Q5. Which of the following lifecycle hook methods may not be called in low memory situations (choose all that apply):

  • onDestroy()
  • onResume()
  • onPause()
  • onStop()

Q6. Which of the following Android system services call lifecycle hook methods on activities, services, and broadcast receivers (choose all that apply):

  • Window Manager Service
  • Location Manager Service
  • Notification Manager Service
  • Activity Manager Service

Q7. Which of the following statements accurately reflect what happens when a user enters text via the Android virtual keyboard (choose all that apply):

  • A new activity is started and its onCreate() hook method is called
  • The onResume() hook method is called back to return UI focus for this screen
  • The UI focus is unchanged and no lifecycle hook methods are called
  • The onStart() hook method is called back and the activity becomes visible

Q8. Which of the following correctly define what a “task” is in the contact of Android activities (choose all that apply):

  • It is a component that runs in the background performing long-running operations or accessing remote resources
  • It is a unit of execution for sequences of programmed instructions
  • It is a group of activities a user interacts with when performing a certain job
  • It is an unnamed block of code that can be passed around and executed later

Q9. Which of the following correctly describe how activities can be used in concurrent apps (choose all that apply):

  • Any long-duration operations must run in background threads via concurrency frameworks
  • An activity cannot be used in a concurrent app
  • UI toolkit components should only be accessed by the UI thread
  • All methods called in the UI thread must be short-duration and non-blocking

Q10. Which of the following correctly describes the capabilities of the Android HaMeR framework (choose all that apply):

  • It enables operations to run in one or more background threads and publish results to the UI thread without directly using threads, handlers, messages, and/or runnables
  • It is a component that runs in the background to perform long-running operations or access remote resources
  • It handles asynchronous requests on demand and expresses these requests as intents that are passed between threads and/or processes
  • It enables operations to run in one or more background threads and publish results to the UI thread

Week 4: Android App Components – Intents, Activities, and Broadcast Receivers Quiz Answers

Quiz 1: Module 5 Quiz

Q1. Which of the following correctly describe what a broadcast receiver is in Android (choose all that apply):

  • An event handler that responds to broadcast announcements
  • A component that defines a user-facing operation that’s displayed on a device screen
  • A message that describes an action to perform or an event that has occurred
  • A component that runs in the background to perform long-running operations or access remote resources

Q2. Which of the following Android system services are involved in routing intents to broadcast receivers (choose all that apply):

  • Telephony Manager Service
  • Window Manager Service
  • Activity Manager Service
  • Download Manager Service

Q3. Which of the following things can be done in receiver’s onReceive() hook method (choose all that apply):

  • Create status bar notifications
  • Start other Android components
  • Pop up toast messages
  • Show a dialog
  • Bind to a service
  • Register other receivers

Q4. Which of the following are types of Android intent broadcast mechanisms (choose all that apply):

  • Static
  • Ordered
  • Dynamic
  • Async
  • Sticky
  • Normal

Q5. Which of the following are reasons why broadcasting intents raises security issues (choose all that apply):

  • An app can send an intent to any receiver registered via registerReceiver or the AndroidManifest.xml file
  • The intent namespace is global
  • The onReceive() hook method in a receiver is called back in the UI thread
  • sendBroadcast() allows any other app to receive broadcast intents

Q6. Which of the following are key differences between the PingPongReceivers and PingPongReceiversEx apps (choose all that apply):

  • The PingPongReceivers app uses setPackage() to limit receivers to its components only, whereas the PingPongReceiversEx app does not.
  • The PingPongReceivers app displays “ping” and “pong” strings via toasts instead of via the notification status bar area.
  • The PongReceiver in PingPongReceivers runs in a different process as the MainActivity, whereas the PongReceiver in PingPongReceiversEx runs in the same process as MainActivity.
  • The PingPongReceiversEx app displays “ping” and “pong” strings via toasts instead of via the notification status bar area.

Q7. Which of the following statements are correct with respect to the capabilities provided by Android’s LocalBroadcastManager (choose all that apply):

  • It uses the Activity Manager Service to efficiently route intents to zero or more components
  • It enhances app security by ensuring intents can’t be sent or received by components in other apps
  • It performs optimizations for intra-app communication by ensuring intents don’t cross process boundaries
  • It allows broadcast receivers to run in the background performing long-running operations and/or accessing remote resources

Q8. Which of the following are key differences between the ImageDownloaderBRD and ImageDownloaderBRS apps (choose all that apply):

  • ImageDownloaderBRS uses the Activity Manager Service to route intents, whereas ImageDownloaderBRD uses the LocalBroadcastManager
  • ImageDownloaderBRS uses the LocalBroadcastManager to route intents, whereas ImageDownloaderBRD uses the Activity Manager Service
  • ImageDownloaderBRS uses SharedPreferences to communicate between the DownloadReceiver and the MainActivity, whereas ImageDownloaderBRD uses a boolean to communicate between the DownloadReceiver and the MainActivity.
  • The DownloadReceiver in ImageDownloaderBRS runs in a different process as the MainActivity, whereas the DownloadReceiver in ImageDownloaderBRD runs in the same process as MainActivity.

Review:

Based on our knowledge, we urge you to enroll in this course so you can pick up new skills from specialists. It will be worthwhile, we trust.

 

Leave a Comment