NativeScript for Mobile App Development NativeScript Fundamentals 3 — Questions and Answers
Question 1: What is the NativeScript Playground?
- A browser-based tool to write and preview NativeScript apps on a device (Correct answer)
- An Android Studio plugin
- A VS Code offline emulator
- A cloud build service only
Correct answer: A browser-based tool to write and preview NativeScript apps on a device
NativeScript Playground is a web-based IDE that lets developers write NativeScript code and preview it live on a physical device using the companion app.
Question 2: What does the `ns doctor` command do?
- Checks that all required dependencies and environment variables are correctly configured (Correct answer)
- Fixes broken native modules automatically
- Audits npm packages for vulnerabilities
- Restarts the Metro bundler
Correct answer: Checks that all required dependencies and environment variables are correctly configured
`ns doctor` inspects the development environment and reports missing SDKs, tools, or misconfigured paths.
Question 3: Which webpack plugin bundles NativeScript applications?
- @nativescript/webpack (Correct answer)
- nativescript-bundle-plugin
- ns-webpack-loader
- native-bundler
Correct answer: @nativescript/webpack
The @nativescript/webpack package provides the webpack configuration preset used to bundle NativeScript applications.
Question 4: What is the purpose of the `node_modules` folder in a NativeScript project?
- It stores npm packages including NativeScript core and plugins (Correct answer)
- It stores compiled native code
- It contains generated Swift and Kotlin files
- It stores device-specific assets
Correct answer: It stores npm packages including NativeScript core and plugins
Like any Node.js project, `node_modules` contains all JavaScript dependencies installed via npm, including @nativescript/core.
Question 5: Which environment variable must be set for Android builds in NativeScript?
- ANDROID_HOME (Correct answer)
- ANDROID_SDK
- JAVA_ANDROID
- NDK_HOME
Correct answer: ANDROID_HOME
ANDROID_HOME must point to the Android SDK directory so NativeScript and Gradle can locate platform tools.
Question 6: What does the `--hmr` flag enable when running a NativeScript app?
- Hot Module Replacement for live code updates without full restart (Correct answer)
- HTTP/2 routing
- Headless mode rendering
- Hardware memory reporting
Correct answer: Hot Module Replacement for live code updates without full restart
`ns run android --hmr` enables Hot Module Replacement so changed modules are swapped at runtime without a full app restart.
What is the NativeScript Playground?