NativeScript for Mobile App Development NativeScript Fundamentals 1 — Questions and Answers
Question 1: What does NativeScript use to render UI components on iOS and Android?
- Native platform APIs directly (Correct answer)
- WebView with HTML/CSS
- React Native bridge
- Cordova plugins
Correct answer: Native platform APIs directly
NativeScript renders UI by calling native platform APIs directly, producing truly native UI without a WebView.
Question 2: Which runtime does NativeScript use to execute JavaScript on Android?
- V8 (Correct answer)
- JavaScriptCore
- SpiderMonkey
- Hermes
Correct answer: V8
NativeScript uses the V8 JavaScript engine on Android to execute application code.
Question 3: Which JavaScript engine powers NativeScript on iOS?
- JavaScriptCore (Correct answer)
- V8
- Hermes
- ChakraCore
Correct answer: JavaScriptCore
NativeScript uses JavaScriptCore on iOS because it is the engine provided by Apple's platform.
Question 4: Which command initializes a new NativeScript project?
- ns create (Correct answer)
- ns init
- ns new
- ns start
Correct answer: ns create
The `ns create` command scaffolds a new NativeScript application with the required project structure.
Question 5: What file serves as the entry point for a NativeScript application?
- app.ts / main.ts (Correct answer)
- index.html
- bootstrap.js
- launch.json
Correct answer: app.ts / main.ts
NativeScript applications bootstrap from app.ts (or main.ts), where the root module or component is registered.
Question 6: What is the role of the NativeScript CLI?
- Build, run, and debug NativeScript apps from the terminal (Correct answer)
- Manage cloud deployments only
- Generate native Xcode projects only
- Compile TypeScript to Java
Correct answer: Build, run, and debug NativeScript apps from the terminal
The NativeScript CLI (ns) provides commands to create, build, run, debug, and test NativeScript applications.
What does NativeScript use to render UI components on iOS and Android?