Unit 5 - Practice Quiz

CSE227 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 What is the primary purpose of Bluetooth technology in mobile devices?

Bluetooth overview Easy
A. Wired data transfer using a USB cable
B. Long-range communication over hundreds of kilometers
C. High-speed internet access like Wi-Fi
D. Short-range wireless communication between devices

2 In the context of Bluetooth, what does 'BLE' stand for?

Bluetooth overview Easy
A. Bluetooth Link Extension
B. Bluetooth Local Environment
C. Bluetooth Low Energy
D. Bluetooth Long Echo

3 Which permission must you declare in the AndroidManifest.xml file to allow an application to create network sockets and access the internet?

Perform network operations Easy
A. android.permission.BLUETOOTH
B. android.permission.ACCESS_NETWORK_STATE
C. android.permission.INTERNET
D. android.permission.WIFI

4 Why is it important to perform network operations on a background thread instead of the main (UI) thread in Android?

Perform network operations Easy
A. To automatically encrypt the data being sent
B. Because the main thread cannot access the internet
C. To make the network requests faster
D. To avoid blocking the user interface and causing the app to freeze

5 What is the process of searching for nearby Bluetooth devices that are broadcasting their presence called?

Available Devices Easy
A. Discovery (or Scanning)
B. Pairing
C. Bonding
D. Connecting

6 Which method in the BluetoothAdapter class starts the process of searching for nearby Bluetooth devices?

Available Devices Easy
A. startDiscovery()
B. findDevices()
C. searchBluetooth()
D. scanForPeripherals()

7 What is a 'paired' or 'bonded' Bluetooth device?

Paired Devices Easy
A. A device that is currently streaming audio
B. A device that is currently in range
C. A device manufactured by the same company
D. A device that has successfully exchanged a security key for future connections

8 Which Android method returns a set of BluetoothDevice objects representing the devices that are already paired with the local device?

Paired Devices Easy
A. getPairedDevices()
B. getBondedDevices()
C. getConnectedDevices()
D. listSavedDevices()

9 What is a major advantage of using Wi-Fi for companion device pairing over Bluetooth Classic?

Wi-Fi Companion device pairing overview Easy
A. Simpler permission model
B. Much higher data transfer speeds
C. Significantly lower power consumption
D. Wider availability in older devices

10 What is the purpose of the CompanionDeviceManager API in Android?

Wi-Fi Companion device pairing overview Easy
A. To control the device's Wi-Fi radio exclusively
B. To simplify the process of discovering and pairing with nearby devices
C. To manage all internet connections
D. To replace Bluetooth functionality entirely

11 In Bluetooth communication, what is a BluetoothSocket primarily used for?

Connect devices Easy
A. To create a connection and transfer data between two devices
B. To scan for available devices
C. To enable or disable the Bluetooth adapter
D. To represent a remote Bluetooth device's properties

12 Which communication protocol is commonly used in Android to create a reliable, stream-based connection over Bluetooth, similar to TCP?

Connect devices Easy
A. UDP
B. RFCOMM
C. GATT
D. HTTP

13 Which type of sensor measures the acceleration forces acting on a device, including the force of gravity?

Motion sensors Easy
A. Accelerometer
B. Gyroscope
C. Barometer
D. Magnetometer

14 What does a gyroscope sensor measure?

Motion sensors Easy
A. The ambient air pressure
B. The device's location on Earth
C. The rate of rotation around the device's axes
D. The ambient magnetic field

15 To implement a feature that detects when a user 'shakes' their phone, which sensor would be most suitable to use?

Motion sensors Easy
A. Proximity sensor
B. Accelerometer
C. Light sensor
D. Temperature sensor

16 Which sensor helps a device determine its orientation relative to the Earth's magnetic north, acting like a digital compass?

Position sensors Easy
A. Barometer
B. GPS
C. Magnetometer
D. Accelerometer

17 What is the most common use case for a proximity sensor in a smartphone?

