Docsity

Certified Cordova Developer Practice Exam, Exams of Technology

Toggle sidebar
bg1
Certified Cordova Developer Practice Exam
**Question 1.** Which file in a Cordova project defines the application’s package identifier,
version, and platform‑specific preferences?
A) package.json
B) config.xml
C) index.html
D) cordova.log
Answer: B
Explanation: *config.xml* is the central configuration file where the app’s id, version, and
preferences such as fullscreen and orientation are declared.
**Question 2.** In the Cordova hybrid model, which component acts as the bridge between
JavaScript and native device APIs?
A) WebView
B) Cordova CLI
C) Native Bridge
D) Service Worker
Answer: C
Explanation: The native bridge (implemented by cordova.js) translates JavaScript calls into
native code, allowing access to device features.
**Question 3.** Which lifecycle event signals that Cordova’s native side is fully loaded and
plugins are ready to be called?
A) onload
B) deviceready
C) pause
D) resume
Answer: B
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a

Partial preview of the text

Download Certified Cordova Developer Practice Exam and more Exams Technology in PDF only on Docsity!

Question 1. Which file in a Cordova project defines the application’s package identifier, version, and platform‑specific preferences? A) package.json B) config.xml C) index.html D) cordova.log Answer: B Explanation: config.xml is the central configuration file where the app’s id, version, and preferences such as fullscreen and orientation are declared. Question 2. In the Cordova hybrid model, which component acts as the bridge between JavaScript and native device APIs? A) WebView B) Cordova CLI C) Native Bridge D) Service Worker Answer: C Explanation: The native bridge (implemented by cordova.js) translates JavaScript calls into native code, allowing access to device features. Question 3. Which lifecycle event signals that Cordova’s native side is fully loaded and plugins are ready to be called? A) onload B) deviceready C) pause D) resume Answer: B

Explanation: The deviceready event fires after the native layer has initialized, ensuring that plugin APIs are safe to use. Question 4. Which CLI command creates a new Cordova project named “MyApp” with the identifier com.example.myapp? A) cordova init MyApp com.example.myapp B) cordova create MyApp com.example.myapp MyApp C) cordova new MyApp com.example.myapp D) cordova start MyApp com.example.myapp Answer: B Explanation: The syntax cordova create creates a project with the given ID and name. Question 5. To add Android as a target platform to an existing Cordova project, which command is used? A) cordova platform add android B) cordova plugin add android C) cordova build android D) cordova run android Answer: A Explanation: cordova platform add android downloads the Android platform source and integrates it into the project. Question 6. Which command builds the project for all added platforms in release mode? A) cordova build --release B) cordova compile --prod C) cordova package --release

B) npm install cordova-plugin-device --save C) cordova add-plugin device D) cordova install device-plugin Answer: A Explanation: The CLI command cordova plugin add installs a plugin; the device plugin’s ID is cordova-plugin-device. Question 10. The cordova-plugin-network-information plugin provides which event to detect connectivity changes? A) online/offline B) connectionchange C) networkstatus D) connectivityupdate Answer: A Explanation: The plugin fires the standard online and offline DOM events when the network state changes. Question 11. When using cordova-plugin-inappbrowser, which target value opens the URL in the system’s default browser? A) _self B) _blank C) _system D) _external Answer: C Explanation: _system tells InAppBrowser to launch the URL using the device’s external browser application.

Question 12. Which storage location provided by cordova-plugin-file is cleared when the app is uninstalled on Android? A) cordova.file.dataDirectory B) cordova.file.cacheDirectory C) cordova.file.documentsDirectory D) cordova.file.externalDataDirectory Answer: B Explanation: The cache directory is meant for temporary files and is removed when the app is removed. Question 13. To upload a file to a remote server with progress callbacks, which plugin should be used? A) cordova-plugin-file-transfer B) cordova-plugin-httpd C) cordova-plugin-background-upload D) cordova-plugin-fetch Answer: A Explanation: The file‑transfer plugin provides FileTransfer.upload with progress events for monitoring uploads. Question 14. Which HTML5 API can be used for simple key‑value storage without any plugin? A) WebSQL B) IndexedDB C) LocalStorage D) FileSystem API Answer: C

