Android most asked interview questions topic-wise Part 5 of. N

1.What is android?

Ans: Android is a mobile operating system based on a modified version of the Linux kernel and other open-source software, designed primarily for touchscreen mobile devices such as smartphones and tablets.

2.Describe android architecture?

3.Evolution of android versions?

//Will be adding a link here to the post

4.What is AAPT?

Ans: AAPT2 (Android Asset Packaging Tool) is a build tool that Android Studio and Android Gradle Plugin use to compile and package your app’s resources. AAPT2 parses, indexes, and compiles the resources into a binary format that is optimized for the Android platform.

5.What is DDMS?

Ans: (Dalvik Debug Monitor Server) A debugging tool from the Android software development kit (SDK). Able to monitor operations in the emulator as well as real devices, DDMS reports the details of each processing thread and time spent whether in the app or Android OS.

6.How DVM works?

Ans: The DVM is a virtual machine to run Android applications. The DVM executes Dalvik bytecode, which is compiled from programs written in the Java language. Note that the DVM is not a JVM. One of the key design principles of the DVM is that it should run on low-memory mobile devices and loads quicker compared to any JVM.

7.What is ART?

Ans: Android Runtime (ART) is the managed runtime used by applications and some system services on Android. ART and its predecessor Dalvik were originally created specifically for the Android project. ART as the runtime executes the Dalvik Executable format and Dex bytecode specification.

8.Advantage of ART over DVM?

Ans: There are some major performance improvements that ART brings which were lacking in Dalvik. But every pros have some cons too. I will try to discuss both the advantages and disadvantages here.

1) Compilation Approach

This is by far the biggest advantage of ART over Dalvik. The old guy Dalvik used Just-In-Time (JIT) approach in which the compilation was done on demand. All the dex files were converted into their respective native representations only when it was needed.

But ART uses the Ahead-Of-Time (AOT) approach, in which the dex files were compiled before they were demanded. This itself massively improves the performance and battery life of any Android device.

For example

In case of Dalvik, whenever you touch an app icon to open it, the necessary dex files gets converted into their equivalent native codes. The app will only start working when this compilation is done. So, the app is unresponsive until this finishes.

Moreover, this process is repeated every single time you open an app wasting CPU cycles and valuable battery juice.

But in case of ART, whenever you install an app, all the dex files gets converted once and for all. So the installation takes some time and the app takes more space than in Dalvik, but the performance is massively improved and battery life is smartly conserved.

2) Boot Time

In case of Dalvik, the cache is built with time the device runs and apps are used as is indicated by the JIT approach. So the boot time is very fast.

But in case of ART, the cache is built during the first boot, so the boot time is considerably more in case of ART. You might see an “Optimizing apps” dialog box sometimes you boot.

3) Space Usage

The space used by apps being run on ART is much more than that of Dalvik. Like a 20 MB app on Dalvik, takes more than 35 MB on ART.

So if you are on a low storage device, then this can be a huge disadvantage for you.

4) ART is Damn Fast

As discussed above, ART is extremely fast and smooth. Apps are very snappy and responsive. Any comparison between Dalvik and ART, will surely make the ART device win by a significant margin.

ART is the answer to all those who argued that iOS is faster and smoother than Android and is also more battery efficient.

9.What is ADB?

Ans: Android Debug Bridge (ADB) is a versatile command-line tool that lets you communicate with a device. The ADB command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device.

https://developer.android.com/studio/command-line/adb

10.What is ANR?

Ans: Stands for “Application Not Responding.” ANR is an abbreviation that describes an unresponsive Android app. When an app is running on an Android device and stops responding, an “ANR” event is triggered.

11.What is DEX?

Ans: Android programs are compiled into .dex (Dalvik Executable) files, which are in turn zipped into a single .apk file on the device. .dex files can be created by automatically translating compiled applications written in the Java programming language.

12.What is Multi-DEX?

Ans: https://blog.mindorks.com/understanding-multidex-in-android

Intent

1.What is the intent?

Ans: An Intent the object carries information that the Android system uses to determine which component to start (such as the exact component name or component category that should receive the intent), plus information that the recipient component uses in order to properly perform the action

2.Types of intent and uses?

Ans: There are 2 types of intent

  1. Explicit Intent: An explicit intent is one that you use to launch a specific app component, such as a particular activity or service in your app. To create an explicit intent, define the component name for the Intent object—all other intent properties are optional.
  2. Implicit Intent: An implicit intent specifies an action that can invoke any app on the device able to perform the action. Using an implicit intent is useful when your app cannot perform the action, but other apps probably can and you’d like the user to pick which app to use.

3.What is the intent filter and uses?

Ans: An intent filter is an expression in an app’s manifest file that specifies the type of intents that the component would like to receive. For instance, by declaring an intent filter for an activity, you make it possible for other apps to directly start your activity with a certain kind of intent.

4.What is sticky intent?

Ans: Sticks with Android, for future broadcast listeners. For example, if BATTERY_LOW event occurs then that Intent will stick with Android so that any future requests for BATTERY_LOW, will return the Intent.

5.What is pending intent?

Ans: Pending Intent is actually an object which wraps an Intent to do some future work by another app.

It lets us pass a future Intent to another application and allows that application to execute that Intent as if it had the same permissions as our application, whether or not our application is still around when the Intent is eventually invoked.