Position sensors Easy
A. Detecting the phone's altitude
B. Counting the number of steps a user takes
C. Adjusting the screen brightness based on ambient light
D. Turning off the screen during a phone call when the phone is held to the ear

18 Which sensor would you use to measure the ambient air pressure?

Environment sensors Easy
A. Thermometer
B. Photometer
C. Barometer
D. Hygrometer

19 A photometer, also known as a light sensor, is used to measure what?

Environment sensors Easy
A. Ambient light level (illuminance)
B. Ambient humidity
C. Ambient sound level
D. Ambient temperature

20 Which category of sensors do the thermometer, barometer, and hygrometer belong to?

Environment sensors Easy
A. Position sensors
B. Motion sensors
C. Environment sensors
D. Biometric sensors

21 An Android app needs to connect to a heart rate monitor to stream data continuously. Which Bluetooth profile is most suitable for this use case, prioritizing low power consumption?

Bluetooth overview Medium
A. GATT (Generic Attribute Profile)
B. A2DP (Advanced Audio Distribution Profile)
C. SPP (Serial Port Profile)
D. HID (Human Interface Device Profile)

22 In a Bluetooth Classic connection between a smartphone (master) and a speaker (slave), which device is responsible for initiating the connection and managing the piconet timing?

Bluetooth overview Medium
A. The master device (smartphone)
B. The device with the lower MAC address
C. Both devices share the responsibility
D. The slave device (speaker)

23 When establishing a Bluetooth connection using BluetoothSocket, which method call is blocking and should not be executed on the main UI thread to avoid an Application Not Responding (ANR) error?

Perform network operations Medium
A. bluetoothAdapter.getRemoteDevice(address)
B. device.createRfcommSocketToServiceRecord(uuid)
C. socket.close()
D. socket.connect()

24 Your app is designed to receive a stream of sensor data from a connected Bluetooth device. Which component is essential for handling incoming data asynchronously from the BluetoothSocket's InputStream in a separate thread?

Perform network operations Medium
A. A BroadcastReceiver listening for ACTION_ACL_CONNECTED
B. A continuous loop reading from the InputStream within a background thread
C. A ContentProvider to query the data
D. An IntentService that reads the stream once and then stops

25 To create a secure server-side BluetoothServerSocket for an app that needs to accept incoming connections, what is the correct method to call on the BluetoothAdapter?

Perform network operations Medium
A. listenUsingInsecureRfcommWithServiceRecord(name, uuid)
B. startDiscovery()
C. createRfcommSocketToServiceRecord(uuid)
D. listenUsingRfcommWithServiceRecord(name, uuid)

26 To discover new Bluetooth LE devices, your app starts a scan using BluetoothLeScanner.startScan(). To ensure the scan doesn't drain the battery, what is the recommended practice?

Available Devices Medium
A. Scan only when the device is charging
B. Use a Handler to stop the scan after a predefined period (e.g., 10-15 seconds)
C. Set the scan priority to SCAN_MODE_LOW_POWER and run it continuously
D. Let the scan run indefinitely until the app is closed

27 An app needs to find nearby smartwatches that advertise a specific service UUID. How can you configure the Bluetooth LE scan to only return devices that match this criterion, thus saving power and processing time?

Available Devices Medium
A. Connect to each discovered device to query its services
B. Use a ScanFilter with the required ServiceUuid and pass it to startScan()
C. Implement a custom BroadcastReceiver for ACTION_FOUND
D. Discover all devices and then manually check the BluetoothDevice object for the service

28 How does an Android app retrieve a list of Bluetooth devices that have already been paired with the phone without initiating a new discovery scan?

Paired Devices Medium
A. By calling bluetoothAdapter.getBondedDevices()
B. By querying the Settings.Secure content provider
C. By calling bluetoothAdapter.startDiscovery() and filtering for bonded devices
D. By registering a BroadcastReceiver for ACTION_BOND_STATE_CHANGED

29 When a user pairs a new Bluetooth device through the system settings while your app is running, which broadcast intent action should your app listen for to update its list of paired devices dynamically?