D) cordova-plugin-sound Answer: B Explanation: cordova-plugin-media provides Media objects for playing and recording audio. Question 18. The cordova-plugin-geolocation request for location may be denied by the user. Which error code indicates permission denial? A) PositionError.PERMISSION_DENIED (code 1) B) PositionError.POSITION_UNAVAILABLE (code 2) C) PositionError.TIMEOUT (code 3) D) PositionError.UNKNOWN_ERROR (code 0) Answer: A Explanation: Code 1 corresponds to the user denying access to location services. Question 19. For background location tracking on iOS, which of the following is required in config.xml? A) B) location C) D) No configuration; the plugin handles it automatically. Answer: B Explanation: iOS requires the UIBackgroundModes key with a location entry in the Info.plist, which can be added via `` in config.xml. Question 20. Which plugin is commonly used to schedule a local notification that fires even when the app is closed? A) cordova-plugin-push

B) cordova-plugin-local-notifications C) cordova-plugin-background-fetch D) cordova-plugin-schedule Answer: B Explanation: The local‑notifications plugin allows scheduling alerts that trigger independently of app execution. Question 21. To receive remote push notifications on Android via Firebase Cloud Messaging, which plugin ID should be added? A) cordova-plugin-fcm B) cordova-plugin-push C) cordova-plugin-firebase-messaging D) cordova-plugin-firebase-notifications Answer: B Explanation: cordova-plugin-push supports FCM on Android and APNS on iOS for remote notifications. Question 22. Which Cordova plugin provides the ability to vibrate the device for a specified duration? A) cordova-plugin-device-motion B) cordova-plugin-vibration C) cordova-plugin-haptic D) cordova-plugin-buzz Answer: B Explanation: The vibration plugin exposes navigator.vibrate([duration]) to trigger device vibration.

Explanation: The Java class that implements the bridge logic must extend org.apache.cordova.CordovaPlugin. Question 26. For an iOS custom plugin written in Swift, which file typically contains the @objc class that inherits from CDVPlugin? A) Plugin.m B) Plugin.swift C) Plugin.java D) Plugin.kt Answer: B Explanation: Swift plugins use a .swift file with a class marked @objc and subclassing CDVPlugin. Question 27. Which command updates the Cordova CLI to the latest version globally? A) npm update - g cordova B) npm install - g cordova@latest C) cordova upgrade --global D) cordova update cli Answer: B Explanation: npm install - g cordova@latest installs the newest CLI version globally. Question 28. When preparing an iOS build, which tool is used to manage provisioning profiles and certificates? A) Android Studio B) Xcode Organizer C) Keychain Access D) Fastlane match

Answer: B Explanation: Xcode’s Organizer (or the Signing & Capabilities tab) handles provisioning profiles and certificates for iOS. Question 29. In Android’s AndroidManifest.xml, which attribute must be added to request Internet access for a Cordova app? A) android:usesCleartextTraffic="true" B) C) android:networkSecurityConfig="@xml/network_security_config" D) Answer: B Explanation: Declaring the INTERNET permission enables the app to make network requests. Question 30. Which Content Security Policy (CSP) directive is essential to allow loading scripts from the app’s own domain only? A) script-src 'self' 'unsafe-inline' B) script-src * C) script-src 'none' D) script-src 'self' Answer: D Explanation: script-src 'self' restricts script loading to the app’s origin, mitigating XSS risks. Question 31. To debug JavaScript running inside an Android WebView, which Chrome feature is used? A) Chrome Remote Debugger B) Chrome DevTools – “Inspect Devices” C) Chrome Task Manager

B) transform: translateZ(0); C) filter: blur(0); D) visibility: hidden; Answer: B Explanation: Applying a 3D transform like translateZ(0) forces the element onto its own compositor layer, leveraging GPU acceleration. Question 35. In Ionic (a UI framework for Cordova), which component provides a native‑like sliding menu? A) ion-tabs B) ion-menu C) ion-split-pane D) ion-toolbar Answer: B Explanation: ion-menu creates a side‑menu that slides over the content, mimicking native navigation drawers. Question 36. Which of the following statements about cordova-plugin-splashscreen is true? A) It automatically hides after 3 seconds. B) You must call navigator.splashscreen.hide() to dismiss it. C) It only works on Android. D) It replaces the launch image defined in Xcode. Answer: B Explanation: The splash screen stays visible until the JavaScript call navigator.splashscreen.hide() is executed (or the autoHide preference is set).