A PendingIntent is generally used in cases were an AlarmManager needs to be executed or for Notifications. A PendingIntent provides a mean for applications to work, even after their process exits.

PendingIntent uses the following methods to handle the different types of intents:

PendingIntent.getActivity() : Retrieve a PendingIntent to start an Activity
PendingIntent.getBroadcast() : Retrieve a PendingIntent to perform a Broadcast
PendingIntent.getService() : Retrieve a PendingIntent to start a Service

6.What is the chooser? where it is used?

Ans: The chooser dialog forces the user to select which app to use for the action every time (the user cannot select a default app for the action).

Application Class

1.What is the application class?

Ans: The Application class in Android is the base class within an Android app that contains all other components such as activities and services. The Application class, or any subclass of the Application class, is instantiated before any other class when the process for your application/package is created.

2.Significance of having application class?

Ans: In application class we can initialise components which are used globally

3.When the application class onCreate() method gets called?

Ans: It gets call whenever application package is created and anything notifies the app.

3.What all things we should define or declare in application class?

Ans: The componets or third party libs which needs commonly in your application.

4.Use of onLowMemory() method of application class?

Ans: This is called when the overall system is running low on memory, and actively running processes should trim their memory usage. While the exact point at which this will be called is not defined, generally it will happen when all background process have been killed. That is, before reaching the point of killing processes hosting service and foreground UI that we would like to avoid killing.
You should implement this method to release any caches or other unnecessary resources you may be holding on to. The system will perform a garbage collection for you after returning from this method.

Manifest.xml

  1. What is the manifest file in the android project?
  2. What is the use of a manifest file?
  3. What do all things need to define in the manifest file?
  4. What is R.java stand for?

Gradle

  1. What is Gradle?
  2. what all things need to define in build.Gradle file?
  3. What is the build flavor?
  4. What is the build type?
  5. What is Gradle wrapper?
  6. What is multidex?
  7. Progaurd related questions?

Context

  1. What is the context?
  2. What is the use of context?
  3. What is a context wrapper?
  4. How to efficiently use context?
  5. Memory leak due to misuse of context?
  6. Application context vs Activity context?

Adapter

  1. What is an Adapter?
  2. Why we need an adapter?
  3. What is the layout inflater?
  4. What is a Cursor adapter?
  5. What are different types of the adapter and in which circumstances we should use each of them?
  6. What is the base adapter?
  7. What is the recycler view adapter?

ListView/RecyclerView

  1. what is the list view or recycler view?
  2. What the difference between both of them?
  3. Methods of RV and LV?
  4. What are the method sequences to get called?
  5. Mandatory methods to implement in your subclass of adapter?
  6. How onItem click works on both of them?
  7. What is an item decorator in RV?
  8. What is the view holder?
  9. Multiple view type in Single recycler view?
  10. Multiple adapters in a single RV?
  11. How Memory efficient RV?
  12. Use of layoutmangar in RV?

Shared Preference

  1. What is the shared preference?
  2. How data is stored in a shared preference?
  3. Can an app have multiple shared pref files?
  4. In which format data is stored in shared preference?
  5. What is the editor in shared pref?
  6. What are the modes of shared pref?
  7. Path of the shared pref file in a device where it is stored?
  8. Methods of shared prefs?
  9. Differences between commit and apply?
  10. What all the types of data we can store in shared pref?
  11. When the data will be deleted from the shared pref?

ViewPager

  1. What is a viewpager?
  2. Difference between fragmentPaggerAdapter and fragmentStatePaggerAdapter?

Multi-Threding

  1. What is a thread?
  2. What is the process?
  3. What is a handler?
  4. What is looper?
  5. What is the message queue?
  6. In which thread handler works?
  7. How to update UI from background thread?
  8. Which exception will come while updating UI from the background?
  9. What is looper.getMainLooper()?
  10. Methods of handler?
  11. Difference between post and send?
  12. What is a thread pool?

Android Upgrade

  1. What are the changes introduced in Lolipop?
  2. New features in Marshmellow?
  3. New features in Nougat?
  4. New features in Oreo?
  5. New features in Pie?
  6. New features in 10.

AsyncTask

  1. What is the async task?
  2. How does it work?
  3. What all methods of the async task?
  4. Can you start the async task again?
  5. What happens to the async task when you change the orientation?
  6. How to prevent async task data on change orientation changes?
  7. Relationship between async task and activity?
  8. How to Update UI from doInBackground() method

--

--

--

Senior Android App Developer | Startup | Product base | Java | Kotlin | MVVM | Architecture components | Android Blogger

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Strategy Design Pattern | Android real-life example

LeetCode 206- Reverse Linked List

Create Your Own CameraApp Using CameraX

Android Advance Topic’s Interview Questions

Keep your gradle dependencies up to date seamlessly :)

Creating Custom Calendar with Android Studio

Itask — Reminder application integrating HMS Push Kit and App-Messaging Kit (Part 2)

Android “Services” Frequently Asked Interview Questions

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aalishan Ansari

Aalishan Ansari

Senior Android App Developer | Startup | Product base | Java | Kotlin | MVVM | Architecture components | Android Blogger

More from Medium

Why Jetpack Compose for Android Development?

Android 13: Notification Runtime Permission

Improving Android App Architecture with Data Layer

Android Edge to Edge 101