This section presents you various set of Mock Tests related to Android. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
Q 1 - What is Android?
Android is a stack of software applications for mobile devices, which includes an operating system, middleware applications, and some key applications. It executes within own process and own instance of Dalvik Virtual Machine. DVM executes byte code and later transforms into .dex format files.
Q 2 - What is an activity in Android?
Activity is a single screen in an application, Activity performs the actions on the screen(UI)
Q 3 - Explain android activity life cycle?
OnCreate() − The system will call this,when an activity is created first time.
onStart() − The system will call this,when an activity starts the actions/action on UI.
onResume() − The system will call this, when onRestart() or onPause() is called.
onPause() −> The system will call this, when an activity going into the background.
onStop() − The system will call this, when an activity going into stop.
onRestart() − The system will call this, when an activity going to stop stage and to start the activity again.
onDestroy() − The system will call this, when an activity going in stop mode.
Q 4 - Is it possible to have an activity without UI to perform action/actions?
Generally, every activity is having its UI(Layout). But if a developer wants to create an activity without UI, he can do it.
Q 5 - How to get a response from an activity in Android?
startActivityForResult(Intent intent,int requestCode) will give the response from second activity to first activity as a result.
Q 6 - Can a user save all database updates in onStop ()?
Due to low memory problem. your application will close before reaching onStop()
Q 7 - How to kill an activity in Android?
finish() − It is used to close the activity.
finish(int requestCode) − It is used to close the activity with requestCode.
Q 8 - How to pass the data between activities in Android?
An Intent is used to connect one activity to another activity and having a message passing mechanism between activities.
Q 9 - What is a context in android ?
Context is used to create new components or objects like views and it is used to start activity and services. Android has two kinds of contexts and those are getContext() and getApplicationContext().
Q 10 - What is Pending Intent in android?
Pending Intent is fired or triggered at a future point of time.
Q 11 - What is android view group?
View Group is collaborating with views and other child views,It is an invisible container and base classes for layouts.
Q 12 - What are the layouts available in android?
Android is having Linear Layout(Horizontal and Vertical), Frame Layout, Table Layout, and Relative Layout.
Q 13 - What is the difference between margin and padding in android layout?
Margin specifies the space left on four sides in the layout and padding specifies the exact position where the element going to be taking place in the layout.
Q 14 -How many sizes are supported by Android?
X-large screens are having at least 960dp*720dp resolutions
Large screens are having at least 640dp*480dp resolutions
Normal screens are having at least 470dp*320dp resolutions
Small screens are having at least 426dp*320dp resolutions
Q 15 - WHich of the following is/are are the subclasses in Android?
Action bar,Launcher, Preference and Tab activities are subclasses of activities in android
Q 16 - What is Manifest.xml in android?
Manifest.xml is having information about application as number components in your application,Activity information,service information, and icon about an application
Each application has at least one Manifest file. Without manifest file we can't generate the APK file.
Q 17 - What is splash screen in android?
Splash is an activity. Generally it appears as initial screen of an application and works based on thread concept.
Q 18 - What is the life cycle of services in android?
Service life cycle is as onCreate()−>onStartCommand()−>onDestory().
Q 19 - On which thread services work in android?
Services, by default, work on Main thread. You can start services from any thread, but if you want to update the UI, you need to call Main thread.
Q 20 -How to move services to foreground in android?
We have to call startFordgroud(int id,Notification notification) to make services as foreground services. When it comes to foreground, it will show a notification.
Q 21 -What are the functionalities of Binder services in android?
Binder is responsible to manage the thread while creating aidl and is responsible to do marshalling and un-marshalling of the data. Binders have sub functionalities and interface for clients
Q 22 - What is the difference between services and thread in android?
Services work in the background without any UI and it updates UI by using thread. By default, every service is having a main thread.
Q 23 -How to stop the services in android?
We can stop the services by stopSelf() and stopService(), in some cases android will kill the services due to the low memory problem.
Q 24 -How to pass the data from activity to services in android?
Using putExtra() method, we can send the data. While using it, we need to call setResult() method in services. We can also store data in a common database and access it on services as well as in Activity.
Q 25 -What are the return values of onStartCommand() in android services?
START_STICKY − If android stops services forcefully, using with START_STICKY, it can be restarted automatically without the user interaction.
START_NOT_STICKY − If android stops services forcefully, it will not restart services till user start services.
START_REDELIVER_INTENT − If android stops services forcefully, it will restart services by re-sending an intent.
|Question Number||Answer Key|