Question 37. To generate a signed APK for release, which Gradle task must be executed? A) assembleDebug B) assembleRelease C) signReleaseBundle D) buildRelease Answer: B Explanation: ./gradlew assembleRelease builds a release‑signed APK (provided keystore information is configured). Question 38. Which attribute in config.xml controls the default orientation of the app on Android? A) B) C) D) portrait Answer: A Explanation: The Orientation preference sets the screen orientation for Android (and iOS) unless overridden per platform. Question 39. When using cordova-plugin-file, which method returns a FileEntry for a file located in the app’s persistent data directory? A) window.resolveLocalFileSystemURL(cordova.file.dataDirectory + "myfile.txt") B) window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, success, error) C) cordova.file.externalDataDirectory.getFile("myfile.txt", {create:true}) D) All of the above are valid approaches. Answer: D

Question 42. Which command lists all installed plugins and their versions in the current Cordova project? A) cordova plugin ls B) cordova plugins --list C) cordova plugin list D) cordova plugins info Answer: C Explanation: cordova plugin list outputs each plugin name with its version. Question 43. When a Cordova app is built for iOS, which file contains the compiled native code that Xcode signs? A) .ipa B) .app bundle inside the .xcarchive C) CordovaLib.a D) MainActivity.java Answer: B Explanation: Xcode produces a .app bundle (often packaged into an .ipa for distribution) that is signed with the provisioning profile. Question 44. Which of the following is NOT a valid Cordova platform identifier? A) android B) ios C) windows D) macos Answer: D Explanation: Cordova supports android, ios, windows, electron, etc., but not a platform named macos.

Question 45. To enable Live Reload during development, which CLI flag is commonly used with cordova run? A) --livereload B) --dev c) --watch d) --debug Answer: A Explanation: The --livereload flag starts a local server and injects changes into the running app without rebuilding. Question 46. Which plugin provides an API to read the device’s magnetic field sensor data? A) cordova-plugin-device-motion B) cordova-plugin-device-orientation C) cordova-plugin-compass D) cordova-plugin-sensor Answer: C Explanation: cordova-plugin-compass (also known as the device orientation plugin) exposes the magnetometer/compass data. Question 47. In Cordova, what is the purpose of the www/ folder’s index.html file? A) It defines the native splash screen. B) It is the entry point for the WebView’s UI. C) It contains the Cordova CLI configuration. D) It stores plugin metadata. Answer: B

Answer: A Explanation: StatusBarStyle set to lightcontent makes the status bar text/icons white. Question 51. What is the default directory for Android platform assets (icons, splash screens) inside a Cordova project? A) platforms/android/res B) resources/android c) www/assets/android d) platforms/android/app/src/main/res Answer: D Explanation: Cordova places Android resources under platforms/android/app/src/main/res. Question 52. Which of the following is a recommended practice to reduce the size of the final Cordova app bundle? A) Include all possible icon sizes. B) Keep unused plugins in the project. c) Minify and concatenate JavaScript/CSS files. d) Disable gzip compression. Answer: C Explanation: Minifying and concatenating assets reduces file size and improves load performance. Question 53. To enable AndroidX compatibility for plugins, which Gradle property should be set in gradle.properties? A) android.useAndroidX=true b) android.enableJetifier=true c) Both a and b

d) android.enableAndroidX=false Answer: C Explanation: Setting both android.useAndroidX=true and android.enableJetifier=true migrates older support libraries to AndroidX. Question 54. Which Cordova hook type runs after the native project has been prepared but before it is built? A) after_prepare b) after_build c) before_compile d) after_compile Answer: A Explanation: after_prepare fires after the platform’s files are copied and config changes applied, yet before compilation. Question 55. Which JavaScript method is used to listen for the Cordova pause event? A) document.addEventListener('pause', handler, false); b) window.onpause = handler; c) cordova.on('pause', handler); d) navigator.app.pause(handler); Answer: A Explanation: Cordova events are attached via document.addEventListener. Question 56. When using cordova-plugin-file-transfer, which error code indicates a network timeout? A) FileTransferError.FILE_NOT_FOUND_ERR (1) b) FileTransferError.INVALID_URL_ERR (2)