Android Interview Questions For Freshers

Question 1. What is Android?

Answer: Android is a stack of software for mobile devices which contains an Operating System, middle ware and some key applications. The application accomplish its own process and instance of Dalvik Virtual Machine (DVM). Many Virtual Machines run proficiently by a DVM tool. DVM executes Java languages byte code which converts into .dex format files later.

Question 2. Describe the APK format.

Answer: The (Android Packaging Key) APK file is a compressed set up of the Android Manifest.xml file, application code (.dex files), reserve files, and other files. A project is assembled into a single .apk file.

Question 3. What is meant by an activity?

Answer: An activity is a single, focused thing that the user can do. Almost all activities interact with the user, so the Activity class takes care of creating a window for you in which you can place your UI . In terms of desktop advancement, an Activity is equal to a Form.

Question 4. What are the distinctive stages of an Activity life cycle?

Answer: As an activity conversions from state to state, it is reported of the change by calls to the following impenetrable methods:

  1. void on Create(Bundle saved Instance State)
  2. void on Start()
  3. void on Resume()
  4. void on Pause()
  5. void on Stop()
  6. void on Restart()
  7. void on Destroy()

Taken together, these seven processes define the complete life-cycle of an activity. Protected void on Create(Bundle saved Instance State): activity_lifecycle This process is called when this activity is primarily created. It specify a place to create views, bind data to lists, and operate other operations whose conclusions must exist until

onDestroy() is called. Also, this process is called with an android.os.Bundle instance that consists this activity’s previously saved position if this position was saved. Otherwise, null is carried. Finally,

onCreate() is always obeyed by onStart().

protected void onStart(): This process is called when this activity is seemly visible to the user. Also, on Start() is obeyed by on Resume() if this function is coming to the forefront, or onStop() if this activity is keeping hidden .

protected void onResume(): This process is called when this action can start to intermingle with the user — this action is now at the top of the activity stack and accept focus. Also, onResume() is continually followed by onPause().

protected void onPause(): This method is termed when the OS is about to resume a earlier activity. The onPause() method is predictably used to commit unsaved changes to permanent storage, and stop graphics and other time-consuming processor undertakings. This process should run quickly because the succeeding activity cannot be resumed until onPause() revert. Finally, onPause() is obeyed by onResume() if this activity is revisiting to the foreground, or onStop() if this activity is keeping hidden.

protected void onRestart(): This process is called after this activity has been stopped and preceding to it being restarted. Also, onRestart() is always obeyed by onStart().

protected void onDestroy(): This process is called when this action is being closed. After this process returns, the process hosting this activity is destroyed by the OS.

Question 5. What is an Android Manifest file?

Answer: Every application must have an AndroidManifest.xml file in its root directory. It describes the components of the application — the activities, services, broadcast receivers, and content providers that the application is composed of. It names the classes that implement each of the components and publishes their capabilities.

  • It declares which permissions the application must have in order to access protected parts of the API and interact with other applications.
  • It declares the minimum level of the Android API that the application requires.
  • It lists the libraries that the application must be linked against.

Question 6. What are Intent filters ?

Answer: Activities and intent receivers include one or more filters in their manifest to describe what kinds of intents or messages they can handle or want to receive.

An intent filter lists a set of requirements, such as data type, action requested, and URI format, that the Intent or message must fulfill.

For Activities, Android searches for the Activity with the most closely matching valid match between the Intent and the activity filter. For messages, Android will forward a message to all receivers with matching intent filters.

Question 7. What language does Android support for application development ?

Answer: Android applications are written using the Java programming language.

Question 8. What’s the difference between a file, a class and an activity in android?

Answer:

File – It is a block of arbitrary information, or resource for storing information. It can be of any type.

Class – Its a compiled form of .Java file . Android finally used this .class files to produce an executable APK.

Activity – An activity is the equivalent of a Frame/Window in GUI tool-kits  It is not a file or a file type it is just a class that can be extended in Android for loading UI elements on view.

Question 9. What is the significance of the .dex files?

Answer: 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.

Question 10. What does ADT stand for?

Answer: ADT stands for ANDROID DEVELOPMENT TOOLS . The Android SDK includes several tools and utilities to help you create, test, and debug your projects.

Question 11. What are the different tools in Android? Explain them?

Answer:

The Android SDK and Virtual Device Manager: It is used to create and manage Android Virtual Devices (AVD) and SDK packages. The AVD hosts an emulator running a particular build of Android, letting you specify the supported SDK version, screen resolution, amount of SD card storage available, and available hardware capabilities (such as touchscreens and GPS).

