Docsity

PrepIQ Android Security Essentials Ultimate Exam, Exams of Cybersecurity

Toggle sidebar
bg1
PrepIQ Android Security Essentials Ultimate Exam
**Question 1. Which component of the Android architecture is primarily responsible
for providing process isolation and user-based permissions?**
A) Android Runtime (ART)
B) Hardware Abstraction Layer (HAL)
C) Linux Kernel
D) Application Framework
Answer: C
Explanation: The Linux kernel enforces UID/GID based permissions and isolates each
app in its own process, providing the core security sandbox.
**Question 2. In Android, what is the purpose of the `android:sharedUserId`
attribute in the manifest?**
A) To allow two apps to run in the same process without signing requirements
B) To enable apps signed with the same certificate to share the same Linux UID and
resources
C) To grant both apps the same set of runtime permissions automatically
D) To make the apps visible to each other in the Play Store
Answer: B
Explanation: `android:sharedUserId` lets apps signed with the same certificate
share a common UID, allowing them to share data and run in the same process.
**Question 3. Which permission protection level is granted only to apps signed with
the same certificate as the declaring app?**
A) Normal
B) Dangerous
C) Signature
D) System
Answer: C
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
pf5b
pf5c
pf5d
pf5e
pf5f

Partial preview of the text

Download PrepIQ Android Security Essentials Ultimate Exam and more Exams Cybersecurity in PDF only on Docsity!

Question 1. Which component of the Android architecture is primarily responsible for providing process isolation and user-based permissions? A) Android Runtime (ART) B) Hardware Abstraction Layer (HAL) C) Linux Kernel D) Application Framework Answer: C Explanation: The Linux kernel enforces UID/GID based permissions and isolates each app in its own process, providing the core security sandbox. Question 2. In Android, what is the purpose of the android:sharedUserId attribute in the manifest? A) To allow two apps to run in the same process without signing requirements B) To enable apps signed with the same certificate to share the same Linux UID and resources C) To grant both apps the same set of runtime permissions automatically D) To make the apps visible to each other in the Play Store Answer: B Explanation: android:sharedUserId lets apps signed with the same certificate share a common UID, allowing them to share data and run in the same process. Question 3. Which permission protection level is granted only to apps signed with the same certificate as the declaring app? A) Normal B) Dangerous C) Signature D) System Answer: C

Explanation: Signature-level permissions are granted only when the requesting app is signed with the same certificate as the app that defined the permission. Question 4. What does the Android Verified Boot (AVB) process verify? A) Only the application APK signatures at install time B) The integrity of the bootloader, kernel, and system partitions before the OS loads C) The network traffic encryption used by the device D) The user’s lock-screen PIN or pattern Answer: B Explanation: AVB checks cryptographic hashes of the bootloader, kernel, and system images to ensure the OS has not been tampered with. Question 5. Which of the following is a characteristic of a “dangerous” permission? A) It is automatically granted at install time B) It requires the user’s explicit consent at runtime on Android 6.0+ C) It can only be granted to system apps D) It is never shown to the user in the permission dialog Answer: B Explanation: Dangerous permissions protect sensitive data and require the user to approve them at runtime starting with Android 6.0 (Marshmallow). Question 6. When an app declares a custom permission with protectionLevel="signature|privileged", which apps can be granted that permission? A) Any app that requests it B) Only apps signed with the same certificate and installed in the privileged system partition C) Only apps that are pre-installed by the device manufacturer D) No app can ever obtain it; the level is invalid

C) Storing them in a hardware-backed Trusted Execution Environment (TEE) D) Using a KeyStore entry that is non-exportable Answer: A Explanation: Plain-text storage exposes keys to extraction; the Keystore and TEE provide protected storage. Question 10. Which attribute controls whether a ContentProvider can be accessed by other applications? A) android:enabled B) android:exported C) android:authorities D) android:grantUriPermissions Answer: B Explanation: android:exported="false" makes the provider private to the app; true allows external access. Question 11. In the context of Android IPC, what is an “implicit Intent” vulnerability? A) The Intent is sent without any extras, causing a null-pointer exception B) Any app that matches the Intent filter can receive the Intent, possibly leading to data leakage or spoofing C) The Intent cannot be resolved because no component matches its action D) Implicit Intents are automatically blocked by the system on Android 10+ Answer: B Explanation: Implicit Intents are resolved by the system to any matching component, which can be exploited if not protected. Question 12. Which of the following best describes the “least privilege” principle in Android?

