

















































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


















































































Question 1. Which command initializes a new NativeScript project using the default template? A) tns create myApp B) tns new myApp C) ns init myApp D) npm init nativescript Answer: A Explanation: tns create <projectName> creates a new NativeScript project with the default template. Question 2. In a NativeScript project, which folder contains platform‑specific generated code after a build? A) app B) src C) platforms D) node_modules Answer: C Explanation: The platforms directory holds the compiled Android and iOS projects generated by the CLI. Question 3. Which file defines TypeScript type references for NativeScript core modules? A) package.json B) nsconfig.json C) references.d.ts D) tsconfig.json Answer: C
Explanation: references.d.ts provides global type declarations for core NativeScript APIs. Question 4. How can you run a NativeScript app on an Android emulator with Hot Module Replacement enabled? A) tns run android --watch B) tns run android --hmr C) tns build android --hmr D) tns emulate android --live Answer: B Explanation: The --hmr flag activates Hot Module Replacement during tns run. Question 5. Which JavaScript engine does NativeScript use on iOS devices? A) V B) Chakra C) JavaScriptCore D) SpiderMonkey Answer: C Explanation: iOS uses Apple's JavaScriptCore engine to execute JavaScript in NativeScript. Question 6. What is the purpose of the application module’s onLaunch event? A) To pause the app when it goes to background B) To execute code right after the app process starts C) To handle push notifications D) To release native resources on exit Answer: B
Answer: B Explanation: StackLayout stacks its child elements vertically (default) or horizontally. Question 10. How does GridLayout define the size of a row that should take all remaining space? A) auto B) * C) 1* D) fr Answer: C Explanation: In NativeScript GridLayout, 1* (or any * value) distributes remaining space proportionally. Question 11. Which layout is most suitable for creating a responsive, wrap‑around list of items? A) StackLayout B) WrapLayout C) AbsoluteLayout D) DockLayout Answer: B Explanation: WrapLayout automatically moves items to the next line when space runs out. Question 12. Which UI component should you use for displaying a large, vertically scrollable area containing other controls? A) ScrollView B) ListView
C) Repeater D) WebView Answer: A Explanation: ScrollView provides a scrollable container for any child layout. Question 13. What CSS selector targets all Button elements on Android only? A) Button.android B) Button.ios C) Button inside android.css file D) Button[platform=android] Answer: C Explanation: Placing the rule in app.css with a separate app.android.css file scopes it to Android. Question 14. Which property of Image allows you to load a remote picture via URL? A) src B) source C) uri D) imageUrl Answer: A Explanation: The src attribute accepts a local path or a remote URL. Question 15. How can you make a Label text bold using CSS? A) font-weight: bold; B) font-style: bold;
C) ViewModel D) Code‑behind of Page Answer: C Explanation: The ViewModel mediates between the UI (View) and data (Model), holding logic. Question 19. Which gesture event is emitted when a user performs a quick swipe left on a ListView item? A) tap B) swipe C) pan D) longPress Answer: B Explanation: The swipe event reports direction (left/right) for quick swipe gestures. Question 20. Which constant lets you write platform‑specific code in a shared TypeScript file? A) platform B) device.os C) isIOS / isAndroid D) OS Answer: C Explanation: isIOS and isAndroid are booleans exported from tns-core-modules/platform. Question 21. How do you call the native Android Toast.makeText method from NativeScript JavaScript? A) android.widget.Toast.makeText(context, "msg", 0).show();
B) Toast.show("msg"); C) new android.Toast("msg").show(); D) global.Toast.makeText(...) Answer: A Explanation: Direct native access uses the fully‑qualified Java class name; you must pass a context. Question 22. Which npm command installs the official camera plugin for NativeScript? A) tns plugin add nativescript-camera B) npm install @nativescript/camera C) tns plugin add @nativescript/camera D) npm i nativescript-camera Answer: C Explanation: Official plugins are scoped under @nativescript; tns plugin add adds them to the project. Question 23. After installing a plugin, which file must be updated to ensure it is linked for iOS? A) Podfile B) Info.plist C) App_Resources/iOS/Podfile D) package.json Answer: C Explanation: NativeScript’s iOS platform reads App_Resources/iOS/Podfile to integrate CocoaPods.
Question 27. In NativeScript‑Vue, where do you define the XML‑like UI markup? A) Inside <template> block of a .vue file B) In a separate .xml file referenced by templateUrl C) Directly in the render function D) In the script section using JSX Answer: A Explanation: NativeScript‑Vue uses a <template> block that contains NativeScript XML markup. Question 28. Which method of ApplicationSettings stores a boolean value? A) setBoolean(key, value) B) setBool(key, value) C) setString(key, value) D) setNumber(key, value) Answer: A Explanation: ApplicationSettings.setBoolean persists a true/false value. Question 29. When using SQLite in NativeScript, which plugin provides the openOrCreateDatabase function? A) nativescript-sqlite B) tns-sqlite C) @nativescript/sqlite D) sqlite-native Answer: C Explanation: The official plugin is @nativescript/sqlite, exposing openOrCreateDatabase.
Question 30. Which tool allows you to inspect native UI elements of a running iOS NativeScript app? A) Chrome DevTools B) Safari Web Inspector C) Android Studio Layout Inspector D) Visual Studio Code debugger Answer: B Explanation: Safari’s Web Inspector can connect to the iOS simulator/device to inspect native views. Question 31. What is the default entry point file for a NativeScript app written in TypeScript? A) main.ts B) app.ts C) app.js D) main.js Answer: A Explanation: main.ts (or main.js when compiled) bootstraps the application. Question 32. Which property of Frame determines whether the navigation stack is cleared before navigating? A) clearHistory B) resetStack C) backstackVisible D) skipHistory
Answer: B Explanation: flexDirection determines whether Flexbox children are laid out in rows or columns. Question 36. Which method of the Http module performs a GET request and returns a promise? A) http.getJSON(url) B) http.request({ url, method: "GET" }) C) http.get(url).then(...) D) http.fetch(url) Answer: D Explanation: http.fetch uses the Fetch API style and returns a promise for any HTTP method. Question 37. To enable background execution of a long‑running task on Android, which plugin is commonly used? A) nativescript-background-fetch B) nativescript-worker C) nativescript-android-service D) nativescript-task-manager Answer: A Explanation: nativescript-background-fetch registers tasks that can run when the app is in background. Question 38. Which lifecycle event fires when the app is about to be terminated on Android? A) onExit
B) onSuspend C) onTerminate D) onClose Answer: A Explanation: application.on(application.exitEvent, ...) is emitted just before the process ends. Question 39. What is the effect of setting android:hardwareAccelerated="false" in AndroidManifest.xml for a NativeScript app? A) Disables all native UI components B) Forces the app to use software rendering, which can degrade performance C) Enables OpenGL ES 3. D) Has no effect on NativeScript apps Answer: B Explanation: Disabling hardware acceleration makes rendering slower and can affect animations. Question 40. Which CSS pseudo‑class can be used to style a Button only when it is pressed? A) :active B) :pressed C) :focus D) :highlight Answer: A Explanation: NativeScript supports the standard :active pseudo‑class for pressed state.
Explanation: The vuex-persistedstate plugin can be used with NativeScript‑Vue to store state in ApplicationSettings. Question 44. When using the ListView component, which property improves performance for large data sets? A) itemTemplate B) rowHeight C) pagingEnabled D) virtualMode Answer: D Explanation: virtualMode enables UI virtualization, rendering only visible items. Question 45. Which method of ObservableArray notifies the UI when an item is added? A) push(item) B) add(item) C) append(item) D) insert(item, index) Answer: A Explanation: push triggers change events that ListView and other bound controls listen to. Question 46. What is the purpose of the tns platform clean android command? A) Removes the platforms/android folder to force a fresh rebuild B) Clears the Android emulator cache only C) Deletes all node modules for Android D) Resets the Android device’s network settings
Answer: A Explanation: tns platform clean deletes the generated platform folder, ensuring a clean build. Question 47. Which file should you edit to customize the splash screen for iOS? A) App_Resources/iOS/LaunchScreen.storyboard B) App_Resources/iOS/Info.plist C) App_Resources/iOS/Assets.xcassets D) app.css Answer: A Explanation: The storyboard defines the launch screen UI for iOS. Question 48. In NativeScript, what does the tns preview command do? A) Builds the app and opens it in a cloud‑based preview app on device without full compilation B) Generates a PDF of the UI layout C) Runs unit tests in a headless mode D) Publishes the app to the App Store preview channel Answer: A Explanation: tns preview streams JavaScript changes to the Preview app for rapid iteration. Question 49. Which method of the Timer module schedules a function to run after a delay only once? A) setTimeout B) setInterval C) schedule D) delay
D) NativeScript does not allow conditional imports Answer: A Explanation: Runtime require inside an if (isAndroid) block prevents errors on iOS. Question 53. Which property of Page controls whether the status bar is hidden? A) actionBarHidden B) statusBarHidden C) androidStatusBarHidden D) iosStatusBarHidden Answer: B Explanation: Setting statusBarHidden="true" on a Page hides the native status bar. Question 54. What is the effect of adding the ns-keep-alive attribute to a Frame element? A) Prevents the frame from being destroyed when navigating away, preserving its navigation stack B) Forces the frame to reload its content on each navigation C) Enables background execution of the frame’s JavaScript D) Disables HMR for that frame Answer: A Explanation: ns-keep-alive="true" keeps the frame alive, maintaining its back stack. Question 55. Which decorator is used to expose a property from a NativeScript‑Angular component to the template? A) @Input() B) @Export()
C) @Bindable() D) @Property() Answer: A Explanation: @Input marks a class property as bindable from the component’s template. Question 56. In NativeScript‑Vue, how do you listen for the native tap event on a Button? A) <Button @tap="onTap"/> B) <Button v-on:tap="onTap"/> C) Both A and B are valid D) <Button @click="onTap"/> Answer: C Explanation: Vue’s @ shorthand and v-on: are equivalent for native events. Question 57. Which method of FileSystem returns a Folder object representing the app’s documents directory? A) knownFolders.documents() B) FileSystem.getDocumentsFolder() C) Folder.documents() D) app.getFolder("documents") Answer: A Explanation: knownFolders.documents() provides a Folder pointing to the writable documents area. Question 58. When using the http module, how can you set a custom header for a POST request?