Android Fragments MCQ Questions & Answers
This section focuses on "Fragments" of Android. These Multiple Choice Questions (MCQ) should be practiced to improve the Android skills required for various interviews (campus interviews, walk-in interviews, company interviews), placements, entrance exams and other competitive examinations.
1. A __________ is a piece of an activity which enable more modular activity design.
A. Fragment
B. sub-activity
C. Intents
D. Filters
View Answer
Ans : A
Explanation: A Fragment is a piece of an activity which enable more modular activity design. It will not be wrong if we say, a fragment is a kind of sub-activity.
2. What is true about Fragments ?
A. A fragment has its own layout and its own behaviour with its own life cycle callbacks.
B. You can add or remove fragments in an activity while the activity is running.
C. You can combine multiple fragments in a single activity to build a multi-pane UI.
D. All of the above
View Answer
Ans : D
Explanation: All of the above statement are true.
3. Which method is called once the fragment gets visible?
A. onStart
B. onPause
C. onResume
D. onStop
View Answer
Ans : A
Explanation: onStart()The onStart() method is called once the fragment gets visible.
4. Which method is called Fragment going to be stopped?
A. onDestroyView
B. onPause
C. onResume
D. onStop
View Answer
Ans : D
Explanation: onStop()Fragment going to be stopped by calling onStop()
5. Which method is called when called to do final clean up of the fragment's state but Not guaranteed to be called by the Android platform?
A. onDestroyView
B. onPause
C. onDestroy
D. onCreateView
View Answer
Ans : C
Explanation: onDestroy()onDestroy() called to do final clean up of the fragment's state but Not guaranteed to be called by the Android platform.
6. Which method Fragment becomes active?
A. onPause
B. onResume
C. onStart
D. onCreate
View Answer
Ans : B
Explanation: onResume()Fragment becomes active
7. Fragments are divided as ________ stages.
A. 2
B. 4
C. 3
D. 5
View Answer
Ans : C
Explanation: Basically fragments are divided as three stages : Single Frame Fragment, List fragments and Fragments transaction.
8. In which android version Single frame fragment introduced?
A. android 2.0 version
B. android 3.0 version
C. android 4.0 version
D. android 5.0 version
View Answer
Ans : B
Explanation: Single frame fragment is designed for small screen devices such as hand hold devices(mobiles) and it should be above android 3.0 version.
9. Fragments having special list view is called as?
A. list fragment
B. view fragment
C. frame fragment
D. special fragment
View Answer
Ans : A
Explanation: Fragments having special list view is called as list fragment
10. Activity and Fragment transitions in Lollipop are built on top of a relatively new feature in Android called?
A. scenes
B. Activity
C. fragment stack
D. transitions
View Answer
Ans : D
Explanation: Activity and Fragment transitions in Lollipop are built on top of a relatively new feature in Android called Transitions.
Discussion