A) An app should request only the permissions it truly needs to function B) All apps should be granted every permission by default for compatibility C) System apps should have fewer permissions than user apps D) Permissions are granted based on the app’s size on the device Answer: A Explanation: Least privilege limits the attack surface by requesting only necessary permissions. Question 13. Which file type is used to define network security configuration for an Android app? A) AndroidManifest.xml B) network_security_config.xml C) security_policy.json D) proguard-rules.pro Answer: B Explanation: network_security_config.xml (placed in res/xml/) defines cleartext traffic, trust anchors, and certificate pinning. Question 14. What is the effect of setting android:exported="false" on a Service component? A) The service can be started only by components from the same app B) The service is hidden from the user in the device settings C) The service runs in a separate process automatically D) The service receives all system broadcast intents Answer: A Explanation: exported="false" restricts the service to be bound or started only by components within the same application.

Answer: C Explanation: protectionLevel="system" restricts the permission to system apps only. Question 18. When an Android device is rooted, which aspect of the security model is most directly compromised? A) The integrity of the app signing certificate chain B) The isolation provided by UID separation for third-party apps C) The ability to enforce runtime permissions D) The hardware-backed keystore Answer: B Explanation: Root access can bypass UID isolation, allowing apps to read/write other apps’ private data. Question 19. Which cryptographic algorithm is recommended for encrypting large amounts of data on Android? A) RSA B) ECC C) AES with GCM mode D) DES Answer: C Explanation: AES-GCM provides authenticated encryption with high performance and is suitable for bulk data. Question 20. What does the android:grantUriPermissions="true" attribute enable for a ContentProvider? A) Automatic granting of read/write permissions to any requesting app B) The ability for the provider to temporarily grant URI permissions via Intent flags C) The provider will ignore the AndroidManifest’s permission declarations

D) The provider will be exported to all apps by default Answer: B Explanation: It allows the provider to grant URI-specific permissions using FLAG_GRANT_READ_URI_PERMISSION or FLAG_GRANT_WRITE_URI_PERMISSION. Question 21. Which of the following is the most effective way to prevent SQL injection attacks in a SQLiteDatabase query? A) Concatenating user input directly into the SQL string B) Using execSQL() with raw strings C) Using parameterized queries with ? placeholders and bindArgs D) Storing queries in a separate XML file Answer: C Explanation: Parameterized queries separate code from data, preventing malicious input from being interpreted as SQL. Question 22. Which Android API level introduced runtime permission prompts for dangerous permissions? A) API 21 (Lollipop) B) API 23 (Marshmallow) C) API 24 (Nougat) D) API 26 (Oreo) Answer: B Explanation: Android 6.0 (API 23) moved dangerous permission granting from install time to runtime. Question 23. What is the purpose of addJavascriptInterface() in a WebView, and why is it considered risky? A) It injects CSS styles; risk is performance overhead

Question 26. What is the effect of setting android:debuggable="false" in the manifest for a release build? A) The app can be debugged only by the device owner B) The app’s code is automatically obfuscated C) The app cannot be attached to a debugger, reducing exposure of runtime data D) The app will not receive logcat messages at all Answer: C Explanation: Disabling debuggable prevents a debugger from attaching, protecting sensitive data from being read during a debug session. **Question 27. Which of the following statements about Android’s Keystore is true? ** A) Keys stored in the Keystore can be exported as raw bytes by any app B) The Keystore can generate hardware-backed keys that never leave the secure element C) The Keystore is only available on devices running Android 12 or higher D) The Keystore stores passwords in plain text for fast retrieval Answer: B Explanation: The Android Keystore can generate keys that are stored in a TEE or Secure Element and are non-exportable. Question 28. Which permission level is automatically granted to all apps without user interaction? A) Normal B) Dangerous C) Signature D) System Answer: A

