2023 past paper
1. What is explicit intent
Using explicit intent any other component can be specified. In other words, the
targeted component is specified by explicit intent. So only the specified target
component will be invoked.
Example:
// Explicit Intent to open SecondActivity
Intent intent = new Intent([Link], [Link]);
startActivity(intent);
2. how to register an activity
In Android, registering an activity means declaring it inside the
[Link] file so that the Android system is aware of the activity
and can launch it when needed.
Example:
<activity android:name=".MyNewActivity" />
Without this declaration, the activity cannot be used in the app.
3. what is fragment
A Fragment is a reusable part of an app’s screen. It has its own layout, lifecycle,
and can handle user actions by itself. But a fragment cannot work alone — it
must be inside an Activity (or another fragment). The fragment’s layout becomes
part of the activity’s layout.
Example
class ExampleFragment extends
Fragment { public ExampleFragment()
{
super([Link].example_fragment);
}
}
4. which broadcast can perform long running task
for longrunning tasks, you should use a goAsync() (inside a
BroadcastReceiver)
purpose
Normally, a BroadcastReceiver is done as soon as its onReceive() method
finishes, and the system may close it. This causes problems if you still have
some work left to do. The goAsync() method fixes this by letting the system
know that the receiver still has work to finish, even after onReceive() ends.
5. which permission allow you to read address book
The READ_CONTACTS permission allows an Android app to read your contact
list and other contact details, such as names, phone numbers, and email
addresses, stored on the device. This permission is declared in an app's
manifest file
Using
<uses-permission android:name="[Link].READ_CONTACTS" />
6. what is the return values of an start command () in android service
In Android, the onStartCommand() method of a Service returns an integer
value that tells the system how to handle the service if it gets killed.
The possible return values are:
START_STICKY → If the service is killed, the system restarts it with a null
intent. (Good for longrunning background tasks like music players.)
START_NOT_STICKY → If the service is killed, it won’t restart unless an
explicit intent calls it again.
START_REDELIVER_INTENT → If the service is killed, the system restarts
it and redelivers the last intent.
START_STICKY_COMPATIBILITY → Same as START_STICKY, but used
for backward compatibility.
7. how to pass data from activity to service in android
You can pass data from an Activity to a Service using an Intent with
extras.
Example:
From Activity:
Intent intent = new Intent(this, [Link]);
[Link]("message", "Hello Service!");
startService(intent);
In Service (onStartCommand):
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
String msg =
[Link]("message");
Log.d("ServiceData", "Received: " + msg);
return START_STICKY;
}
8. what is pending intent in android
A PendingIntent in Android is a special token that lets another app or
system component perform an action on behalf of your app in the future,
even if your app is not running. In simple words: It’s like giving
permission + intent to someone else, so they can execute it later with
your app’s identity.
9. What is manifest file
The [Link] file is a crucial XML file found at the root of every
Android app project. It serves as a blueprint for the Android operating
system and Google Play, providing essential information about the
application.
Syntex
<manifest ... >
<application ... >
<activity android:name=".MainActivity" ... >
...
</activity>
</application>
</manifest>
10. disadvantages of emulator
Slow performance compared to real devices (especially on low-end PCs).
Hardware features like GPS, camera, fingerprint, sensors may not work
accurately.
Limited real-world testing – can’t fully simulate battery, network
fluctuations, or phone calls.
High system requirements – needs more RAM and CPU power.
Incompatibility issues – some apps may behave differently on emulator
vs real device.
11. is it possible to have activity without UI to perform action
yes, it is possible to have an activity in Android without a user interface
(UI). While activities are typically associated with displaying a UI to the
user, they can also be used to perform background tasks or actions
without any visual components. This is achieved by not setting a layout for
the activity using setContentView().
12. what is the fucntion of android :collapseRows="2”
The attribute android:collapseRows="2" is used in a TableLayout in
Android.
Function:
It collapses (hides) a specific row in the table, so that the row is not
visible to the user. The row index starts from 0
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:collapseColumns="1"
android:collapseRows="2">
<TableRow>
<TextView android:text="Row 0" />
</TableRow>
<TableRow>
<TextView android:text="Row 1" />
</TableRow>
<TableRow>
<TextView android:text="Row 2 (collapsed)" />
</TableRow>
</TableLayout>
13. which property is used to make slide animation
In Android, slide animations are made using the property
android:windowAnimationStyle (for activities) or by applying translate
animations (for views).
In short: To make a slide animation, the translate property (for views) or
android:windowAnimationStyle (for activities) is used.
14. how can we implement a behaviour that has no user interface component
In Android, if you want to implement a behavior that has no user interface
component, you use a Service or a BroadcastReceiver.
• Service → Runs in the background for long-running tasks (e.g., playing
music, downloading files).
• BroadcastReceiver → Responds to system-wide or app-wide events (e.g.,
SMS received, battery low).
15. what is window manager
The WindowManager in Android is a system service that manages the
windows (UI components) on the screen. It is responsible for adding,
removing, and updating views of an app and arranging them on the
device display.
Key Functions of WindowManager:
• Controls the placement and size of views on the screen.
• Handles different types of windows (Activity windows, Dialogs, Toasts,
etc.).
16. what is the function of destroy() callback
The onDestroy() callback in Android is called when an Activity or
Service is about to be destroyed. @Override protected void
onDestroy() { [Link]();
Log.d("Activity", "Activity is being destroyed");
}
2024 past paper
1. what is web service in android
A web service in Android is a way for an app to communicate with a
server over the internet using standard protocols like HTTP.
It allows the app to send requests and receive data (e.g., JSON or XML)
from
remote servers.
Web services are often used for tasks like fetching weather updates, login
authentication, or social media feeds.
2. how to save user preference
In Android, user preferences are usually saved using SharedPreferences,
which stores small key–value pairs.
Example: Save Preference
SharedPreferences prefs = getSharedPreferences("MyPrefs",
MODE_PRIVATE);
[Link] editor = [Link]();
[Link]("username", "John");
[Link](); // saves the data
3. what is difference between android:version code and android:version
name attribute android:versionCode
• It is an integer value that represents the version of the app code.
• It is used internally by the system and Play Store to identify updates.
• Must be incremented with every release.
android:versionName
• It is a string value that represents the version of the app shown to users.
• Example: "1.0", "2.5.1".
• It has no effect on update logic, only for display.
4. what is the use of [Link]
The [Link] file in Android is used to store all the text values (strings) of
an app in one place.
It helps in reusing strings, avoiding hardcoding, and makes it easy to
translate the app into different languages.
Example (res/values/[Link]):
<resources>
<string name="app_name">My Application</string>
<string name="welcome">Welcome to my app!</string>
</resources>
5. what is JSON services
A JSON service in Android refers to a web service that exchanges data in
JSON (JavaScript Object Notation) format between a client (Android app)
and a server.
It is lightweight, easy to read, and widely used for APIs to send/receive
structured data like user details, product lists
Example JSON Response from a Service:
"id": 1,
"name": "John",
"email": "john@[Link]"
6. difference between startactivity() and startActivityForResult()
Startactivity() startActivityForResult()
Used to start a new activity and get a result
Used to start a new activity.
back.
No data is returned to the calling
Returns data via onActivityResult() callback.
activity.
Example: Navigate to another Example: Open gallery to pick an image and
screen. return it.
Example
// Using startActivity()
Intent i = new Intent(this, [Link]);
startActivity(i);
// Using startActivityForResult()
Intent i = new Intent(this, [Link]);
startActivityForResult(i, 1); // requestCode = 1
[Link] is difference fragment and activity
Activity Fragment
A Fragment is a reusable portion of UI that
An Activity is a single, standalone
must be hosted inside an Activity (or another
screen in an Android app.
fragment).
Has its own lifecycle managed by the Has its own lifecycle but is always tied to the
system. hosting Activity’s lifecycle.
Cannot be reused inside another Can be reused in multiple activities for
activity directly. flexible UIs.
Not declared in manifest, added dynamically
Declared in [Link].
or via XML inside an activity.
Example: MainActivity, LoginActivity. Example: LoginFragment, SettingsFragment
[Link] component can you specify in an intent filter
In Android, an intent filter can specify the following components:
1. Action → What the intent wants to do.
2. Category → Additional information about the action.
3. Data → Type of data the component can handle.
<intent-filter>
<action android:name="[Link]" />
<category android:name="[Link]" />
<data android:scheme="http" android:host="[Link]" />
</intent-filter>
7. what is FrameLayout
FrameLayout in Android is a ViewGroup that is designed to display a
single child view within a specific area on the screen. While it can
technically hold multiple child views, its primary purpose and most
effective use case involve managing a single element.
example <FrameLayout
android:layout_width="match_parent”
android:layout_height="match_pare>
<ImageView
android:src="@drawable/background"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
10. what is scrollview in android
In Android development, a ScrollView is a UI element that enables vertical
scrolling of content that extends beyond the visible area of the screen. It is a
ViewGroup that can contain other views or ViewGroups as its child.
11. write a code to detect orientation change
Using onConfigurationChanged() in your Activity
This method avoids restarting the activity on orientation change.
<activity
android:name=".MyActivity"
android:label="@string/app_name"
android:configChanges="orientation|screenSize|keyboardHidden">
</activity>
In your Activity class (e.g., [Link]), override
the onConfigurationChanged() method
12. what is difference between dp unit and px unit ?which one do you use
to specify the dimension of the view
Full Form / Meaning Description
Unit
Actual pixels on the screen.
Fixed, depends on screen
density.
px Pixels
Scales automatically with
screen density, ensures
Densityindependent consistent physical size across
dp Pixels devices.
Which one to use:
• Always use dp to specify dimensions of views (width, height, margin,
padding) because it ensures your UI looks consistent on different screen
sizes and densities.
• Use px only when you need exact pixel-level control (rarely).
2022 past paper
1. discuss the role of android manifest file in android application development
The [Link] file plays a crucial and central role in Android application
development, serving as the declaration file for the entire application to the Android
system, build tools, and Google Play. Without a properly configured manifest file,
an Android application cannot be built, installed, or executed correctly.
2. state purpose of intent filter
The purpose of an intent filter in Android is to declare how a component (like an
Activity, Service, or Broadcast Receiver) can respond to intents from the system or
other apps.
In simpler terms, it tells Android what kinds of actions, data, or categories a
component can handle.
3. what is the requirement of kernel layer in android architecture?
The kernel layer in Android, based on the Linux kernel, is the foundation of the
system. It manages hardware resources like CPU, memory, and devices through
drivers. It handles process scheduling, memory management, and security. It also
provides networking support and low-level services for higher layers. Essentially, it
acts as a bridge between hardware and the Android framework.
4. name the method which is called when menu item has been invoked
The method called when a menu item is selected is:
onOptionsItemSelected(MenuItem item)
This method is triggered whenever the user taps a menu item, and you can override it to
define the action for each item.
5. What is the role of custom adapter in card view?
6. what is the content provider
A Content Provider in Android is a component that manages and shares app data with other
applications in a controlled way. It acts as an interface for accessing structured data, like a
database or file, across different apps.
Key Points:
Data Sharing:
Allows apps to share data with other apps safely using URI (Uniform
Resource Identifier).
Data Types:
Can provide access to SQLite databases, files, or even in-memory data.
CRUD Operations:
Supports Create, Read, Update, Delete operations through methods like
insert(), query(), update(), and delete().
7. what is layout resource?
A layout resource in Android is an XML file that defines the user interface (UI) of an
activity or a component. It specifies the arrangement of UI elements like TextView, Button,
ImageView, etc., on the screen.
Key Points:
Defines UI Structure:
• Determines how views are organized (LinearLayout, RelativeLayout, ConstraintLayout,
etc.).
Stored in res/layout/:
• All layout XML files are kept in the res/layout folder.
Used by Activities or Fragments:
• Loaded in code using setContentView([Link].layout_name) or LayoutInflater
8. What is and ADV and whu do we use it for ?
An AVD (Android Virtual Device) is a virtual device that emulates an Android phone or
tablet on a computer. It allows developers to run, test, and debug apps without needing a
physical device. AVDs can simulate different screen sizes, resolutions, Android versions,
and hardware features.
Example:
An AVD configured as a Samsung Galaxy S22 running Android 13 can be used to test
how an app looks and works on that device.
9. How can we change the background color of activity?
You can change the background color of an activity in Android either via XML
<LinearLayout xmlns:android="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFDD00" <!-- background color -->
android:orientation="vertical">
</LinearLayout>
or using java
LinearLayout layout = findViewById([Link].main_layout);
[Link]([Link]("#FFDD00")); // or use [Link]
10. what is the role of activity manger
The Activity Manager in Android is a system service that manages the lifecycle and state of
all activities in the system. It keeps track of which activity is running, paused, stopped, or
destroyed, and handles task and back stack management to ensure smooth navigation
between activities.
Role:
• Controls activity lifecycle (start, pause, resume, stop, destroy).
• Manages the back stack for navigation.
11. what are the limitation of firebase
Here are some key limitations of Firebase:
1. Limited Free Tier:
o The free plan (Spark) has restrictions on database size, storage, and simultaneous
connections.
2. Pricing Can Be High:
o Costs can increase significantly as your app scales, especially for Realtime
Database or Cloud Firestore usage.
3. No SQL Support:
o Firebase uses NoSQL databases, so complex queries like joins are not supported.
12. difference between static and dynamic receivers
Feature Static Receiver Dynamic Receiver
Declared in Declared in code using
Declaration
[Link] registerReceiver()
Lives as long as the app is Lives only while the app (or
Lifetime
installed component) is running
Receives system-wide Receives broadcasts only
Use Case
broadcasts like boot completed when app is active
2021 Past paper
What is IDE.
IDE stands for Integrated Development Environment.
It is a software application that provides all the tools needed to develop, test, and debug Android
applications in one place.
For Android development, the most commonly used IDE is Android Studio, which is the official
IDE provided by Google
What is ADT?
Android Development Tools (ADT) is a set of plugins that extend the capabilities of the Eclipse
IDE, enabling developers to build, test, debug, and package Android applications efficiently.
ADT (Android Development Tools) was a plugin for Eclipse IDE used to develop Android apps
before Android Studio became the official IDE.
Explain SDK manager.
SDK Manager stands for Software Development Kit Manager.
It is a tool in Android Studio that allows developers to download, install, update, and manage the
different components required for Android app development — such as Android SDK versions,
build tools, platform tools, and emulators.
Location in Android Studio:
You can open it in two ways:
1. Inside Android Studio:
→ Click on Tools → SDK Manager
2. Outside Android Studio:
→ Go to the directory:
C:\Users\<YourName>\AppData\Local\Android\Sdk\tools\bin\sdkmanager
what is package
A package in Android is a collection of related Java or Kotlin classes organized under a unique
name (usually in reverse domain format) that identifies your application within the Android
system and on Google Play
Example of a Package Name:
package [Link];
what is API ??
API stands for Application Programming Interface.
In Android, an API is a set of classes, methods, and tools provided by the Android framework (and
other libraries) that allows developers to communicate with the Android system and use its features
— like camera, GPS, sensors, storage, or the internet — in their apps.
What Is emulator?
An Android emulator is a software tool, also known as an Android Virtual Device (AVD), that
runs on your computer to simulate a physical Android device, allowing developers and users to test
and run Android apps and games on their PC or Mac without a real device.
what is AdMob?
AdMob is a free Google platform for Android app developers to monetize their apps by displaying
ads to users, earning revenue from advertisers. It works by allowing developers to create ad spaces,
then uses an auction system to serve high-performing ads from Google's network and third-party
ad networks, with earnings handled and paid by AdMob.