Android Programming Fundamentals
Test your knowledge of core Android programming concepts including Services, ANR, event handling, UI controls, and application theming.
Questions
Android Service is
- a component which runs in the foreground without direct interaction with the user
- a component which runs in the background without direct interaction with the user
- a component which runs in the foreground with direct interaction with the user
- a component which runs in the background with direct interaction with the user
- None of these
What does ANR stands for?
- Android not restarted
- Application not restarted
- Android not responding
- Application not responding
- None of these
Which of the following is the base class for all the classes in Android application?
- Object
- Class
- Android
- Root
- None of these
Which of the following statements is not correct about the android service?
- It is a component which runs in the background without direct interaction with the user.
- These services are used for repetitive and potentially long running operations.
- These services run with a higher priority than inactive and invisible activities.
- None of these
- These services run in the same process, as the main thread of the application.
How does one prevent ANR in an android Application?
- Strictly follows functional programming approach to avoid ANR
- Ensures to follow top-down and reusable features to avoid ANR
- Creates a child thread and place all the actual functionality in it. So, the main thread runs with minimal periods of unresponsive time.
- Creates child thread for every small functionality.
- None of these
ANR dialog appears on the screen in which of the following scenarios?
I. When there is no response to an input event in 5 seconds.
II. When a broadcast receiver is not completed executing within 10 seconds.
- Only in scenario I
- Only in scenario II
- In both scenarios I and II
- Neither of the scenarios I and II
Arrange the sequence of steps to install and setup Android Eclipse IDE.
- Create Android Virtual Device (AVD).
- Configure ADT plugin.
- Install the java development kit.
- Download and install the android SDK.
- Download the ADT plugin for eclipse.
- Download and install Eclipse IDE for developing android application.
- 1, 2, 3, 4, 5, 6
- 3, 4, 6, 5, 1, 2
- 3, 4, 5, 6, 2, 1
- 3, 6, 4, 5, 2, 1
- 6, 5, 4, 3, 2, 1
Which of the following options is the correct way of registering the Event Listener?
- Using an Anonymous Inner class.
- Activity class implements the Listener interface.
- Using Layout file activity_main.xml to specify event handler directly.
- All of the above
- None of these
Which of the following statements is false?
- The tag under a keyword string is possible.
- The tag under a Hex colour is possible.
- The tag under a reference to another resource type is possible.
- The tag under another item tag is possible.
- -
Match the following:
| 1. Event | A. Object that receives notification when an event happens. |
| 2. Event Handler | B. A method that actually handles the event |
| 3. Event Listener | C. Button Presses, Touching the screen |
- 1 – A, 2 – B, 3 – C
- 1 – B, 2 – C, 3 – A
- 1 – C, 2 – B, 3 – A
- 1 – C, 2 – A, 3 – B
- Mappings are not possible with the given information.
Which of the following is not a callback method defined by Service base calss?
- onStartCommand()
- onBind()
- onUnbind()
- onIntent()
- onDestroy()
Which of the following statements is TRUE about Events?
- Events are useful way to collect data about a user's interaction with interactive components of your app.
- Events are usually generated in response to an external action.
- Most commonly used event (any android application), is interaction with touch screen.
- All of the above
- Android framework maintains an event queue into which events are placed as they occur.
Which of the following is/are not UI controls that are provided by Android?
I. TextView
II. EditText
III. AutoCompleteTextView
IV. Button
V. ImageButton
VI. CheckBox
VII. ToggleButton
VIII. Radiobutton
IX. RadioGroup
X. ProgressBar
XI. Spinner
XII. TimePicker
XIII. DatePicker
XIV. TimezonePicker
XV. MenuBar
- Only XI
- Only XI, XIV and XV
- Only XIV and XV
- Only I and II
- Only III and IV
Which of the following pieces of code sets the theme to all the activities in the application?
- <application android.theme=”@style/CustomTheme”><application android.theme="”@style/CustomTheme”"></application>
- <application android:theme=”@style/CustomTheme”><application android:theme="”@style/CustomTheme”"></application>
- <activity android.theme=”@style/CustomTheme”><activity android.theme="”@style/CustomTheme”"></activity>
- <activity android:theme=”@style/CustomTheme”>
- -
Match the Event Handlers with the Event listeners:
| 1. onClick() | A. OnFocusChangeListener() |
| 2. onLongClick() | B. OnClickListener() |
| 3. onFocusChange() | C. OnLongClickListener() |
| 4. onKey() | D. OnMenuItemClickListener() |
| 5. onTouch() | E. OnTouchListener() |
| 6. onMenuItemClick() | F. OnKeyListener() |
- 1 – A, 2 – B, 3 – C, 4 – D, 5 – E, 6 – F
- 1 – B, 2 – C, 3 – A, 4 – F, 5 – E, 6 – D
- 1 – C, 2 – B, 3 – A, 4 – E, 5 – F, 6 – D
- 1 – A, 2 – C, 3 – B, 4 – D, 5 – F, 6 – E
- 1 – E, 2 – C, 3 – B, 4 – D, 5 – F, 6 – A