Explanation: Normal permissions carry minimal risk and are granted at install time without prompting the user. Question 29. Which method should be used to safely read a file from internal storage? A) openFileInput() with a FileInputStream and proper exception handling B) Directly accessing /data/data//files/ via File paths C) Using Runtime.exec("cat ...") D) Reading from external storage with READ_EXTERNAL_STORAGE permission Answer: A Explanation: openFileInput() respects the app’s private storage sandbox and handles I/O safely. Question 30. What is the main security advantage of using LocalBroadcastManager instead of a global broadcast? A) It encrypts the broadcast payload automatically B) It restricts the broadcast to receivers within the same app, preventing other apps from intercepting it C) It allows broadcasts to be sent over the network securely D) It automatically logs every broadcast for audit Answer: B Explanation: LocalBroadcastManager confines broadcasts to the app’s process, eliminating cross-app exposure. Question 31. Which of the following is a recommended way to protect API keys in an Android application? A) Hard-code them in a static final field in the source code B) Store them in plain text in SharedPreferences C) Retrieve them from a secure backend after user authentication D) Include them in the res/values/strings.xml file

C) FLAG_FROM_BACKGROUND

D) FLAG_RECEIVER_REPLACE_PENDING

Answer: B Explanation: FLAG_GRANT_READ_URI_PERMISSION allows the receiving component temporary read access to the supplied URI. Question 35. Which of the following best describes the purpose of “certificate pinning” in an Android app? A) To verify that the device’s OS certificate matches the app’s signing certificate B) To ensure the app only trusts a specific server certificate or public key, mitigating MITM attacks C) To encrypt all outbound network traffic with a pinned key stored in the Keystore D) To pin the app’s UI layout to a specific screen size Answer: B Explanation: Certificate pinning binds the app to a known server certificate/public key, preventing acceptance of rogue certificates. Question 36. Which Android API is used to securely generate random numbers suitable for cryptographic purposes? A) java.util.Random B) java.security.SecureRandom C) android.os.Random D) java.lang.Math.random() Answer: B Explanation: SecureRandom provides cryptographically strong random numbers, unlike the standard Random. Question 37. Which of the following is a correct way to prevent a WebView from executing JavaScript code supplied by a remote page?

A) webView.getSettings().setJavaScriptEnabled(true); B) webView.getSettings().setJavaScriptEnabled(false); C) webView.loadUrl("javascript:...") D) webView.addJavascriptInterface(new Object(), "android"); Answer: B Explanation: Disabling JavaScript removes the ability for remote content to run scripts, reducing XSS risk. Question 38. What is the primary security risk of logging sensitive user data using Log.d() in production builds? A) It can cause the app to crash due to log overflow B) Logcat output may be read by other apps with READ_LOGS permission or by an attacker with physical access C) It increases the app’s memory footprint D) It disables network security configuration Answer: B Explanation: Logs can be accessed by other processes or via physical device access, leaking confidential information. Question 39. Which Android component can be used to expose data to other apps while still enforcing fine-grained read/write permissions? A) Activity B) Service C) ContentProvider D) BroadcastReceiver Answer: C Explanation: ContentProviders provide structured data sharing with per-operation permission checks.