Paired Devices Medium
A. BluetoothDevice.ACTION_FOUND
B. BluetoothDevice.ACTION_BOND_STATE_CHANGED
C. BluetoothDevice.ACTION_ACL_CONNECTED
D. BluetoothAdapter.ACTION_DISCOVERY_FINISHED

30 What is the primary advantage of using the Companion Device Manager (CDM) for pairing with a Wi-Fi device over a traditional Wi-Fi Direct or Soft AP approach?

Wi-Fi Companion device pairing overview Medium
A. It is the only way to connect to Wi-Fi devices on Android
B. It provides a much faster data transfer rate than Wi-Fi Direct
C. It grants the app special privileges, like running in the background and accessing notifications, without requiring the user to grant them manually in settings
D. It works without any user interaction or confirmation

31 To initiate companion device pairing, an app needs to create an AssociationRequest. Which piece of information is crucial to include in this request to filter the type of device the user can select from the system-provided dialog?

Wi-Fi Companion device pairing overview Medium
A. The phone's current Wi-Fi SSID
B. The app's package name
C. A DeviceFilter specifying characteristics like a service UUID or device name pattern
D. A request for location permissions

32 An app is using the Network Connectivity API to connect to a smart home device via Wi-Fi. It needs to maintain this connection even if the Wi-Fi network has no internet access. Which capability should be removed from the NetworkRequest.Builder?

Connect devices Medium
A. NET_CAPABILITY_NOT_ROAMING
B. NET_CAPABILITY_VALIDATED
C. NET_CAPABILITY_TRUSTED
D. NET_CAPABILITY_INTERNET

33 Your app uses Wi-Fi Aware to discover and connect to a nearby device. After a successful discovery, what is the next step to establish a direct, bi-directional data path between the two devices?

Connect devices Medium
A. Create a WifiP2pManager and initiate a group
B. The system automatically establishes a TCP socket connection
C. One device creates a ServerSocket and the other creates a Socket using the Network object obtained from the Wi-Fi Aware session
D. Send all data through broadcast messages over the Wi-Fi Aware cluster

34 An app needs to detect the device's orientation in 3D space, including its heading (azimuth) relative to magnetic north. Which sensor or sensor combination provides the most direct and stable data for this purpose?

Motion sensors Medium
A. TYPE_GRAVITY alone
B. TYPE_ROTATION_VECTOR
C. TYPE_ACCELEROMETER alone
D. TYPE_GYROSCOPE alone

35 To implement a "shake to undo" feature, you need to detect a sudden, sharp movement of the device. Which approach using the accelerometer data (SensorEvent.values) would be most effective?

Motion sensors Medium
A. Integrating the velocity over time to find the total distance moved
B. Tracking small, continuous changes in the gravity vector
C. Monitoring for a constant high value on the z-axis
D. Calculating the magnitude of the linear acceleration vector () and checking if it exceeds a high threshold

36 You are building a game where the user tilts the device left and right to control a character. You notice the controls are jittery. To smooth the input from the accelerometer, what signal processing technique should you apply to the sensor readings?

Motion sensors Medium
A. A low-pass filter to average out noise and sudden jerks
B. A derivative filter to detect rapid changes
C. A band-stop filter to block a specific frequency
D. A high-pass filter to remove gravity

37 An application requires the device's orientation relative to the Earth's magnetic field to build a compass. Which sensor type should be registered with the SensorManager to get the raw geomagnetic field data?

Position sensors Medium
A. TYPE_GRAVITY
B. TYPE_GYROSCOPE
C. TYPE_PROXIMITY
D. TYPE_MAGNETIC_FIELD

38 To determine the device's absolute orientation (including North, East, Up), you need to combine data from two specific sensors. Which pair is used by SensorManager.getRotationMatrix() for this calculation?

Position sensors Medium
A. Gyroscope and Proximity sensor
B. Barometer and Ambient Light sensor
C. Accelerometer and Magnetic Field sensor
D. Linear Acceleration and Gyroscope

