A. Multiple children cannot have the same alignment inside a Box
B. Box requires a size modifier to display children
C. The code is valid but texts "World" and "!" will overlap at center
D. Text composables must have unique keys inside Box
Solution
Step 1: Check alignment usage
Multiple children can share the same alignment; Box stacks them.
Step 2: Analyze visual result
Texts "World" and "!" both align center, so they overlap visually.
Final Answer:
The code is valid but texts "World" and "!" will overlap at center -> Option C
Quick Check:
Same alignment causes overlap, no syntax error [OK]
Hint: Same alignment stacks children visually overlapping [OK]
Common Mistakes:
Thinking same alignment causes error
Assuming Box needs size modifier always
Confusing keys requirement with lists
5. You want to create a notification badge over an icon using a Box layout. Which approach correctly places a small red circle at the top-right corner of the icon?
hard
A. Place the icon and badge inside a Box; use Modifier.align(Alignment.TopEnd) on the badge
B. Place the icon and badge inside a Row; use Modifier.padding() on the badge
C. Place the icon and badge inside a Column; use Modifier.align(Alignment.Center) on the badge
D. Place the icon and badge inside a Box; use Modifier.align(Alignment.BottomStart) on the badge
Solution
Step 1: Understand Box usage for overlays
Box stacks children, so placing icon and badge inside Box allows overlay.
Step 2: Position badge at top-right
Modifier.align(Alignment.TopEnd) places badge at top-right corner of Box (icon).
Final Answer:
Place the icon and badge inside a Box; use Modifier.align(Alignment.TopEnd) on the badge -> Option A
Quick Check:
Box + align TopEnd = badge overlay top-right [OK]
Hint: Use Box and Modifier.align(Alignment.TopEnd) for top-right badge [OK]
Common Mistakes:
Using Row or Column which don't stack children
Aligning badge at bottom or center instead of top-right
Not using Modifier.align() on badge
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.