WorksheetsAndroid Quiz 9
Total questions: 15
Worksheet time: 15mins
Name
Class
Date
1.
Which component/service android system use to send an alert to user?
a)
Content Provider
b)
NotificationManager
c)
BroadcastReceiver
d)
AlertDialog
2.
In Android application, each new activity created must be defined in
a)
res/layout
b)
res/values
c)
Build.gralde
d)
AndroidManifest.xml
3.
Which of the following is NOT a valid usage for Intents?
a)
Activate and Activity
b)
Activate a Service
c)
Activate a Broadcast receiver
d)
Activate a SQLite DB Connection
4.
Which of the following choices is considered Android application storage?
a)
Android’s file system
b)
Cache
c)
SQLite database
d)
Microsoft Access
5.
A standard Android toast notification appears near the bottom of the screen, centered
horizontally. To change this position you can use ………………….…
a)
toast.setGravity
b)
toast.coordinates
c)
toast.position
d)
toast.location
6.
From android Oreo and later, which type of service can independence run in background (Do not need to attact with notification)?
a)
Bound service
b)
Background service
c)
Foreground service
d)
System service
7.
Android uses “Intents” to communicate and send data between different components which make it vulnerable to malicious attacks. Which of the following choices are componentlevel Permissions to protect this type of communication? (Multi select)
a)
Activity
b)
Service
c)
Content Provider
d)
Widgets
8.
Which of the following is NOT a state in the lifecycle of a service?
a)
Starting
b)
Running
c)
Destroyed
d)
Paused
9.
What is contained within the manifest xml file?
a)
The permissions the app requires
b)
The list of strings used in the app
c)
The source code
d)
All above choices
10.
What is the time limit of broadcast receiver in android?
a)
10 sec
b)
15 sec
c)
5 sec
d)
1 hour
11.
Which is type of Singleton allows intance is loaded into memory when calling method getInstance() ?
a)
Double Check Locking
b)
Thread Safe
c)
Bill Pugh
d)
Lazy Initialization
12.
What are false when comparing Prototype and Object Pool?
a)
Both of them can reuse exist object.
b)
Prototype permits modify object without altering the original but Object Pool does not.
c)
They allows to create unlimited objects.
d)
Object is always available to access.
13.
Which design pattern will be helpful to add new functionality to an existing object?
a)
Decorator
b)
Prototype
c)
Template
d)
Flyweight
14.
How can prevent singleton pattern to be broken by reflection?
a)
Using Static
b)
Using Enum
c)
Using Final
d)
Using Volatile
15.
What are the disadvantages of using a singleton design pattern?
a)
Singleton causes code to be tightly coupled. The singleton object is exposed globally and is available to a whole application. Thus, classes using this object become tightly coupled; any change in the global object will impact all other classes using it.
b)
They hide dependencies instead of exposing them.
c)
Singleton principle can be violated by techniques such as cloning. If an application is running on multiple JVM’s, then, in this case, Singleton might be broken.
d)
None of above
100 %
