Chapter 2
Mobile Application Development
TU BIM past exam questions
Past questions and answers
22 questions set from this chapter. Most repeated first.
- 2025 AD Model · 1 mark
What is the task of emulator?
Answer
The Android emulator (Android Virtual Device) imitates a real Android device on the development computer. Its task is to let developers run, test and debug applications on different screen sizes, API levels and hardware configurations without a physical device.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2025 AD Model · 1 mark
What do you mean by view hierarchy?
Answer
View hierarchy is the tree structure of UI elements in an Android screen. The root is a ViewGroup (such as a layout) that contains child Views and other ViewGroups, and the system draws and handles events by traversing this tree from the root downward.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2025 AD Model · 1 mark
Define activity.
Answer
An Activity is an Android application component that provides a single screen with a user interface where users interact with the app, for example a login screen. It is a subclass of Activity (or AppCompatActivity) and is declared in AndroidManifest.xml.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2025 AD Model · 1 mark
Why do we need Adapter?
Answer
An Adapter acts as a bridge between a data source (array, list, database cursor) and an AdapterView such as ListView, GridView, Spinner or RecyclerView. It converts each data item into a View and supplies it to the UI, so large data sets can be displayed efficiently, with views reused.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2025 AD Model · 1 mark
Define thread.
Answer
A thread is the smallest unit of execution within a process. In Android, the main (UI) thread handles the user interface, and background (worker) threads perform long tasks such as network or database operations so that the UI does not freeze.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2025 AD Model · 1 mark
What is linear layout?
Answer
LinearLayout is a ViewGroup that arranges its child views in a single direction, either horizontally or vertically, as set by android:orientation. The layout_weight attribute can be used to share space among the children.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2025 AD Model · 1 mark
What is intent filter?
Answer
An intent filter is a declaration in AndroidManifest.xml that specifies which implicit intents a component (activity, service or broadcast receiver) can respond to. It uses the <action>, <category> and <data> elements to match incoming intents.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2025 AD Model · 1 mark
What is the task of content provider?
Answer
A ContentProvider manages access to a structured set of data and shares it between applications in a controlled way. It offers a standard interface (URI with query, insert, update, delete) and enforces permissions, e.g. the Contacts provider.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2025 AD Model · 1 mark
List any two aspects of android debugging.
Answer
Two aspects of Android debugging are:
- Viewing log messages with Logcat (using
Log.d(),Log.e()etc.). - Setting breakpoints and stepping through the code in the Android Studio debugger while inspecting variables.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2025 AD Model · 3 marks
Discuss about linear and frame layout.
Answer
LinearLayout arranges its children in a single row (horizontal) or a single column (vertical), set by android:orientation. Children are placed one after another, and android:layout_weight distributes the remaining space proportionally. It is simple and good for forms and lists of components.
<LinearLayout android:orientation="vertical"
android:layout_width="match_parent" android:layout_height="match_parent">
<TextView android:text="Name" ... />
<EditText ... />
</LinearLayout>
FrameLayout is the simplest layout and is designed to hold a single child. Children are stacked on top of each other at the top-left corner, with the last added drawn on top, and their position can be adjusted with android:layout_gravity. It is used for overlays, such as text on an image, and as a container for fragments.
Difference: LinearLayout puts children side by side or one below another, whereas FrameLayout overlaps them in a stack.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2025 AD Model · 3 marks
Describe in brief about the life cycle life activity.
Answer
An activity passes through the following callback methods during its life cycle:
onCreate(): called when the activity is first created. Initialise the UI (setContentView) and variables.onStart(): the activity becomes visible.onResume(): the activity is in the foreground and the user can interact with it (running state).onPause(): another activity is coming to the foreground; save unsaved data and stop heavy tasks.onStop(): the activity is no longer visible.onRestart(): called when a stopped activity is started again, followed byonStart().onDestroy(): called before the activity is destroyed, to release resources.
Flow: onCreate → onStart → onResume → (running) → onPause → onStop → onDestroy. From onPause the activity may return to onResume, and from onStop it may go through onRestart.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2025 AD Model · 3 marks
How do you implement Grid View in mobile application?
Answer
A GridView shows items in a two-dimensional scrollable grid. It is implemented in three steps: add it to the layout, prepare the data, and attach an adapter.
activity_main.xml
<GridView
android:id="@+id/gridView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:numColumns="3"
android:horizontalSpacing="8dp"
android:verticalSpacing="8dp" />
MainActivity.java
GridView gridView = findViewById(R.id.gridView);
String[] items = {"One", "Two", "Three", "Four", "Five", "Six"};
ArrayAdapter<String> adapter = new ArrayAdapter<>(this,
android.R.layout.simple_list_item_1, items);
gridView.setAdapter(adapter);
gridView.setOnItemClickListener((parent, view, position, id) ->
Toast.makeText(this, items[position], Toast.LENGTH_SHORT).show());
For images or custom cells, a custom adapter extending BaseAdapter with its own getView() is used.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2025 AD Model · 3 marks
Explain the process of retrieving cache files using Content provider.
Answer
A content provider exposes data through a content URI, and other components retrieve it using a ContentResolver. To retrieve cached files (for example files in the app's cache directory shared via a FileProvider, a subclass of ContentProvider):
- Declare the provider in
AndroidManifest.xmlwith an authority and afile_paths.xmlthat lists the cache path (<cache-path name="cache" path="." />). - Build the URI for the file:
File file = new File(getCacheDir(), "image.png");
Uri uri = FileProvider.getUriForFile(this, "com.example.app.fileprovider", file);
- Query/open through the resolver:
ContentResolver resolver = getContentResolver();
InputStream in = resolver.openInputStream(uri); // read the file content
Cursor c = resolver.query(uri, null, null, null, null); // name, size
- Read the data from the stream or cursor and close it. Read permission can be given to another app with
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION).
The provider thus controls access while the client only needs the URI.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2025 AD Model · 3 marks
List some functions of SmsManager class with their purposes.
Answer
The SmsManager class is used to send SMS from an app (requires the SEND_SMS permission). Common methods are:
getDefault()/getSystemService(SmsManager.class): gets an instance of SmsManager.sendTextMessage(destAddress, scAddress, text, sentIntent, deliveryIntent): sends a text message to a phone number.divideMessage(text): splits a long message into parts that fit the SMS size limit (160 characters).sendMultipartTextMessage(...): sends a message divided into several parts.sendDataMessage(...): sends a data (binary) message to a port.getSubscriptionId()/getSmsManagerForSubscriptionId(id): selects the SIM in dual-SIM phones.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2025 AD Model · 5 marks
How do you create, test and debug the application? Explain.
Answer
Creating an application
- Install Android Studio and the SDK.
- Create a new project (File > New > New Project), choose a template (e.g. Empty Activity), the language (Java/Kotlin), package name and minimum SDK.
- Design the UI in XML (
res/layout) and write the logic in the activity class. - Declare components and permissions in
AndroidManifest.xml, and keep resources (strings, images) inres/. - Build with Gradle, which generates the APK.
Testing
- Run the app on an emulator (AVD) or a real device connected via USB with debugging enabled.
- Unit tests (JUnit, in
src/test) check logic on the JVM. - Instrumented/UI tests (Espresso, in
src/androidTest) run on a device and test user interactions. - Test on different screen sizes, API levels and orientations.
Debugging
- Logcat shows system and app logs, using
Log.d(TAG, "message"),Log.e(), filtered by tag and level. - Breakpoints: run in debug mode, pause at a line, step over/into, and inspect or watch variables in the debugger.
- Layout Inspector and Profiler help find UI, CPU, memory and network problems.
- Read the stack trace of exceptions to find the failing line, then fix and rerun.
The cycle of write, run, test and debug is repeated until the app works correctly.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2025 AD Model · 5 marks
Explain the key features and benefits of android widget.
Answer
An Android widget (App Widget) is a small view of an application that is shown on the home screen, so users can see information or do quick actions without opening the app, e.g. clock, weather or music controls. It is implemented with an AppWidgetProvider (a BroadcastReceiver), an XML layout using RemoteViews, and an appwidget-provider metadata file, and is declared in the manifest.
Key features
- Appears on the home screen and can be resized and placed by the user.
- Updates periodically (
updatePeriodMillis) or when triggered by events. - Uses
RemoteViewswith a limited set of layouts and views (such as TextView, ImageView, Button, ListView). - Can handle clicks with
PendingIntentto launch the app or perform an action. - Types include information, collection, control and hybrid widgets.
- Has lifecycle callbacks:
onUpdate(),onEnabled(),onDisabled(),onDeleted().
Benefits
- Gives quick, at-a-glance information and one-tap access to features.
- Improves user engagement and app visibility.
- Saves time because the app need not be opened.
- Customisable home screen for the user.
- Keeps the app's content fresh without the user opening it.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2025 AD Model · 5 marks
Describe the process of implementing Recycler View in an application.
Answer
RecyclerView is an Android widget that displays a large data set efficiently by recycling item views that scroll off screen instead of creating new ones.
Steps to implement it
(1) Add the dependency and the widget. Add androidx.recyclerview:recyclerview in build.gradle, then place it in the layout:
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
(2) Create the item layout (item_student.xml) describing one row, e.g. a TextView for the name.
(3) Create the data model, e.g. class Student(val name: String).
(4) Create the ViewHolder and Adapter. The adapter extends RecyclerView.Adapter and overrides three methods:
onCreateViewHolder()inflates the item layout and returns a ViewHolder.onBindViewHolder()binds data at a position to the views.getItemCount()returns the number of items.
class StudentAdapter(private val list: List<Student>) :
RecyclerView.Adapter<StudentAdapter.VH>() {
class VH(v: View) : RecyclerView.ViewHolder(v) {
val name: TextView = v.findViewById(R.id.tvName)
}
override fun onCreateViewHolder(p: ViewGroup, t: Int) =
VH(LayoutInflater.from(p.context).inflate(R.layout.item_student, p, false))
override fun onBindViewHolder(h: VH, pos: Int) { h.name.text = list[pos].name }
override fun getItemCount() = list.size
}
(5) Set the LayoutManager and Adapter in the Activity.
val rv = findViewById<RecyclerView>(R.id.recyclerView)
rv.layoutManager = LinearLayoutManager(this) // or GridLayoutManager
rv.adapter = StudentAdapter(listOf(Student("Ram"), Student("Sita")))
(6) Handle clicks and updates by setting click listeners in the ViewHolder and calling notifyDataSetChanged() or notifyItemInserted() when data changes.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2025 AD Model · 5 marks
What is SQLite database? How data is being stored in the SQLite database?
Answer
SQLite is a lightweight, open-source, serverless, self-contained relational database engine embedded in Android. It needs no configuration and stores the whole database in a single file on the device, and it is queried with standard SQL.
How data is stored
- The database is a single file kept in the app's private storage (
/data/data/<package>/databases/), accessible only to that app. - Data is organised in tables of rows and columns, with types such as INTEGER, TEXT, REAL, BLOB, and a primary key for each row.
- In Android, a subclass of
SQLiteOpenHelpercreates and upgrades the database (onCreate(),onUpgrade()). - Data is inserted, read, updated and deleted using
SQLiteDatabasemethods (insert(),query(),update(),delete()) or raw SQL viaexecSQL()andrawQuery(). Results are read through aCursor.
class DBHelper(c: Context) : SQLiteOpenHelper(c, "school.db", null, 1) {
override fun onCreate(db: SQLiteDatabase) {
db.execSQL("CREATE TABLE student(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT)")
}
override fun onUpgrade(db: SQLiteDatabase, o: Int, n: Int) {
db.execSQL("DROP TABLE IF EXISTS student"); onCreate(db)
}
}
// insert
val cv = ContentValues().apply { put("name", "Ram") }
dbHelper.writableDatabase.insert("student", null, cv)
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2025 AD Model · 10 marks
What are the needs for UI flexibility? Distinguish between activity and fragment? Describe the process of passing data between fragments. [3 + 3 + 4]
Answer
(a) Needs for UI flexibility (3 marks)
Android apps run on phones, tablets, foldables and TVs, with different screen sizes, densities and orientations. A flexible UI is needed to:
- adapt one app to both small and large screens (e.g. list and detail side by side on a tablet, one at a time on a phone);
- support portrait and landscape orientation without rebuilding the whole screen;
- reuse UI parts across several activities, which reduces duplicate code and eases maintenance;
- update part of the screen dynamically (add, replace, remove) without restarting the activity.
Fragments provide this modularity.
(b) Activity vs Fragment (3 marks)
| Activity | Fragment |
|---|---|
| A single screen with a UI; an application component declared in the manifest | A reusable portion of UI that lives inside an activity |
| Can exist independently | Cannot exist alone; needs a host activity |
| Has its own lifecycle (onCreate, onStart, onResume...) | Has its own lifecycle but is tied to the host's (adds onAttach, onCreateView, onDestroyView...) |
| Cannot be nested in another activity | Several fragments can be combined in one activity, and fragments can be reused |
| Changing screens means starting a new activity with an Intent | Swapped using FragmentManager transactions |
(c) Passing data between fragments (4 marks)
Fragments should not talk to each other directly; data goes through the host activity or a shared ViewModel.
- Fragment Result API (recommended):
// Sender
parentFragmentManager.setFragmentResult("key", bundleOf("name" to "Ram"))
// Receiver
parentFragmentManager.setFragmentResultListener("key", viewLifecycleOwner) { _, b ->
val name = b.getString("name")
}
-
Shared ViewModel: both fragments obtain the same
ViewModelscoped to the activity (activityViewModels()); one writes toLiveDataand the other observes it. -
Arguments Bundle (when starting a fragment):
fragment.arguments = bundleOf("name" to "Ram"), read withrequireArguments(). -
Interface callback through the activity: the fragment defines an interface, the activity implements it and forwards the data to the other fragment.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
- 2025 AD Model · 10 marks
How can we use Handler and Runnable to perform background operations and update the UI safely from a non - UI thread? How do you create and publish mobile application in Google play store. [6 + 4].
Answer
(a) Handler and Runnable for background work (6 marks)
Android's UI (main) thread must never be blocked by long tasks such as network or database work (it causes ANR, "Application Not Responding"), and UI views may only be touched from the main thread.
- A Runnable holds the code to run, in its
run()method. - A Handler is attached to a thread's Looper and posts Runnables or Messages to that thread's message queue.
Pattern: do the work in a background thread, then use a Handler created on the main Looper to post the UI update.
val uiHandler = Handler(Looper.getMainLooper())
Thread {
val result = loadFromNetwork() // long task, background thread
uiHandler.post { // Runnable executed on UI thread
textView.text = result // safe UI update
}
}.start()
Other useful methods: postDelayed(runnable, ms) to run after a delay, sendMessage() / handleMessage() for passing data, and removeCallbacks() to cancel. Alternatively runOnUiThread() or View.post() can be used. This keeps the UI responsive and thread-safe.
(b) Creating and publishing an app on Google Play (4 marks)
- Develop and test the app in Android Studio; set a unique
applicationId, version code and version name. - Build a signed release App Bundle (.aab) (Build > Generate Signed Bundle) using your own keystore; keep the key safe.
- Create a Google Play Developer account (one-time registration fee, USD 25).
- In Play Console, create the app: name, language, free or paid.
- Fill the store listing: description, icon, screenshots, feature graphic, category, contact details.
- Complete content rating, privacy policy, data safety and target audience forms.
- Upload the .aab to a release track (internal, closed, open testing or production), add release notes.
- Set pricing and countries, then submit for review. After approval, the app is published and updates are released with a higher version code.
Answer checked by Claude Sonnet · Oct 21, 2026
Test yourself · 2 MCQs
Loading…
Questions from TU BIM Seventh Semester IT 271 Networking System Administration Model Question 2025 (Faculty of Management model question 2025, BIM seventh semester, via EducateNepal), TU BIM Seventh Semester IT 272 Mobile Application Development Model Question 2025 (Faculty of Management model question 2025, BIM seventh semester, via EducateNepal), TU BIM Seventh Semester IT 273 Multimedia System Application Model Question 2025 (Faculty of Management model question 2025, BIM seventh semester, via EducateNepal), TU BIM Seventh Semester IT 274 Data Warehousing and Data Mining Model Question 2025 (Faculty of Management model question 2025, BIM seventh semester, via EducateNepal) and TU BIM Seventh Semester IT 247 E-Commerce and Internet Marketing Model Question 2025 (Faculty of Management model question 2025, BIM seventh semester, via EducateNepal). Answers are written for this site; check them against your class notes.