39 You are developing a hiking app that estimates the user's current altitude. Which sensor provides the most direct and energy-efficient data for calculating changes in altitude?

Environment sensors Medium
A. TYPE_GPS (via LocationManager)
B. TYPE_AMBIENT_TEMPERATURE
C. TYPE_PRESSURE (Barometer)
D. TYPE_ACCELEROMETER

40 An app adjusts its UI theme (e.g., light or dark mode) based on the brightness of the user's surroundings. Which sensor should it listen to for this functionality?

Environment sensors Medium
A. TYPE_LIGHT
B. TYPE_RELATIVE_HUMIDITY
C. TYPE_AMBIENT_TEMPERATURE
D. TYPE_PROXIMITY

41 You are designing a BLE peripheral that streams sensor data. The data packets are small (18 bytes) and must be delivered with the lowest possible latency. To minimize power consumption while meeting the latency requirement, which combination of BLE connection parameters should you request from the central device?

Bluetooth overview Hard
A. A long Connection Interval, zero Slave Latency, long Supervision Timeout.
B. A short Connection Interval, high Slave Latency, long Supervision Timeout.
C. A long Connection Interval, low Slave Latency, long Supervision Timeout.
D. A short Connection Interval, zero Slave Latency, short Supervision Timeout.

42 An Android app communicates with a BLE device that has a custom GATT service. To send a firmware update file (100KB), the app must write data to a characteristic. The MTU size has been negotiated to 247 bytes, allowing a payload of 244 bytes per write. The characteristic uses WRITE_TYPE_DEFAULT (Write With Response). What is the most significant performance bottleneck you must design around?

Perform network operations Hard
A. The processing time on the Android device to slice the 100KB firmware file into 244-byte chunks.
B. The round-trip time (RTT) for each write operation, as the app must wait for the onCharacteristicWrite callback before sending the next packet.
C. The BLE physical layer (PHY) data rate limitation, which is capped at 2 Mbps regardless of other factors.
D. The 20ms delay between each BluetoothGatt.writeCharacteristic() call to avoid flooding the remote device.

43 You are developing an indoor navigation app that uses sensor fusion. You are using TYPE_ROTATION_VECTOR to get the device's orientation. However, you notice a slow, persistent drift in the heading (yaw/azimuth) over several minutes, even when the device is stationary. What is the most likely cause and the best way to correct it?

Motion sensors Hard
A. The sensor reporting delay is too high. The solution is to register the listener with SENSOR_DELAY_FASTEST.
B. The gyroscope has an inherent bias (drift). The solution is to fuse the TYPE_ROTATION_VECTOR output with data from TYPE_GEOMAGNETIC_ROTATION_VECTOR which provides an absolute heading reference.
C. The magnetometer is experiencing magnetic interference. The solution is to switch to TYPE_GAME_ROTATION_VECTOR which does not use the magnetometer.
D. The accelerometer is not calibrated, causing a bias in the gravity vector. The solution is to use TYPE_GRAVITY instead.

44 You are using BluetoothLeScanner.startScan() with a ScanFilter to find a specific peripheral that advertises a custom service UUID. The app works on Android 11 but fails to discover any devices on Android 12, even though all runtime permissions (BLUETOOTH_SCAN, BLUETOOTH_CONNECT, ACCESS_FINE_LOCATION) are granted. The device is advertising correctly. What is a likely cause of this issue?

Available Devices Hard
A. The ScanFilter is missing a device address, which is now mandatory on Android 12.
B. The app's targetSdkVersion is 31 or higher, and the PendingIntent used for the scan is missing the FLAG_IMMUTABLE or FLAG_MUTABLE flag.
C. The app is not explicitly enabling Bluetooth via BluetoothAdapter.enable() before starting the scan.
D. On Android 12+, apps cannot discover devices unless they are already bonded, due to new privacy restrictions.

