- Android Basics
- Android - Home
- Android - Overview
- Android - Environment Setup
- Android - Architecture
- Android - Application Components
- Android - Hello World Example
- Android - Resources
- Android - Activities
- Android - Services
- Android - Broadcast Receivers
- Android - Content Providers
- Android - Fragments
- Android - Intents/Filters
- Android - User Interface
- Android - UI Layouts
- Android - UI Controls
- Android - Event Handling
- Android - Styles and Themes
- Android - Custom Components
- Android Advanced Concepts
- Android - Drag and Drop
- Android - Notifications
- Location Based Services
- Android - Sending Email
- Android - Sending SMS
- Android - Phone Calls
- Publishing Android Application
- Android Useful Examples
- Android - Alert Dialoges
- Android - Animations
- Android - Audio Capture
- Android - AudioManager
- Android - Auto Complete
- Android - Best Practices
- Android - Bluetooth
- Android - Camera
- Android - Clipboard
- Android - Custom Fonts
- Android - Data Backup
- Android - Developer Tools
- Android - Emulator
- Android - Facebook Integration
- Android - Gestures
- Android - Google Maps
- Android - Image Effects
- Android - ImageSwitcher
- Android - Internal Storage
- Android - JetPlayer
- Android - JSON Parser
- Android - Linkedin Integration
- Android - Loading Spinner
- Android - Localization
- Android - Login Screen
- Android - MediaPlayer
- Android - Multitouch
- Android - Navigation
- Android - Network Connection
- Android - NFC Guide
- Android - PHP/MySQL
- Android - Progress Circle
- Android - ProgressBar
- Android - Push Notification
- Android - RenderScript
- Android - RSS Reader
- Android - Screen Cast
- Android - SDK Manager
- Android - Sensors
- Android - Session Management
- Android - Shared Preferences
- Android - SIP Protocol
- Android - Spelling Checker
- Android - SQLite Database
- Android - Support Library
- Android - Testing
- Android - Text to Speech
- Android - TextureView
- Android - Twitter Integration
- Android - UI Design
- Android - UI Patterns
- Android - UI Testing
- Android - WebView Layout
- Android - Wi-Fi
- Android - Widgets
- Android - XML Parsers
- Android Useful Resources
- Android - Questions and Answers
- Android - Useful Resources
- Android - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Android Mock Test
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.
Android Mock Test I
Q 1 - What is Android?
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.
Q 2 - What is an activity in Android?
A - Activity performs the actions on the screen
Answer : A
Explanation
Activity is a single screen in an application, Activity performs the actions on the screen(UI)
Q 3 - Explain android activity life cycle?
B - OnCreate() −> onStart() −>onResume() −> onPause() −> onStop() −> onRestart() −> onDestroy()
C - OnCreate() −> onStart() −> onPause() −> onResume() −> onStop() −> onDestroy()
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?
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?
Answer : B
Explanation
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 ()?
A - Yes, a user can save all database updates in onStop()
B - No, a user can save in onSavedInstance()
Answer : D
Explanation
Due to low memory problem. your application will close before reaching onStop()
Q 7 - How to kill an activity in Android?
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?
Answer : A
Explanation
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 ?
A - It is an interface to store global information about an application
B - It is used to create new components.
C - Android has two contexts, those are getContext() and getApplicationContext()
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().
Q 10 - What is Pending Intent in android?
B - It is used to pass the data between activities
Answer : C
Explanation
Pending Intent is fired or triggered at a future point of time.
Q 11 - What is android view group?
A - Collection of views and other child views
Answer : A
Explanation
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?
Answer : E
Explanation
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?
A - Margin is specifying the extra space left on all four sides in layout
B - Padding is used to offset the content of a view by specific px or dp
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.
Q 14 -How many sizes are supported by Android?
A - Android supported all sizes
B - Android does not support all sizes
C - Android supports small,normal, large and extra-large sizes
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?
Answer : E
Explanation
Action bar,Launcher, Preference and Tab activities are subclasses of activities in android
Q 16 - What is Manifest.xml in android?
A - It has information about layout in an application
B - It has the information about activities in an application
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.
Q 17 - What is splash screen in android?
A - Initial activity of an application
B - Initial service of an application
Answer : D
Explanation
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?
Answer : A
Explanation
Service life cycle is as onCreate()−>onStartCommand()−>onDestory().
Q 19 - On which thread services work in android?
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.
Q 20 -How to move services to foreground in android?
A - Services always work in Foreground only
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.
Q 21 -What are the functionalities of Binder services in android?
A - Binder is responsible to manage the thread while using aidl in android
B - Binder is responsible for marshalling and un-marshalling of the data
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
Q 22 - What is the difference between services and thread in android?
A - Services performs functionalities in the background. By default services run on main thread only
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.
Q 23 -How to stop the services in android?
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.
Q 24 -How to pass the data from activity to services in android?
B - We can't pass data from activity to services.
C - Using putExtra() method in intent, we can pass the data using setResult()
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?
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 |