module 4
8. calendar and contacts are two examples of a. an Android content provider b. an android activity c. an android service d. an android broadcast receiver
a. an Android content provider
18. Which android component do you use to implement screens of a graphical user interface? a. Service b. Broadcast receiver c. Activity d. Content provider
activity
15. The wall paper and text service are two examples of a. Activity b. Service c. Broadcast receiver d. Content provider
service
5. Android supports message passing between components within the same application or across application. This message is called an intent in android. Identify all correct statements a. An intent can carry additional information with a bundle that hold key-value pairs b. Intent communication is restricted to components within the SAME app. Any communication between components of DIFFERENT apps is prohibited (for security reasons) c. An activity can start another activity by sending an intent but it can NOT do this in a way to get an answer back d. The AndroidManifest file contains intent filter descriptions that help the Android OS to identify the receiver of an Intent e. An intent is the only possibility for communication even if sender and receiver are running in the same app (share same address space) f. An intent is called explicit intent if it contains the explicit name of the class that should receive this intent g. Intents can be used to communicate large data structures so well that the size of the communicated data does not really impact the overall performance h. An intent is called implicit intent if it does not contain the class name of the receiver such that the Android intent resolution mechanism needs to determine which object is the receiver of that intent.
a. an Intent can carry additional information with a bundle that hold key-value pairs d. the AndroidManifest file contains intent filter descriptions that help the Android OS identify the receiver of an Intent f. an intent is called explicit if it contains the explicit name of the class that should receive this intent h. an intent is called implicit if it does not contain the class name of the receiver such that the Android intent resolution mechanism needs to determine which object the receiver of that intent
9. identify all statements about Android that are correct a. android has a market where newer versions of Android compete with older versions which implies extra challenges for developers to support a variety of android versions b. android apps can be tested and evaluated with the help of an emulator c. developing android apps is mainly done in Java but other languages are supported as well via the NDK d. android software stack is an example of a layered architecture e. android apps can be tested and evaluated by connecting an android device to the development architecture (say your laptop) and the IDE can run and interact with an app that runs on the connected device f. developing android app is essentially the same as developing any other desktop app in Java; there is no need to know anything beyond what is in Java 1.8 g. android is a hardware platform h. the most recent versions such as Nougat operate with a specialized Dalvik Virtual machine
a. android has a market where newer versions of Android compete with older versions which implies extra challenges for developers to support a variety of android versions b. android apps can be tested and evaluated with the help of an emulator c. developing android apps is mainly done in Java but other languages are supported as well via the NDK d. android software stack is an example of a layered architecture e. android apps can be tested and evaluated by connecting an android device to the development architecture (say your laptop) and the IDE an run and interact with an app that runs on the connected device
14. The intent class has several constructor methods. When do you use either of the two following constructors? Intent(String action) - Intent(String action, Uri uri) a. if I need an implicit intent b. if I need to communicate data with a bundle c. none d. if I need an explicit intent
a. if I need an implicit intent
20. Which pieces of information are revealed in the AndroidManifest file of an app? a. It lists the permission that the app requests in order to perform b. For components such as broadcast receivers, it can list intent-filters that describe constraints to narrow the scope of events the receiver should pay attention to c. It lists licensing and payment info d. It lists URIs to obtain checksums that help to confirm that the app is authentic. This prevents malware from claiming to be some useful other (harmless) app e. It tells where to find information for a label or an icon such that Android can represent the app on a screen when offering a selection of apps to start f. It reveals its demand in terms of main memory usage during runtime g. For a component like an activity, it can list action strings to describe the kind of tasks that the component can support h. It shows the minimum sdk version that the app requires to perform
a. it lists the permission that the app requests in order to perform b. for components such as broadcast receivers, it can list intent-filters that describe constraints to narrow the cope of events the receiver should pay attention to e. it tells where to find info for a label or an icon such that android can represent the app on the screen when offering a selection of apps to start g. for a component like an activity, it can list action strings to describe the kind of tasks that the component can support h. it shows the minimum sdk version that the app requires to perform
6. Uri uri = Uri.parse("geo:"+lat.toString()+","+Ion.toString()); --- intent i = new Intent(Intent.ACTION_VIEW, uri); ---- startActivity(i); --- pick correct statement from code snippet a. It shows how to start a separate activity with an implicit intent b. It shows how to start a separate activity with explicit intent c. It shows how to start a separate activity with implicit intent that will report back results to the calling activity d. It shows how to start a separate activity with explicit intent that will report back results to the calling activity
a. it shows how to start a separate activity with an implicit intent
12. The Android emulator can emulate a real device to a certain extent. Identify correct statements about its strength and its limitations. a. The emulator can help with different screen sizes and phone configurations (ex: hard or soft keyboard, cpu, memory, sdcard) b. The emulator can provide accurate support for what happens locally on the device but cannot handle network connections c. The emulator can support a file system and the SQLite database but has difficulties to mimick its performance (to get the response time of the SQLite database right) d. The emulator can produce signals for incoming phone calls or text messages but does not support the actual phone calls e. The emulator can support WiFi, Bluetooth, and NFC f. The emulator can support different Android versions (API levels)
a. the emulator can help with different screen sizes and phone configurations (ex: hard or soft keyboard, cpu, memory, sdcard) c. the emulator can support a file system and the SQLite database has difficulties to mimick its performance (to get the response time of the SQLite database right) d. the emulator can produce signals for incoming phone calls or text messages but does not support the actual phone calls f. the emulator can support different Android versions (API levels)
1. Select all statements that are valid for Android activities a. An activity is the concept to use when our application needs to listen to and react to system notifications in the form of intents such as "incoming text message" that are delivered to every entity on the system that is willing to listen to this b. An activity is rather short lived c. An activity is usually listed in the AndroidManifest.xml file d. An activity has a rather complicated life cycle with different states that show if the activity is running on screen or if it paused or stopped and so forth e. The android OS organizes activities in a binary tree such that each activity can have at most two child activities and exactly one parent activity (its context) f. An activity has no user interface. It runs in the background
b. an activity is rather short lived c. an activity is usually listed in the AndroidManifest.xml file d. an activity has a rather complicated life cycle with different states that show if the activity is running on screen or if it paused or stopped and so forth
17. What should happen in the onReceive method of a Broadcast Receiver? From answers pick the one that completes the statement: The code should check if the event is of interest ... a. If it is not, it should complain and throw an exception. If it is, it should deal with it and provide its own code to handle it b. If it is not, it should quietly return. If it is, it should delegate further processing to an activity or a service and quickly return. c. If it is not, it should complain and throw an exception. If it is, it should delegate further processing to an activity or a service and quickly return d. If it is not, it should quietly return. If it is, it should deal with it and provide its own code to handle it.
b. if it is not, it should quietly return. If it is, it should delegate further processing to an activity or a service and quickly return
10. intent myIntent = new Intent(this, Generating.class); --- myIntent.putExtra("skillLevel", ""+index); --- startActivity(myIntent) a. it shows how to start a separate activity with an implicit intent b. it shows how to start a separate activity with an explicit intent c. it shows how to start a separate activity with an explicit intent that will report back results to the calling activity d. it shows how to start a separate activity with an implicit intent that will report back results to the calling activity
b. it shows how to start a separate activity with an explicit intent
16. We can start a separate activity and do so in a way to get results back. Identify all correct statements a. Result data is communicated with a content provider b. The resultCode communicates success or failure of the requested operation c. Result data cannot be communicated back with message passing, this is done only with the help of shared static variables d. Result data is communicated back with the Extras of an intent e. This is misleading, we cannot start an activity and get results back. It is a one way communication f. The requestCode allows the sender of the request to match answers with corresponding questions
b. the resultCode communicates success or failure of the requested operation d. result data is communicated back with the Extras of an intent f. the requestCode allows the sender of the request to match answers with corresponding questions
19. Which component do you use in your code if your app needs to recognize that the system is low on power and will shut down? a. Activity b. Content provider c. Broadcast receiver d. A service
broadcast receiver
4. Android applications contain 4 different components. Pick these 4 components from the following list of candidates a. SSL b. Webkit c. Broadcast Receiver d. Dalvik virtual machine e. Activity f. SQLite g. Service h. Content provider
c. Broadcast Receiver e. Activity g. Service h. Content Provider
2. Select all statements about a Broadcast Receiver that are correct a. A Broadcast Receiver is extremely long lived and always in the background actively listening on communication channels for signals b. A Broadcast Receiver is normally designed to accept a message and deal with it (omitting the rest) c. A Broadcast Receiver can have an intentfilter declared with it in the Android Manifest that helps to make sure that it only receives broadcast signals that match its specification (and thus are relevant to it) d. A Broadcast Receiver can be registered at runtime. Incoming intents yield a call to its onReceive method
c. a Broadcast Receiver can have an intent filter declared with it in the Android Manifest that helps to make sure that it only receives broadcast signals that match its specification (and thus are relevant to it) d. a Broadcast Receiver can be registered at runtime. incoming intents yield a call to its onRecieve method
3. Programming a user interface for an Android app is different from normal Java user interface programming. Select all correct statements a. Long b. Long c. For android, it is common to program only some aspects of the user interface in java. Other aspects, for example the appearance of an activity on screen is usually described separately and stored in an XML formatted file d. In android, the user interface design must be described separately and stored in an XML formatted file. It is not possible for the Java code of the application to instantiate graphical objects at runtime and add them to the user interface e. Android has design recommendations or standards for the design of the user interface of an app. The actionbar is an example of this. The key point is to make the use of an app consistent with the use of other apps in order to est. best practices and to lower the learning curve for a user f. The layout of an activity is described in an XML formatted layout file. It consists of widgets and layouts that constitute the appearance of the activity. This set of entities is naturally organized as a tree
c. for Android, it is common to program only some aspects of the user interface in java. other aspects, for example the appearance of an activity on screen is usually described separately and stored in an XML formatted file e. Android has design recommendations or standards for the design of the user interface of an app. The actionbar is an example of this. The key point is to make the use of an app consistent with the use of other apps in order to est. best practices and to lower to learning curve for a user f. the layout of an activity is described in an XML formatted layout file. It consists of widgets and layouts that constitute the appearance of the activity. This set of entities naturally organized as a tree
7. Android activities are subject to scheduling and the schuldar calls certain predefined methods we can use to allocate and release resources; location manage is app to obtain location information but this is expensive serve in terms of energy such that well-behaved app should not request GPS info without it; which method pair is good to allocation/release access to location info? a. OnCreate - onDestroy b. onLaunch - onFinish c. onStart - onStop d. onResume - onPause
d. onResume - onPause
11. the android emulator benefits from a lot of virtualization and hardware acceleration. Why is the emulator slow? a. The emulator implementation is horribly inefficient as the developers for the emulator were not paying attention to that which is unfortunate b. Long c. The emulator pays a huge price in terms of performance because it is very generic and supports a huge variety of Android systems at once. This makes it an incredibly large and complicated software system d. The emulator operates an actual Android operating system image on top of a QEMU emulator that runs in software. This is simply a huge task to compute.
d. the emulator operators an actual Android operating system image on top of a QEMU emulator that runs in software. This is simply a huge task to compute
13. The android scheduler may kill an app if it runs short on resources, in particular main memory. To make your app robust against this kind of treatment you want to store the state of your app on persistent storage with the help of shared preferences. This scheduler is kind enough to call certain predefined methods on your app if it schedules it. Which method would you use to store your app's state when you decide that the app should backup its state when it is no longer visible on the screen? a. OnRestart b. onDestroy c. onStop d. onStart
onStop