0
0
Android Kotlinmobile~20 mins

Column and Row layouts in Android Kotlin - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Master of Column and Row Layouts
Get all challenges correct to earn this badge!
Test your skills under time pressure!
ui_behavior
intermediate
2:00remaining
What is the output of this Column layout code?
Consider this Kotlin Compose code snippet. What will the screen show?
Android Kotlin
Column {
  Text("Hello")
  Text("World")
}
AEmpty screen with no text
BTwo texts side by side horizontally: Hello left, World right
COnly one text: HelloWorld combined
DTwo texts stacked vertically: Hello on top, World below
Attempts:
2 left
💡 Hint
Column stacks children vertically, like a list going down.
ui_behavior
intermediate
2:00remaining
What happens if you use Row with these Texts?
Look at this Kotlin Compose code. What is the visual result?
Android Kotlin
Row {
  Text("Left")
  Text("Right")
}
ATexts overlap on top of each other
BTexts appear side by side horizontally: Left then Right
CTexts appear stacked vertically: Left above Right
DOnly one text: LeftRight combined
Attempts:
2 left
💡 Hint
Row arranges children horizontally, like a row of items.
lifecycle
advanced
2:30remaining
What happens if you nest a Row inside a Column?
Given this code, how will the texts be arranged on screen?
Android Kotlin
Column {
  Text("Top")
  Row {
    Text("Left")
    Text("Right")
  }
  Text("Bottom")
}
ATop text on top, then Left and Right side by side, then Bottom text below
BAll texts stacked vertically: Top, Left, Right, Bottom
CAll texts side by side horizontally: Top, Left, Right, Bottom
DOnly Top and Bottom texts visible, Left and Right hidden
Attempts:
2 left
💡 Hint
Column stacks vertically; Row inside it stacks horizontally.
📝 Syntax
advanced
2:00remaining
Which option causes a syntax error in this Column layout?
Identify the option that will NOT compile in Kotlin Compose.
Android Kotlin
Column {
  Text("One")
  Text("Two")
}
A
Column {
  Text("One")
  Text("Two"
}
B
Column {
  Text("One")
  Text("Two")
}
C
Column {
  Text("One")
  Text("Two")
  Text("Three")
}
D
Column {
  Text(text = "One")
  Text(text = "Two")
}
Attempts:
2 left
💡 Hint
Look for missing or extra parentheses or braces.
🧠 Conceptual
expert
3:00remaining
What is the effect of using Modifier.weight(1f) in a Row?
In this Row, what does Modifier.weight(1f) do to the Text composables?
Android Kotlin
Row {
  Text("A", Modifier.weight(1f))
  Text("B", Modifier.weight(2f))
}
AWeights have no effect inside a Row
BText A and B have equal width regardless of weight
CText B takes twice the horizontal space of Text A
DText A takes twice the horizontal space of Text B
Attempts:
2 left
💡 Hint
Weight controls how much space each child fills proportionally.