MCQs / Computer Science / UI Events, Views, Preferences and Data Storage
UI Events, Views, Preferences and Data Storage MCQs — Computer Science (page 2) 39 multiple-choice questions on UI Events, Views, Preferences and Data Storage from Computer Science, each with the correct answer and, where available, a teacher's explanation. Read through them to revise the chapter, then practise the same questions one by one to test yourself.
26. MODEPRIVATE means the preferences file: Is encrypted automatically Is shared with all apps Can be accessed only by the app that created it Is deleted on restart Answer: C) Can be accessed only by the app that created it
Explanation: Private mode restricts access to the calling app.
Discuss this question
27. An Adapter is a: Layout manager Bridge between a data source and a list view that creates a view for each item Type of intent Database Answer: B) Bridge between a data source and a list view that creates a view for each item
Explanation: Adapters bind data items to row views.
Discuss this question
28. SharedPreferences data is saved on the device in a/an: SQLite database Text file on the SD card Server XML file in the app's private sharedprefs folder Answer: D) XML file in the app's private sharedprefs folder
Explanation: Each preferences file is an XML file under /data/data/package/sharedprefs.
Discuss this question
29. Callback methods such as onTouchEvent() that you override in a custom view are called: Intents Event handlers Listeners Adapters Answer: B) Event handlers
Explanation: Event handlers are overridden in the view class itself.
Discuss this question
30. Which call saves preference changes asynchronously? flush() save() commit() apply() Answer: D) apply()
Explanation: apply() writes in the background; commit() is synchronous and returns a Boolean.
Discuss this question
31. Which method opens a private file for writing in internal storage? getExternalStorageDirectory() File("sdcard/notes.txt") openRawResource() openFileOutput("notes.txt", MODEPRIVATE) Answer: D) openFileOutput("notes.txt", MODEPRIVATE)
Explanation: openFileOutput writes to the app's private filesDir.
Discuss this question
32. Which interface notifies an app as the user types in an EditText? OnLongClickListener OnClickListener TextWatcher OnItemSelectedListener Answer: C) TextWatcher
Explanation: TextWatcher has before/on/afterTextChanged callbacks.
Discuss this question
33. Android's built-in lightweight relational database is: Oracle MongoDB MySQL SQLite Answer: D) SQLite
Explanation: SQLite is embedded in Android.
Discuss this question
34. A query on an SQLite database returns a: Cursor View Intent Bundle Answer: A) Cursor
Explanation: A Cursor iterates over query result rows.
Discuss this question
35. Google's modern, coroutine-based replacement for SharedPreferences is: Room ContentProvider Jetpack DataStore WorkManager Answer: C) Jetpack DataStore
Explanation: DataStore stores key–value or typed data asynchronously with Flow.
Discuss this question
36. Writing files to the app's internal storage requires: INTERNET No permission WRITEEXTERNALSTORAGE READMEDIAIMAGES Answer: B) No permission
Explanation: Internal app storage needs no permission.
Discuss this question
37. Why is RecyclerView more efficient than creating a view for every item? It loads all rows at once It runs on a server It uses fewer colours It recycles row views that scroll off-screen using ViewHolders Answer: D) It recycles row views that scroll off-screen using ViewHolders
Explanation: Recycling reduces memory use and keeps scrolling smooth.
Discuss this question
38. Reading the phone's contacts through the Contacts provider requires: No permission INTERNET READCONTACTS permission CALLPHONE Answer: C) READCONTACTS permission
Explanation: Contacts are protected by a dangerous runtime permission.
Discuss this question
39. Which mechanism is the simplest way to send text to another app chosen by the user? ACTIONSEND share intent Content provider Room SQLite Answer: A) ACTIONSEND share intent
Explanation: The share intent lets the user pick the target app.
Discuss this question
Previous Page 2 of 2
Practise UI Events, Views, Preferences and Data Storage MCQs
More Computer Science chapters