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.