NativeScript for Mobile App Development NativeScript Fundamentals 2 — Questions and Answers
Question 1: Which framework flavors does NativeScript officially support?
- Angular, Vue, React, Svelte, and plain JS/TS (Correct answer)
- Only React and Angular
- Only Vue and Svelte
- Only plain JavaScript
Correct answer: Angular, Vue, React, Svelte, and plain JS/TS
NativeScript supports Angular, Vue, React, Svelte, and plain JavaScript/TypeScript as application flavors.
Question 2: What does the `tns.config.json` (or `nativescript.config.ts`) file configure?
- App ID, platform paths, and build settings (Correct answer)
- CSS theme variables
- Database connection strings
- CI/CD pipeline steps
Correct answer: App ID, platform paths, and build settings
nativescript.config.ts defines the application identifier, bundle tool settings, and platform-specific configurations.
Question 3: How does NativeScript access native iOS and Android APIs from JavaScript?
- Through a metadata-driven marshalling layer (Correct answer)
- Through a WebView bridge
- Through REST API calls to a local server
- Through Cordova plugin wrappers
Correct answer: Through a metadata-driven marshalling layer
NativeScript generates metadata for native APIs and uses a marshalling layer to call them directly from JavaScript without a bridge.
Question 4: Which command runs a NativeScript app on a connected Android device?
- ns run android (Correct answer)
- ns deploy android
- ns start android
- ns launch android
Correct answer: ns run android
The `ns run android` command builds and deploys the app to a connected Android device or emulator.
Question 5: What is the purpose of the `platforms` folder in a NativeScript project?
- It contains auto-generated native platform projects for iOS and Android (Correct answer)
- It stores JavaScript source files for each platform
- It holds CSS theme files per platform
- It contains unit test configurations
Correct answer: It contains auto-generated native platform projects for iOS and Android
The platforms folder contains generated Xcode and Gradle projects that are produced during the build process.
Question 6: Which package manager command installs NativeScript globally?
- npm install -g nativescript (Correct answer)
- npm install nativescript
- yarn add nativescript
- npx install nativescript
Correct answer: npm install -g nativescript
Running `npm install -g nativescript` installs the NativeScript CLI globally so the `ns` command is available system-wide.
Which framework flavors does NativeScript officially support?