Explanation: Apps on external storage can be modified by the user or other apps, potentially undermining signature verification. Question 43. Which of the following is the most appropriate way to protect a SharedPreferences file that contains non-sensitive configuration data? A) Encrypt the file manually with AES before saving B) Use MODE_PRIVATE when creating the SharedPreferences instance C) Store the file on external storage with WRITE_EXTERNAL_STORAGE permission D) Set android:allowBackup="true" in the manifest Answer: B Explanation: MODE_PRIVATE ensures the preferences file is private to the app and not world-readable. Question 44. What is the purpose of the android:allowBackup attribute in the manifest? A) To enable automatic backups of the app’s private data to the cloud, which may expose data if not controlled B) To allow the app to back up its own APK to external storage C) To grant the app permission to read other apps’ backups D) To disable OTA updates for the app Answer: A Explanation: When allowBackup="true", the system may back up the app’s data, potentially exposing it if the backup is not encrypted. Question 45. Which of the following is a recommended practice when using WebViewClient.shouldOverrideUrlLoading()? A) Always return true to block all navigation B) Validate the URL scheme and host before allowing navigation to prevent malicious redirects C) Disable the method entirely, as it is deprecated

D) Use it to inject JavaScript into every loaded page Answer: B Explanation: Validating URLs prevents the WebView from loading untrusted content that could lead to phishing or XSS. Question 46. Which of the following best describes a “runtime permission” in Android? A) A permission that is granted only when the device boots B) A permission that the user can revoke or grant while the app is running via the Settings UI C) A permission that is automatically granted to all apps at install time D) A permission that is only applicable to system apps Answer: B Explanation: Runtime permissions can be toggled by the user at any time, affecting the app’s ability to access protected resources. Question 47. When using WorkManager to perform network operations, which constraint should be added to ensure data is sent only over unmetered connections? A) setRequiresCharging(true) B) setRequiredNetworkType(NetworkType.UNMETERED) C) setRequiresDeviceIdle(true) D) setBackoffCriteria(BackoffPolicy.LINEAR, 10, TimeUnit.MINUTES) Answer: B Explanation: NetworkType.UNMETERED ensures the work runs only when Wi-Fi or other unmetered networks are available. Question 48. Which of the following is a security benefit of using FileProvider to share files with other apps? A) It automatically encrypts the file before sharing

Question 51. Which of the following is a correct way to restrict a Service to be started only by components of the same app? A) Set android:exported="true" and assign a custom permission B) Set android:exported="false" in the manifest C) Use Intent.setPackage() when starting the service D) Both B and C Answer: D Explanation: exported="false" blocks external apps, and setPackage() ensures the Intent targets only the same package. Question 52. What is the primary purpose of the android:protectionLevel attribute when defining a custom permission? A) To specify the minimum Android API level required B) To indicate whether the permission is normal, dangerous, signature, or system C) To define the encryption algorithm used for the permission D) To set the maximum number of apps that can request it Answer: B Explanation: protectionLevel determines how the system treats the permission (auto-grant, user consent, signature check, etc.). Question 53. Which of the following is a recommended approach to mitigate the risk of reverse engineering of an Android app? A) Ship the app without any code obfuscation B) Use ProGuard or R8 to shrink, obfuscate, and optimize the bytecode C) Store all critical logic in plain Java files in the assets folder D) Disable the Android Runtime (ART) Answer: B Explanation: ProGuard/R8 reduces the readability of compiled code, making reverse engineering harder.

Question 54. Which flag should be used with an Intent to start an activity in a new task? A) FLAG_ACTIVITY_CLEAR_TOP B) FLAG_ACTIVITY_NEW_TASK C) FLAG_ACTIVITY_SINGLE_TOP D) FLAG_ACTIVITY_REORDER_TO_FRONT Answer: B Explanation: FLAG_ACTIVITY_NEW_TASK launches the activity in a separate task stack. Question 55. Which of the following is a strong reason to avoid using android:allowBackup="true" for an app that handles sensitive data? A) It prevents the app from being installed on devices with low storage B) It allows the system backup service to copy the app’s private data, which could be restored on a compromised device C) It disables the use of SharedPreferences D) It forces the app to use only external storage Answer: B Explanation: Backups may be restored on another device or accessed by backup services, potentially leaking sensitive data. Question 56. Which Android API can be used to verify that a downloaded file’s integrity matches a known hash? A) MessageDigest class from java.security B) android.util.Base64 C) android.net.Uri D) android.content.pm.PackageManager Answer: A