NativeScript for Mobile App Development Certification — Questions and Answers
Question 1: How do you access a raw native Android API class from NativeScript JavaScript?
- Call ns.android.import()
- Use require('android')
- Import it from '@nativescript/core'
- Reference it by its fully qualified Java class name (e.g., android.content.Intent) (Correct answer)
Correct answer: Reference it by its fully qualified Java class name (e.g., android.content.Intent)
NativeScript's metadata system exposes native Android classes globally by their Java package names, so you can write `new android.content.Intent()` directly.
Question 2: Which command initializes a new NativeScript project?
- ns init
- ns create (Correct answer)
- ns new
- ns start
Correct answer: ns create
The `ns create` command scaffolds a new NativeScript application with the required project structure.
Question 3: How does NativeScript access native iOS and Android APIs from JavaScript?
- Through REST API calls to a local server
- Through a metadata-driven marshalling layer (Correct answer)
- Through a WebView bridge
- 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: What does the `tns.config.json` (or `nativescript.config.ts`) file configure?
- App ID, platform paths, and build settings (Correct answer)
- CI/CD pipeline steps
- CSS theme variables
- Database connection strings
Correct answer: App ID, platform paths, and build settings
nativescript.config.ts defines the application identifier, bundle tool settings, and platform-specific configurations.
Question 5: Which NativeScript API runs code in a background thread?
- async/await
- setTimeout with 0ms delay
- Worker API (new Worker()) (Correct answer)
- setImmediate()
Correct answer: Worker API (new Worker())
NativeScript's Worker API (following the Web Workers spec) creates a true background thread to run CPU-intensive JavaScript without blocking the UI.
Question 6: What property controls the orientation of a StackLayout?
- axis
- direction
- orientation (Correct answer)
- flow
Correct answer: orientation
The `orientation` property accepts 'vertical' (default) or 'horizontal' to control how children are stacked.
Question 7: How does NativeScript handle iOS permissions (e.g., camera, location) for plugins?
- Plugins declare usage description strings in Info.plist; the OS prompts the user at runtime (Correct answer)
- Permissions are pre-granted during app install
- NativeScript requests all permissions at startup automatically
- Permissions are managed via a permissions.json file
Correct answer: Plugins declare usage description strings in Info.plist; the OS prompts the user at runtime
iOS requires NSCameraUsageDescription and similar keys in Info.plist; NativeScript plugins add these via their platforms/ios/Info.plist merge files.
Question 8: What causes UI jank in NativeScript applications?
- Running heavy computations synchronously on the main (UI) thread (Correct answer)
- Using TypeScript instead of JavaScript
- Using too many plugins
- Having too many routes defined
Correct answer: Running heavy computations synchronously on the main (UI) thread
Blocking the main thread with CPU-intensive tasks delays UI rendering, causing dropped frames and visible jank.
Question 9: How do you run platform-specific code files in NativeScript?
- Use .android.ts and .ios.ts file suffixes for platform-specific implementations (Correct answer)
- Use conditional imports with dynamic require
- Use #ifdef preprocessor directives
- Use a platform config JSON file
Correct answer: Use .android.ts and .ios.ts file suffixes for platform-specific implementations
NativeScript's bundler automatically selects the .android.ts or .ios.ts version of a file when building for the respective platform.
Question 10: How do you extend a native Android Activity in NativeScript?
- Use the android.app.Activity.extend() method to subclass it (Correct answer)
- Use @AndroidActivity decorator
- Override the onCreate file in platforms/android
- Edit the MainActivity.java directly
Correct answer: Use the android.app.Activity.extend() method to subclass it
NativeScript's extend() method allows JavaScript code to subclass native Java classes, enabling custom Activity behavior.
Question 11: What is the impact of enabling source maps in a NativeScript production build?
- Larger bundle size but easier stack trace debugging (Correct answer)
- No impact on performance
- Enables Chrome DevTools in production
- Smaller bundle size with no debugging
Correct answer: Larger bundle size but easier stack trace debugging
Source maps map minified production code back to original TypeScript/JavaScript source, aiding crash analysis but adding file size to the distribution.
Question 12: In NativeScript Angular, what module provides routing functionality?
- NativeScriptRouterModule (Correct answer)
- NsRouterModule
- AppRoutingModule
- RouterModule
Correct answer: NativeScriptRouterModule
NativeScriptRouterModule from @nativescript/angular replaces Angular's standard RouterModule with native mobile navigation support.
Question 13: What transition type slides the new page in from the right in NativeScript?
- push
- slide (Correct answer)
- enter
- slideRight
Correct answer: slide
The 'slide' transition name in a NavigationTransition causes the incoming page to slide in from the right, which is the default iOS navigation style.
Question 14: What is the purpose of the `visibility` property on a NativeScript view?
- Sets the view's opacity from 0 to 1
- Defines CSS display mode
- Controls whether the view is visible, hidden, or collapsed (Correct answer)
- Toggles the view's enabled state
Correct answer: Controls whether the view is visible, hidden, or collapsed
The `visibility` property accepts 'visible', 'hidden' (retains space), or 'collapse' (removes space) to control view visibility.
Question 15: Which property on an Image component improves ListView scroll performance?
- lazy='true'
- loadMode='async' (Correct answer)
- cache='true'
- defer='true'
Correct answer: loadMode='async'
Setting `loadMode='async'` on an Image element loads images asynchronously off the main thread, preventing scroll jank in lists.
Question 16: What permission must be declared in AndroidManifest.xml to use internet access in NativeScript?
- android.permission.CONNECT
- android.permission.NETWORK_ACCESS
- android.permission.INTERNET (Correct answer)
- android.permission.WEB
Correct answer: android.permission.INTERNET
The INTERNET permission must be declared in the app's AndroidManifest.xml for any network requests to succeed on Android.
Question 17: Where is the primary marketplace for NativeScript plugins?
- npmjs.com (prefix @nativescript/)
- plugins.nativescript.io
- nativescript-plugins.com
- market.nativescript.org (Correct answer)
Correct answer: market.nativescript.org
market.nativescript.org is the official plugin marketplace where community and official plugins are listed and rated.
Question 18: What does `ns run android --no-hmr` do?
- Runs without a connected device
- Skips native module compilation
- Disables HTTPS
- Runs the app without Hot Module Replacement, doing a full restart on file changes (Correct answer)
Correct answer: Runs the app without Hot Module Replacement, doing a full restart on file changes
Disabling HMR causes the app to fully restart on each code change instead of applying updates incrementally, which can help debug HMR-related issues.
Question 19: What is the `loaded` page event used for in NativeScript?
- Trigger HTTP requests from the server
- Fire after the app is installed
- Initialize the bindingContext and run setup logic when the page loads (Correct answer)
- Detect when the layout is measured
Correct answer: Initialize the bindingContext and run setup logic when the page loads
The `loaded` event fires when a page is added to the visual tree, making it the standard place to set the bindingContext and load initial data.
Question 20: Which command runs a NativeScript app on a connected Android device?
- ns launch android
- ns start android
- ns deploy android
- ns run android (Correct answer)
Correct answer: ns run android
The `ns run android` command builds and deploys the app to a connected Android device or emulator.
Question 21: Which runtime does NativeScript use to execute JavaScript on Android?
- V8 (Correct answer)
- SpiderMonkey
- Hermes
- JavaScriptCore
Correct answer: V8
NativeScript uses the V8 JavaScript engine on Android to execute application code.
Question 22: What does the `colSpan` attribute do in a NativeScript GridLayout child?
- Sets column alignment
- Defines the column width
- Makes the child span across multiple columns (Correct answer)
- Merges column definitions
Correct answer: Makes the child span across multiple columns
`colSpan` on a grid child causes it to stretch across the specified number of columns, similar to HTML colspan.
Question 23: When using NativeScript with Vue.js, which state management library is most commonly adopted for global state?
- MobX
- Redux
- Vuex (Correct answer)
- Akita
Correct answer: Vuex
Vuex is Vue's official state management library and integrates naturally with NativeScript-Vue applications for centralized store management.
Question 24: Which JavaScript engine powers NativeScript on iOS?
- ChakraCore
- Hermes
- V8
- JavaScriptCore (Correct answer)
Correct answer: JavaScriptCore
NativeScript uses JavaScriptCore on iOS because it is the engine provided by Apple's platform.
Question 25: What file serves as the entry point for a NativeScript application?
- launch.json
- bootstrap.js
- app.ts / main.ts (Correct answer)
- index.html
Correct answer: app.ts / main.ts
NativeScript applications bootstrap from app.ts (or main.ts), where the root module or component is registered.
Question 26: Which NativeScript plugin provides camera access?
- ns-camera
- @nativescript/camera (Correct answer)
- @nativescript/media
- nativescript-camera-plugin
Correct answer: @nativescript/camera
@nativescript/camera is the official plugin that wraps native camera APIs for taking photos and accessing the photo library.
Question 27: How do you enable console.log output from a NativeScript device in the terminal?
- Only available through Chrome DevTools
- Use adb logcat and filter for NativeScript
- Pipe to a log file with --output
- Run the app with ns run --log and view output in the same terminal (Correct answer)
Correct answer: Run the app with ns run --log and view output in the same terminal
When you run `ns run android` or `ns run ios`, console.log statements from the app are automatically printed in the same terminal window.
Question 28: Which webpack plugin bundles NativeScript applications?
- nativescript-bundle-plugin
- native-bundler
- ns-webpack-loader
- @nativescript/webpack (Correct answer)
Correct answer: @nativescript/webpack
The @nativescript/webpack package provides the webpack configuration preset used to bundle NativeScript applications.
Question 29: Which NativeScript ListView optimization recycles view cells to improve scroll performance?
- Virtual DOM diffing
- Cell/view recycling via the itemTemplates and key template mechanism (Correct answer)
- Lazy data loading only
- GPU-accelerated rendering
Correct answer: Cell/view recycling via the itemTemplates and key template mechanism
ListView recycles a fixed pool of view cells, reusing them with new data as the user scrolls rather than creating new views for every item.
Question 30: In NativeScript with Angular, what is the purpose of the async pipe when displaying observable state in templates?
- It automatically subscribes to an Observable/Promise and unwraps the latest value in the template (Correct answer)
- It pipes data through a backend API before display
- It formats numbers asynchronously
- It delays template rendering by a configurable timeout
Correct answer: It automatically subscribes to an Observable/Promise and unwraps the latest value in the template
The async pipe subscribes to Observables or Promises, renders the resolved value, and automatically unsubscribes when the component is destroyed to prevent memory leaks.
NativeScript for Mobile App Development Certification
A developer certification that validates the ability to create cross-platform mobile applications using NativeScript, covering fundamentals, UI design, data binding, native API access, performance optimization, and debugging techniques.
Exam Rules
- You can skip questions and return to them later
- Flag questions for review before submitting
- No feedback shown until you submit the entire exam
- Unanswered questions count as wrong — answer everything
- 10 pretest questions are mixed in and don't affect your score
- Timer auto-submits when time runs out
- Your progress is auto-saved every 30 seconds