0
0
Android Kotlinmobile~20 mins

Box layout in Android Kotlin - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Box Layout Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
ui_behavior
intermediate
2:00remaining
Box layout stacking order
Given a Box layout with three overlapping Text composables, which Text will appear on top?
Android Kotlin
Box {
  Text("First", modifier = Modifier.align(Alignment.Center))
  Text("Second", modifier = Modifier.align(Alignment.Center))
  Text("Third", modifier = Modifier.align(Alignment.Center))
}
A"First" is on top
B"Second" is on top
C"Third" is on top
DAll texts appear side by side
Attempts:
2 left
💡 Hint
Think about the order composables are declared inside the Box.
ui_behavior
intermediate
2:00remaining
Box layout alignment behavior
What will be the position of a Text composable inside a Box with modifier.align(Alignment.BottomEnd)?
Android Kotlin
Box(modifier = Modifier.size(100.dp)) {
  Text("Hello", modifier = Modifier.align(Alignment.BottomEnd))
}
AText appears at the top-left corner
BText appears at the bottom-right corner
CText appears centered
DText fills the entire Box
Attempts:
2 left
💡 Hint
Alignment.BottomEnd means bottom and right edges.
lifecycle
advanced
2:00remaining
Box layout size with multiple children
If a Box contains two children with fixed sizes 100.dp and 150.dp, what will be the size of the Box by default?
Android Kotlin
Box {
  Box(modifier = Modifier.size(100.dp)) {}
  Box(modifier = Modifier.size(150.dp)) {}
}
ABox size will be 150.dp by 150.dp
BBox size will be 100.dp by 100.dp
CBox size will be 250.dp by 250.dp
DBox size will be zero because no size modifier on parent
Attempts:
2 left
💡 Hint
Box size depends on the largest child by default.
📝 Syntax
advanced
2:00remaining
Correct syntax for Box with padding and background
Which option correctly applies 16.dp padding and a red background color to a Box?
ABox(modifier = Modifier.padding(16.dp).background(Color.Red)) {}
BBox(modifier = Modifier.background(Color.Red).padding(16.dp)) {}
CBox(modifier = Modifier.padding(16).background(Color.Red)) {}
DBox(modifier = Modifier.padding(16.dp).background(red)) {}
Attempts:
2 left
💡 Hint
Order of modifiers affects layout and appearance.
🧠 Conceptual
expert
2:00remaining
Box layout vs Column layout behavior
Which statement best describes the difference between Box and Column layouts in Jetpack Compose?
ABox arranges children horizontally; Column stacks children on top of each other.
BBox arranges children in a grid; Column arranges children in a circle.
CBox and Column both arrange children vertically but Box adds padding automatically.
DBox stacks children on top of each other; Column arranges children vertically one after another.
Attempts:
2 left
💡 Hint
Think about how children are placed visually in each layout.