Android Mock Test


Advertisements


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.

Questions and Answers

Android Mock Test I

Answer : A

Explanation

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.

Answer : A

Explanation

Activity is a single screen in an application, Activity performs the actions on the screen(UI)

Answer : B

Explanation

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?

A - Not possible

B - Wrong question

C - Yes, it is possible

D - None of the above

Answer : C

Explanation

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?

A - startActivityToResult()

B - startActiivtyForResult()

C - Bundle()

D - None of the above

Answer : B

Explanation

startActivityForResult(Intent intent,int requestCode) will give the response from second activity to first activity as a result.

Answer : D

Explanation

Due to low memory problem. your application will close before reaching onStop()

Answer : C

Explanation

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?

A - Intent

B - Content Provider

C - Broadcast receiver

D - None of the Above

Answer : A

Explanation

An Intent is used to connect one activity to another activity and having a message passing mechanism between activities.

Answer : D

Explanation

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().

Answer : C

Explanation

Pending Intent is fired or triggered at a future point of time.

Answer : A

Explanation

View Group is collaborating with views and other child views,It is an invisible container and base classes for layouts.

Answer : E

Explanation

Android is having Linear Layout(Horizontal and Vertical), Frame Layout, Table Layout, and Relative Layout.

Answer : C

Explanation

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.

Answer : C

Explanation

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?

A - Action Bar Activity

B - Launcher Activity

C - Preference Activity

D - Tab Activity

E - All of above

Answer : E

Explanation

Action bar,Launcher, Preference and Tab activities are subclasses of activities in android

Answer : C

Explanation

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.

Answer : D

Explanation

Splash is an activity. Generally it appears as initial screen of an application and works based on thread concept.

Answer : A

Explanation

Service life cycle is as onCreate()−>onStartCommand()−>onDestory().

Q 19 - On which thread services work in android?

A - Worker Thread

B - Own Thread

C - Main Thread

D - None of the above.

Answer : C

Explanation

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.

Answer : D

Explanation

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.

Answer : C

Explanation

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

Answer : A

Explanation

Services work in the background without any UI and it updates UI by using thread. By default, every service is having a main thread.

Answer : D

Explanation

We can stop the services by stopSelf() and stopService(), in some cases android will kill the services due to the low memory problem.

Answer : D

Explanation

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?

A - START_STICKY

B - START_NOT_STICKY

C - START_REDELIVER_INTENT

D - All of the above

E - None of the above

Answer : D

Explanation

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.

Answer Sheet

Question Number Answer Key
1 A
2 A
3 B
4 C
5 B
6 D
7 C
8 A
9 D
10 C
11 A
12 E
13 C
14 C
15 E
16 C
17 D
18 A
19 C
20 D
21 C
22 A
23 D
24 D
25 D

android_questions_answers.htm

Advertisements
E-Books Store