45 You're using the CompanionDeviceManager API to allow a user to configure a new headless IoT device (like a smart speaker) by connecting the phone to the device's soft AP. Which of the following statements most accurately describes a critical limitation or requirement of this process?

Wi-Fi Companion device pairing overview Hard
A. The CompanionDeviceManager requires the user to manually select the device's Wi-Fi network from the system's Wi-Fi settings before the association can be completed.
B. The app can only scan for and connect to companion devices that have Bluetooth LE advertising enabled alongside their Wi-Fi AP.
C. For the association to succeed without requiring location services to be enabled, the device's Wi-Fi AP must have a specific prefix (e.g., 'DIRECT-') or suffix in its SSID.
D. The app must hold the CHANGE_WIFI_STATE permission to successfully associate with the device and cannot programmatically configure the device's final Wi-Fi credentials.

46 You are creating an augmented reality app that overlays information on the real world. You need the most stable and accurate orientation possible, but it must be immune to magnetic disturbances from nearby electronics or metal structures. Which sensor type is the most appropriate choice and why?

Position sensors Hard
A. TYPE_GEOMAGNETIC_ROTATION_VECTOR, because it provides an absolute heading reference which is crucial for AR.
B. TYPE_ACCELEROMETER and TYPE_GYROSCOPE only, with a custom Kalman filter to manually fuse the data and ignore magnetic fields.
C. TYPE_ROTATION_VECTOR, because it fuses all available sensors for the best possible result.
D. TYPE_GAME_ROTATION_VECTOR, because it is specifically designed for this scenario by excluding the magnetometer data.

47 You are using the phone's barometer (TYPE_PRESSURE) to measure small changes in altitude, such as moving between floors in a building. The raw pressure reading is (in hPa or mbar) and the sea-level reference pressure is . The formula for altitude is . What is the most significant source of error you must account for in your algorithm to achieve reliable floor detection?

Environment sensors Hard
A. Floating-point inaccuracies in the Android device's processor when calculating the power function in the formula.
B. Changes in local weather patterns, which can alter the ambient air pressure by several hPa over a short time, mimicking a change in altitude.
C. The inherent noise and limited precision of the MEMS barometer sensor chip itself.
D. The need to obtain a precise, real-time value for the sea-level pressure from a local weather service.

48 Your app needs to maintain a connection to a bonded BLE medical device. The connection must be re-established automatically and quickly if the user walks out of range and then returns. You are handling reconnection logic in a background service. Which strategy is most robust and battery-efficient for re-establishing the connection?

Paired Devices Hard
A. Immediately call device.connectGatt() with autoConnect = true upon disconnection. The OS will then handle reconnection when the device is detected.
B. Implement a scanner with an exponential backoff strategy. Start with a short scan interval, and if the device isn't found, double the wait time before the next scan, up to a maximum limit, then call device.connectGatt() with autoConnect = false.
C. Upon disconnection, start a periodic scan with BluetoothLeScanner. When the device is found, stop the scan and call device.connectGatt() with autoConnect = false.
D. Upon disconnection, start an aggressive, continuous scan. Once the device is found, immediately call device.connectGatt() with autoConnect = false.

49 In your BluetoothGattCallback, you need to enable notifications for two different characteristics (charA and charB) immediately after connecting. Your code calls gatt.writeDescriptor() for charA's CCCD, and inside the onDescriptorWrite callback for that operation, it calls gatt.writeDescriptor() for charB's CCCD. Why is this sequential approach mandatory?

Connect devices Hard
A. This is a best practice for code readability but is not technically mandatory; the BLE stack can queue outgoing GATT operations.
B. Calling writeDescriptor twice in a row without waiting will cause a BluetoothGatt memory leak on certain Android versions.
C. To prevent a race condition in the peripheral's firmware, which can only handle one descriptor write at a time.
D. The Android BLE stack is asynchronous but serial; it can only handle one GATT operation at a time. Starting a new operation before the previous one's callback is received will cause the second operation to fail.

