Android 基础知识

Android - 主页 Android - 概述 Android - 下载安装和设置 Android - Studio IDE Android - 架构 Android - 应用程序组件 Android - Hello World 示例 Android - 资源 Android - 活动 Android - 服务 Android - 广播接收器 Android - 内容提供者 Android - 片段 Android - Intents/Filters

Android - 用户界面

Android - UI 布局 Android - UI 控件 Android - 事件处理 Android - 样式和主题 Android - 自定义组件

Android 高级概念

Android - 拖放 Android - 通知 Android - 基于位置的服务 Android - 发送电子邮件 Android - 发送短信 Android - 拨打电话 Android - 发布应用程序

Android 实用示例

Android - 警报对话框 Android - 动画 Android - 音频捕捉 Android - 音频管理器 Android - 自动完成 Android - 最佳实践 Android - 蓝牙 Android - 相机 Android - 剪贴板 Android - 自定义字体 Android - 数据备份 Android - 开发者工具 Android - 模拟器 Android - Facebook 集成 Android - 手势 Android - 谷歌地图 Android - 图像效果 Android - 图像切换 Android - 内部存储 Android - JetPlayer Android - JSON 解析器 Android - Linkedin 集成 Android - 旋转加载器 Android - 本地化 Android - 登录应用 Android - 媒体播放器 Android - 多点触控 Android - 导航 Android - 网络连接 Android - NFC 指南 Android - PHP/MySQL Android - 进度圈 Android - 进度条 Android - 推送通知 Android - 渲染脚本 Android - RSS 阅读器 Android - 屏幕投射 Android - SDK 管理器 Android - 传感器 Android - 会话管理 Android - 共享首选项 Android - SIP 协议 Android - 拼写检查器 Android - SQLite 数据库 Android - 支持库 Android - 测试 Android - 文字转语音 Android - TextureView Android - Twitter 集成 Android - UI 设计 Android - UI 模式 Android - UI 测试 Android - WebView 布局 Android - Wi-Fi Android - Widgets Android - XML 解析器

Android 其他

Android - 面试问题 Android - 有用的资源 Android - 测验


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

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 问答