The Android Emulator: An implementation of the Android virtual machine designed to run within a virtual device on your development computer. Use the emulator to test and debug your Android applications.

Dalvik Debug Monitoring Service (DDMS) : Use the DDMS perspective to monitor and control the Dalvik virtual machines on which you’re debugging your applications.

Android Asset Packaging Tool (AAPT) : Constructs the distributable Android package files (.apk).

Android Debug Bridge,(adb) : Android Debug Bridge, is a command-line debugging application shipped with the SDK. It provides tools to browse the device, copy tools on the device, and forward ports for debugging.

Question 12. What is Dalvik Virtual Machine?

Answer: The name of Android’s virtual machine. The Dalvik VM is an interpreter-only virtual machine that executes files in the Dalvik Executable (.dex) format, a format that is optimized for efficient storage and memory-mappable execution. The virtual machine is register-based, and it can run classes compiled by a Java language compiler that have been transformed into its native format using the included “dx” tool. The VM runs on top of Posix-compliant operating systems, which it relies on for underlying functionality (such as threading and low level memory management). The Dalvik core class library is intended to provide a familiar development base for those used to programming with Java Standard Edition, but it is geared specifically to the needs of a small mobile device.

Question 13. What is Android Runtime?

Answer: Android includes a set of core libraries that provides most of the functionality available in the core libraries of the Java programming language. Every Android application runs in its own process, with its own instance of the Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs efficiently. The Dalvik VM executes files in the Dalvik Executable (.dex) format which is optimized for minimal memory footprint. The VM is register-based, and runs classes compiled by a Java language compiler that have been transformed into the .dex format by the included “dx” tool.

Question 14. What is the Open Handset Alliance?

Answer: The OHA is a consortium of 84 technology and mobile companies that have joined hands to accelerate innovation in mobile technology and at the same time offer the end users a better, cost-effective and richer mobile experience. Members of this include Google, HTC, Sony, Dell, Intel, Motorola, Qualcomm, Texas Instruments, Samsung, LG, T-Mobile, Nvidia. The OHA was started on 5 November 2007 by Google and 34 other companies. Android is the main software of the alliance.

Question 15. What is ViewGroup?

Answer: A ViewGroup is a special view that can contain other views (called children.) The view group is the base class for layouts and views containers. This class also defines the class ViewGroup.LayoutParams which serves as the base class for layouts parameters.

Question 16. What is a Service?

Answer: A Service is an application component representing either an application’s desire to perform a longer-running operation while not interacting with the user or to supply functionality for other applications to use. Services run without a dedicated GUI, but, like Activities and Broadcast Receivers, they still execute in the main thread of the application’s process. A Service could be, facility for an application to expose some of its functionality to other applications.

Question 17. What is the difference between Service and Thread?

Answer: Service is like an Activity but has no interface. Probably if you want to fetch the weather for example you won’t create a blank activity for it, for this you will use a Service. It is also known as Background Service because it performs tasks in background. A Thread is a concurrent unit of execution. You need to know that you cannot update UI from a Thread. You need to use a Handler for this.

Question 18. What is an Intent?

Answer: An intent is an abstract description of an operation to be performed. Intent provides a facility for performing late runtime binding between the code in different applications. Its most significant use is in the launching of activities, where it can be thought of as the glue between activities Also, Intent is basically a message that is passed between components (such as Activities, Services, Broadcast Receivers, and Content Providers). So, it is almost equivalent to parameters passed to API calls. The fundamental differences between API calls and intents’ way of invoking components are: API calls are synchronous while intent-based invocations are asynchronous. API calls are compile time binding while intent-based calls are run-time binding.

Question 19. What is an Explicit Intent?

Answer: In an explicit intent, we actually specify the activity that is required to respond to the intent. In other words, we explicitly designate the target component. This is typically used for application internal messages.

Question 20. What is an Implicit Intent?

Answer: In an implicit intent, the main power of the android design, we just declare an intent and leave it to the platform to find an activity that can respond to the intent. Here, we do not declare the target component and hence is typically used for activating components of other applications seamlessly

Question 21. What is a Content Provider?

Answer: Content Providers are the only way to share data across Android applications. They store and retrieve data thus making it accessible to all. Content Providers give a uniform interface to access the data. Android platform provides default implementations of content providers for data types like audio, video, images, contact information etc.

Question 22. What is a Toast Notification?

Answer: A toast notification is a message that pops up on the surface of the window. It only fills the amount of space required for the message and the user’s current activity remains visible and interactive. The notification automatically fades in and out, and does not accept interaction events.

 

This entry was posted in Uncategorized by admin. Bookmark the permalink.

Leave a Reply