50 You're implementing a pedometer using TYPE_STEP_COUNTER. The app is killed by the system while in the background. When the user re-opens the app hours later, how do you correctly calculate the number of steps taken during the time the app was not running?

Motion sensors Hard
A. You must register a BroadcastReceiver for a BOOT_COMPLETED intent to restart a service that continuously logs the step count to a file.
B. On the first sensor event after re-launch, the event's value will be the total count since the last device reboot. You must subtract a previously stored value to find the delta.
C. You can't; step counter data is only delivered to a registered listener and is lost when the app is killed.
D. Use the SensorManager.flush() method upon re-launch to retrieve a batch of all sensor events that occurred while the app was inactive.

51 You are building a chat application over Bluetooth Classic using RFCOMM sockets (BluetoothSocket). The app experiences random crashes with IOException: Broken pipe when sending data. The connection seems stable otherwise. The code that sends data is called from multiple UI threads. What is the most likely cause of this error?

Perform network operations Hard
A. The remote device's InputStream buffer is overflowing because it cannot read data as fast as the local device is sending it.
B. The app is missing the BLUETOOTH_ADMIN permission, which is required for stable socket communication.
C. The OutputStream of a BluetoothSocket is not thread-safe. Concurrent writes from multiple threads are corrupting the stream, leading to a connection drop.
D. The RFCOMM channel number being used is conflicting with another Bluetooth service on the device.

52 In a GATT server implementation on an Android peripheral, you define a characteristic with properties PROPERTY_READ and PROPERTY_NOTIFY. You also add a Client Characteristic Configuration Descriptor (CCCD). A central device connects and writes to the CCCD to enable notifications. Later, the central disconnects and reconnects. What is the state of notifications for this central device upon reconnection?

Bluetooth overview Hard
A. Notifications are disabled by default; the central must write to the CCCD again to enable them.
B. The state is indeterminate and depends on the peripheral's Bluetooth chip firmware.
C. Notifications are automatically re-enabled because the central is a bonded device and the GATT server remembers its CCCD configuration.
D. Notifications are enabled only if the central device explicitly reads the CCCD value before attempting to receive notifications.

53 You are developing an app that connects to a Wi-Fi network programmatically using ConnectivityManager.requestNetwork(). The network has no internet access (it's for an IoT device). After a successful connection, you observe that the Android OS disconnects from this network after about a minute and reconnects to the user's home Wi-Fi. How do you prevent this behavior and maintain the connection to the no-internet Wi-Fi?

Connect devices Hard
A. You must acquire a high-priority WifiLock to prevent the system from managing the connection.
B. When the system prompts the user if they want to stay connected to the network without internet, the app must instruct the user to accept. Programmatically, you can't prevent this initial check.
C. You must use the deprecated WifiManager API, as ConnectivityManager always prefers networks with internet.
D. Before making the request, you must prompt the user to "forget" all other Wi-Fi networks in range.

54 Your app uses BLE scanning with ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY). On some newer Android devices, you notice the app's UI becomes sluggish and sometimes unresponsive during the scan. What is the most likely technical reason for this performance degradation?

Available Devices Hard
A. The high frequency of radio usage creates RF interference with the device's Wi-Fi chip, slowing down all network-related tasks.
B. This scan mode creates a large number of ScanResult objects per second, causing frequent garbage collection pauses that freeze the UI thread.
C. SCAN_MODE_LOW_LATENCY is deprecated and causes compatibility issues with new Bluetooth controllers.
D. This scan mode consumes high CPU resources on the main thread, directly impacting UI performance and leading to ANRs (Application Not Responding).

55 When using CompanionDeviceManager.associate(), what is the primary advantage of using an AssociationRequest with a BluetoothLeDeviceFilter over using the classic BluetoothAdapter.startLeScan() API for pairing with a BLE device?

