NativeScript for Mobile App Development UI Components and Layouts 1 — Questions and Answers
Question 1: Which NativeScript layout arranges children in a single row or column?
- StackLayout (Correct answer)
- GridLayout
- FlexboxLayout
- AbsoluteLayout
Correct answer: StackLayout
StackLayout stacks child elements vertically (default) or horizontally in a single line.
Question 2: Which layout provides CSS Flexbox-style positioning in NativeScript?
- FlexboxLayout (Correct answer)
- StackLayout
- DockLayout
- WrapLayout
Correct answer: FlexboxLayout
FlexboxLayout implements a subset of the CSS Flexible Box Model for flexible, responsive child positioning.
Question 3: What is the NativeScript equivalent of an HTML `<div>` container?
- ContentView or StackLayout (Correct answer)
- Frame
- Page
- ScrollView
Correct answer: ContentView or StackLayout
ContentView is a single-child layout container similar to a div, while StackLayout groups multiple children like a block div.
Question 4: Which UI component displays a scrollable list of items efficiently in NativeScript?
- ListView (Correct answer)
- ScrollView
- Repeater
- DataGrid
Correct answer: ListView
ListView virtualizes its items, recycling cells for performance when displaying large datasets.
Question 5: Which NativeScript component is used to navigate between pages?
- Frame (Correct answer)
- Router
- Navigator
- PageView
Correct answer: Frame
Frame is the navigation host that manages the page navigation stack in NativeScript.
Question 6: Which NativeScript element accepts single-line user text input?
- TextField (Correct answer)
- TextView
- TextInput
- EditText
Correct answer: TextField
TextField renders a native single-line text input control on both iOS and Android.
Which NativeScript layout arranges children in a single row or column?