A Column layout arranges its child components vertically, one below the other, like stacking books on a shelf.
Click to reveal answer
beginner
What is a Row layout in Android Compose?
A Row layout arranges its child components horizontally, side by side, like people standing in a line.
Click to reveal answer
intermediate
How do you add space between items in a Column or Row?
You can use the verticalArrangement for Column or horizontalArrangement for Row with values like Arrangement.spacedBy(8.dp) to add space between items.
Click to reveal answer
beginner
What does Modifier.fillMaxWidth() do in a Row layout?
It makes the Row stretch to fill the entire width of its parent container, like spreading your arms wide to cover the space.
Click to reveal answer
intermediate
Why use Modifier.weight() in Row or Column?
It lets child components share available space proportionally, like dividing a pizza into slices based on appetite.
Click to reveal answer
Which layout arranges children vertically in Android Compose?
ARow
BColumn
CBox
DStack
✗ Incorrect
Column arranges children vertically, one below another.
How do you add horizontal space between items in a Row?
AhorizontalArrangement = Arrangement.spacedBy()
Bweight() modifier
Cpadding() modifier
DverticalArrangement = Arrangement.spacedBy()
✗ Incorrect
horizontalArrangement controls spacing between Row children.
What does Modifier.fillMaxWidth() do in a Column?
ACenters Column content
BMakes Column fill parent's height
CAdds padding inside Column
DMakes Column fill parent's width
✗ Incorrect
fillMaxWidth() makes the layout fill the full width available.
Which modifier helps children share space proportionally in Row or Column?
Aweight()
Bpadding()
CfillMaxSize()
Dbackground()
✗ Incorrect
weight() divides space among children based on assigned weights.
If you want to stack items horizontally, which layout do you use?
AColumn
BBox
CRow
DSpacer
✗ Incorrect
Row arranges items side by side horizontally.
Explain how Column and Row layouts differ and when you would use each.
Think about stacking books vs lining up people.
You got /4 concepts.
Describe how to add space between items in a Column or Row layout in Compose.
Spacing is like leaving gaps between objects on a shelf or in a line.
You got /4 concepts.
Practice
(1/5)
1. Which layout arranges its child views vertically in Android Kotlin?
easy
A. Row
B. Column
C. Grid
D. FrameLayout
Solution
Step 1: Understand layout orientation
Column arranges children vertically, stacking them top to bottom.
Step 2: Compare with other layouts
Row arranges children horizontally, Grid arranges in a grid, FrameLayout stacks overlapping.
Final Answer:
Column -> Option B
Quick Check:
Vertical arrangement = Column [OK]
Hint: Vertical means top to bottom, so use Column [OK]
Common Mistakes:
Confusing Row with Column
Thinking Grid arranges vertically only
Mixing FrameLayout stacking with vertical layout
2. Which of the following is the correct Kotlin syntax to create a Row layout with two Text views inside?
easy
A. Row(
Text("Hello"),
Text("World")
)
B. Column {
Text("Hello")
Text("World")
}
C. Row {
Text("Hello")
Text("World")
}
D. Row {
TextView("Hello")
TextView("World")
}
Solution
Step 1: Identify correct Row syntax
Row uses curly braces with child composables inside, separated by lines.
Step 2: Check child components
Text is the correct composable for text display, TextView is Android View, not Compose.
Final Answer:
Row {
Text("Hello")
Text("World")
} -> Option C
Quick Check:
Row uses braces and Text composables [OK]
Hint: Use braces {} for layouts and Text composable for text [OK]
Common Mistakes:
Using parentheses instead of braces for Row
Using Column instead of Row
Using TextView instead of Text composable
3. What will be the visual arrangement of the following code?
A. Missing comma between Text("Hello") and Text("World")
B. Text composable cannot be inside Column
C. Row cannot contain Column as child
D. Column should use braces {} instead of parentheses ()
Solution
Step 1: Check Column syntax
Column uses curly braces {} to enclose children, not parentheses ().
Step 2: Verify child composables
Text can be inside Column; Row can contain Column; commas are not needed between children.
Final Answer:
Column should use braces {} instead of parentheses () -> Option D
Quick Check:
Layouts use braces {} for children [OK]
Hint: Use {} for layout children, not () [OK]
Common Mistakes:
Using () instead of {} for layouts
Thinking commas are required between children
Believing nested layouts are not allowed
5. You want to create a UI where three buttons are arranged horizontally, but the middle button should be twice as wide as the others. Which layout and modifier approach is best in Kotlin Compose?
hard
A. Use Row with weights: Button1 weight=1, Button2 weight=2, Button3 weight=1
B. Use Column with padding on middle button
C. Use Row with fixed width buttons and margin on middle button
D. Use Column with weight modifiers on buttons
Solution
Step 1: Choose horizontal layout
Row arranges children horizontally, perfect for side-by-side buttons.
Step 2: Use weight modifier for sizing
Assign weights to buttons to control relative widths; middle button weight=2 makes it twice as wide.
Final Answer:
Use Row with weights: Button1 weight=1, Button2 weight=2, Button3 weight=1 -> Option A
Quick Check:
Row + weights control horizontal size [OK]
Hint: Use Row and weight modifiers for proportional widths [OK]
Common Mistakes:
Using Column for horizontal arrangement
Using fixed widths instead of weights
Applying padding instead of weight for size
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.