MCQs / Computer Science / Screen Components and Orientation
Screen Components and Orientation MCQs — Computer Science 40 multiple-choice questions on Screen Components and Orientation from Computer Science, each with the correct answer and, where available, a teacher's explanation. Read through them to revise the chapter, then practise the same questions one by one to test yourself.
1. A ViewGroup is: A group of apps An invisible container that holds and arranges other views A single button A type of notification Answer: B) An invisible container that holds and arranges other views
Explanation: Layouts are ViewGroups that position child views.
Discuss this question
2. Which qualifier targets tablets with a smallest width of at least 600 dp? layout-tablet layout-sw600dp layout-600 layout-large-land Answer: B) layout-sw600dp
Explanation: sw600dp means smallest width ≥ 600 dp.
Discuss this question
3. A window width of 600–840 dp belongs to which window size class? Compact Medium Expanded Large-XL Answer: B) Medium
Explanation: Compact < 600 dp, Medium 600–840 dp, Expanded 840 dp.
Discuss this question
4. Which manifest attribute locks an activity to portrait? android:screenOrientation="portrait" android:configChanges="portrait" android:rotate="false" android:orientation="portrait" Answer: A) android:screenOrientation="portrait"
Explanation: screenOrientation fixes the activity's orientation.
Discuss this question
5. How many pixels is 48 dp on an xxhdpi (480 dpi) screen? 96 144 192 48 Answer: B) 144
Explanation: px = dp × (dpi/160) = 48 × 3 = 144.
Discuss this question
6. Which statement about ViewModel is TRUE? It survives uninstalling the app It must be declared in the manifest It is stored in strings.xml It survives rotation but not process death (unless SavedStateHandle is used) Answer: D) It survives rotation but not process death (unless SavedStateHandle is used)
Explanation: ViewModel lives in memory tied to the activity scope.
Discuss this question
7. Bundles in onSaveInstanceState should contain only small data because: They are sent to the server They are serialised and limited (about 1 MB per transaction) Bundles are encrypted They slow down Gradle Answer: B) They are serialised and limited (about 1 MB per transaction)
Explanation: Large Bundles cause TransactionTooLargeException.
Discuss this question
8. The baseline density (where 1 dp = 1 px) is: xhdpi (320) hdpi (240) mdpi (160 dpi) ldpi (120) Answer: C) mdpi (160 dpi)
Explanation: At 160 dpi one dp equals one pixel.
Discuss this question
9. For apps targeting Android 16/17 on large screens (≥ 600 dp), orientation locks are: Converted to portrait Required by Play Strictly enforced Ignored – apps must adapt to any orientation and size Answer: D) Ignored – apps must adapt to any orientation and size
Explanation: Recent Android versions require adaptive apps on large screens.
Discuss this question
10. Space INSIDE a view between its border and content is called: Padding Gravity Weight Margin Answer: A) Padding
Explanation: Padding is inside; margin is outside.
Discuss this question
11. By default, rotating the device causes the activity to be: Moved to another task Destroyed and recreated Paused only Uninstalled Answer: B) Destroyed and recreated
Explanation: Rotation is a configuration change that recreates the activity.
Discuss this question
12. Converting XML layout into View objects at run time is called: Binding Inflating Compiling Rendering only Answer: B) Inflating
Explanation: setContentView and LayoutInflater inflate layouts.
Discuss this question
13. Which attribute aligns the content INSIDE a TextView? android:layoutmargin android:layoutgravity android:orientation android:gravity Answer: D) android:gravity
Explanation: gravity positions the content within the view itself.
Discuss this question
14. Which method is used to save small UI state before the activity is destroyed? onPause() onSaveInstanceState(outState: Bundle) finish() onStop() Answer: B) onSaveInstanceState(outState: Bundle)
Explanation: Values put into outState are returned in onCreate's savedInstanceState.
Discuss this question
15. Declaring android:configChanges="orientationscreenSize" means: The app restarts Landscape layouts load automatically The activity is not recreated; onConfigurationChanged() is called instead Rotation is disabled Answer: C) The activity is not recreated; onConfigurationChanged() is called instead
Explanation: The developer handles the change manually.
Discuss this question
16. In ConstraintLayout, a width of 0dp means: Match constraints – fill the space between its constraints The view is invisible 0 pixels always wrapcontent Answer: A) Match constraints – fill the space between its constraints
Explanation: 0dp = match constraint.
Discuss this question
17. Why is a flat ConstraintLayout faster than many nested LinearLayouts? It disables padding It does not need XML It uses the GPU only Fewer nested ViewGroups means less measuring and drawing work Answer: D) Fewer nested ViewGroups means less measuring and drawing work
Explanation: Deep hierarchies require more layout passes.
Discuss this question
18. Why should both portrait and landscape layouts use the same view IDs? Because IDs control colours To save memory It is required by Gradle So the same Kotlin/Java code (findViewById) works with either layout Answer: D) So the same Kotlin/Java code (findViewById) works with either layout
Explanation: Code references IDs; matching IDs avoid null views.
Discuss this question
19. android:visibility="gone" means the view is: Deleted from the XML Hidden and takes no space Visible but disabled Hidden but still takes space Answer: B) Hidden and takes no space
Explanation: gone removes the view from layout; invisible keeps its space.
Discuss this question
20. For Android to use an alternative landscape layout, the file must have: Java code inside A different name ending with land The same file name as the portrait layout No IDs Answer: C) The same file name as the portrait layout
Explanation: Android selects between files of the same name in qualified folders.
Discuss this question
21. wrapcontent makes a view: Zero size As big as its content requires Exactly 100 dp Fill the whole parent Answer: B) As big as its content requires
Explanation: wrapcontent sizes the view to fit its content.
Discuss this question
22. Which resources scale perfectly to any density without multiple copies? JPG files PNG files in drawable-mdpi only GIF files Vector drawables Answer: D) Vector drawables
Explanation: Vector drawables are resolution-independent.
Discuss this question
23. Which state is saved AUTOMATICALLY on rotation? A counter stored in a variable All member variables The text of an EditText that has an ID Data downloaded from the internet Answer: C) The text of an EditText that has an ID
Explanation: Framework views with IDs save their own state.
Discuss this question
24. Which widget lets the user pick one option from a drop-down list? CheckBox SeekBar Spinner ImageView Answer: C) Spinner
Explanation: A Spinner shows a drop-down selection.
Discuss this question
25. In a horizontal LinearLayout, two buttons with width 0dp and weights 1 and 2 share the width in the ratio: 1 : 2 2 : 1 1 : 1 0 : 3 Answer: A) 1 : 2
Explanation: Weights distribute remaining space proportionally.
Discuss this question
Page 1 of 2 Next
Practise Screen Components and Orientation MCQs
More Computer Science chapters