Wi-Fi Companion device pairing overview Hard
A. It allows the app to scan for and connect to BLE devices without holding the BLUETOETOOTH_SCAN or ACCESS_FINE_LOCATION permissions.
B. It can scan for devices even when the screen is off, which is not possible with startLeScan().
C. It automatically handles the entire GATT connection and service discovery process after the user selects a device.
D. It presents a system-managed UI for device selection, and upon user confirmation, grants the app a long-term capability to interact with that device without needing to scan again in the future.

56 An app connects to a bonded BLE device. The device undergoes a firmware update which changes its GATT service structure (e.g., adds new characteristics). After the update, the app running on Android can no longer discover the new services or characteristics, even after reconnecting. What is the most probable cause and the correct solution?

Paired Devices Hard
A. The app must call BluetoothGatt.refresh() after service discovery. This is an unofficial, reflection-based method to force a cache clear.
B. The firmware update changed the device's Bluetooth address, so the app is attempting to connect to the old, non-existent device.
C. The Android device needs to be rebooted to clear its internal Bluetooth stack state.
D. The Android OS has cached the device's GATT services from the initial bonding. The solution is to programmatically un-bond and re-bond with the device.

57 You are trying to obtain the most accurate bearing for outdoor navigation. You get orientation data from SensorManager.getOrientation() which returns azimuth, pitch, and roll. However, the azimuth (bearing) is relative to magnetic North. To get the bearing relative to true North, what additional information do you need and how do you apply it?

Position sensors Hard
A. You need the device's current GPS location to calculate the magnetic declination using the GeomagneticField class, which is then added to or subtracted from the azimuth.
B. You must point the device at a known landmark from a map, read the azimuth, and calculate the offset manually. This offset is then applied to all future readings.
C. You must use the TYPE_GEOMAGNETIC_ROTATION_VECTOR sensor, as it automatically corrects for true North.
D. You need to use a gyroscope to measure the Earth's rotation (Eötvös effect) and calculate the deviation from true North.

58 Your app uses TYPE_LIGHT sensor to adjust screen brightness. You observe that in a consistently lit room, the sensor values fluctuate significantly (e.g., between 200 and 250 lux). To create a stable brightness setting, you decide to implement a filter. Which filtering approach is most suitable for this use case?

Environment sensors Hard
A. A low-pass filter (e.g., an exponential moving average), which smooths out high-frequency noise while still responding to genuine changes in brightness.
B. A high-pass filter, to remove the constant lighting component and only react to changes.
C. A median filter, which requires storing a large buffer of recent values and is ineffective against constant fluctuations.
D. A simple moving average, which is computationally expensive and introduces significant latency.

59 You have a BluetoothGatt connection to a peripheral. All GATT operations are initiated from a background thread to avoid blocking the UI. The BluetoothGattCallback methods, however, are invoked on a system binder thread. What is a critical threading consideration you must implement in your callback handler?

Perform network operations Hard
A. All work inside the callback must be immediately dispatched to the main thread using runOnUiThread to prevent ANRs.
B. No special handling is needed; binder threads are managed by the OS and are safe for any long-running operations.
C. The callback handler should use a Handler tied to your background thread's Looper to process results, ensuring that the logic that initiated the request and the logic that handles its result run on the same thread.
D. You must synchronize all callback methods (e.g., onCharacteristicRead, onCharacteristicWrite) to prevent them from executing concurrently.

60 You are tasked with detecting a specific, complex gesture, like drawing a figure '8' in the air. Simply using TYPE_LINEAR_ACCELERATION is insufficient as it ignores rotation. Which approach would be most effective for recognizing this gesture?

Motion sensors Hard
A. Use the TYPE_SIGNIFICANT_MOTION sensor, which is specifically designed to trigger when complex gestures are performed.
B. Use TYPE_GYROSCOPE to track the rate of rotation on all three axes and look for a specific pattern in the angular velocities.
C. Record a time-series of raw TYPE_ACCELEROMETER data and feed it into a machine learning model (e.g., a recurrent neural network) trained to recognize the gesture pattern.
D. Integrate the TYPE_LINEAR_ACCELERATION data twice over time to get the device's position in 3D space and check if the path traces a figure '8'.