Friday 15 November 2013

Android Interview questions and answers -Part 1

1.What is android?
A. Android is a stack of software for mobile devices which has Operating System, middleware and some key applications. The application executes within its own process and its own instance of Dalvik Virtual Machine. Many Virtual Machines run efficiently by a DVM device. DVM executes Java language?s byte code which later transforms into .dex format files.

2.What are the advantages of Android?
A. The following are the advantages of Android:

* The customer will be benefited from wide range of mobile applications to choose, since the monopoly of wireless carriers like AT&T and Orange will be broken by Google Android.
* Features like weather details, live RSS feeds, opening screen, icon on the opening screen can be customized
* Innovative products like the location-aware services, location of a nearby convenience store etc., are some of the additive facilities in Android.
Components can be reused and replaced by the application framework.
*Optimized DVM for mobile devices
*SQLite enables to store the data in a structured manner.
*Supports GSM telephone and Bluetooth, WiFi, 3G and EDGE technologies
*The development is a combination of a device emulator, debugging tools, memory profiling and plug-in for Eclipse IDE.

3.Explain about the exceptions of Android?
A. The following are the exceptions that are supported by Android
* InflateException : When an error conditions are occurred, this exception is thrown
* Surface.OutOfResourceException: When a surface is not created or resized, this exception is thrown
* SurfaceHolder.BadSurfaceTypeException: This exception is thrown from the lockCanvas() method, when invoked on a Surface whose is SURFACE_TYPE_PUSH_BUFFERS
* WindowManager.BadTokenException: This exception is thrown at the time of trying to add view an invalid WindowManager.LayoutParamstoken.

4.Describe the APK format.
A. The APK file is compressed the AndroidManifest.xml file, application code (.dex files), resource files, and other files. A project is compiled into a single .apk file.

5.What is .apk extension?
A. The extension for an Android package file, which typically contains all of the files related to a single Android application. The file itself is a compressed collection of an AndroidManifest.xml file, application code (.dex files), resource files, and other files. A project is compiled into a single .apk file.

 6.What is .dex extension?
A. 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

7.What is an adb ?
A. Android Debug Bridge, 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.

8.What is an Application ?
A.A collection of one or more activities, services,
listeners, and intent receivers. An application has a
 single manifest, and is compiled into a single .apk file on the device.

9.What is a Content Provider ?
A. A class built on ContentProvider that handles
 content query strings of a specific format to return data
in a specific format. See Reading and writing data to a content
 provider for information on using content providers.

10.What is a Dalvik ?
A. 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.

11.What is an DDMS?
A. Dalvik Debug Monitor Service, a GUI debugging application
 shipped with the SDK. It provides screen capture, log dump, and process
 examination capabilities.

12.What is Drawable?
A. A compiled visual resource that can be used as a background, title, or other part of the screen. It is compiled into an android.graphics.drawable subclass.

13.What is an Intent?
A. A class (Intent) that contains several fields describing what a caller would like to do. The caller sends this intent to Android’s intent resolver, which looks through the intent filters of all applications to find the activity most suited to handle this intent. Intent fields include the desired action, a category, a data string, the MIME type of the data, a handling class, and other restrictions.

14.What is an Intent Filter ?
A. 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.

15.What is an Intent Receiver?
A. An application class that listens for messages broadcast by calling Context.broadcastIntent

16.What is a Layout resource?
A. An XML file that describes the layout of an Activity screen.

17.What is a Manifest ?
A. An XML file associated with each Application that describes the various activies, intent filters, services, and other items that it exposes.

18.What is a Resource ?
A. A user-supplied XML, bitmap, or other file, entered into an application build process, which can later be loaded from code. Android can accept resources of many types; see Resources for a full description. Application-defined resources should be stored in the res/ subfolders. 

19.What is a Service ?
A. A class that runs in the background to perform various persistent
 actions, such as playing music or monitoring network activity.

20.What is a Theme ?
A. A set of properties (text size, background color, and so on) bundled together to define various default display settings. Android provides a few standard themes, listed in R.style (starting with “Theme_”).

21.What is an URIs?
A. Android uses URI strings both for requesting data (e.g., a list of contacts) and for requesting actions (e.g., opening a Web page in a browser). Both are valid URI strings, but have different values. All requests for data must start with the string “content://”. Action strings are valid URIs that can be handled appropriately by applications on the device; for example, a URI starting with “http://” will be handled by the browser.

22.Can I write code for Android using C/C++?
A.Yes, but need to use NDK
Android applications are written using the Java programming language. 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.

23.What is an action?
A. A description of something that an Intent sender desires.

24.What is activity?
A. A single screen in an application, with supporting Java code.

25.How is nine-patch image different from a regular bitmap?
A. It is a resizable bitmap resource that can be used for backgrounds or other images on the device. The NinePatch class permits drawing a bitmap in nine sections. The four corners are unscaled; the four edges are scaled in one axis, and the middle is scaled in both axes.

26.What languages does Android support for application development?
A .Android applications are written using the Java programming language.

27.What is a resource?
A. A user-supplied XML, bitmap, or other file, injected into the application build process, which can later be loaded from code. 

28.How will you record a phone call in Android? How to get a handle on Audio Stream for a call in Android?
A. Permissions.PROCESS_OUTGOING_CALLS: Allows an application to monitor, modify, or abort outgoing calls.

29.What’s the difference between file, class and activity in android?
A. 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 toolkits. 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.

30.What is a Sticky Intent?
A. sendStickyBroadcast() performs a sendBroadcast (Intent) that is “sticky,” i.e. the Intent you are sending stays around after the broadcast is complete, so that others can quickly retrieve that data through the return value of registerReceiver (BroadcastReceiver, IntentFilter). In all other ways, this behaves the same as sendBroadcast(Intent).
             One example of a sticky broadcast sent via the operating system is ACTION_BATTERY_CHANGED. When you call registerReceiver() for that action — even with a null BroadcastReceiver — you get the Intent that was last broadcast for that action. Hence, you can use this to find the state of the battery without necessarily registering for all future state changes in the battery.

31.Does Android support the Bluetooth serial port profile?
A.Yes.

32.Can an application be started on powerup?
A.Yes.

33.How to Remove Desktop icons and Widgets ?
A. Press and Hold the icon or widget. The phone will vibrate and on
 the bottom of the phone you will see anoption to remove. While still
 holding the icon or widget drag it to the remove button. Once remove
turns red drop the item and it is gone

34.Describe a real time scenario where android can be used?
A. Imagine a situation that you are in a country where no one understands the language you speak and you can not read or write. However, you have mobile phone with you.
       With a mobile phone with android, the Google translator translates the data of one language into another language by using XMPP to transmit data. You can type the message in English and select the language which is understood by the citizens of the country in order to reach the message to the citizens.



35.How to Remove Desktop icons and Widgets?
A.  Press and Hold the icon or widget. The phone will vibrate and on the bottom of the phone you will see anoption to remove. While still holding the icon or widget drag it to the remove button. Once remove turns red drop the item and it is gone

36.Describe a real time scenario where android can be used?
A. Imagine a situation that you are in a country where no one understands
 the language you speak and you can not read or write. However, you have
 mobile phone with you.

37.How to select more than one option from list in android xml file?
A.Give an example.
Specify android id, layout height and width as depicted in the following example.

38.What languages does Android support for application development?
A. Android applications are written using the Java programming language.

39.Describe Android Application Architectur ?
A. Android Application Architecture has the following components:

• Services – like N

• Intent – To perform inter-communetwork Operation

ication between activities or services

• Resource Externalization – such as strings and graphics

• Notification signaling users – light, sound, icon, notification, dialog etc

40.What is the Android Open Source Project?
A. We use the phrase “Android Open Source Project” or “AOSP” to refer to the people, the processes, and the source code that make up Android.

41.Why did we open the Android source code?
A. Google started the Android project in response to our own experiences launching mobile apps. We wanted to make sure that there would always be an open platform available for carriers, OEMs, and developers to use to make their innovative ideas a reality. We also wanted to make sure that there was no central point of failure, so that no single industry player could restrict or control the innovations of any other. The single most important goal of the Android Open-Source Project (AOSP) is to make sure that the open-source Android software is implemented as widely and compatibly as possible, to everyone’s benefit.

42.What kind of open-source project is Android?
A. Google oversees the development of the core Android open-source platform, and works to create robust developer and user communities. For the most part the Android source code is licensed under the permissive Apache Software License 2.0, rather than a “copyleft” license. The main reason for this is because our most important goal is widespread adoption of the software, and we believe that the ASL2.0 license best achieves that goal.

43.Why is Google in charge of Android?
A. Launching a software platform is complex. Openness is vital to the long-term success of a platform, since openness is required to attract investment from developers and ensure a level playing field. However, the platform itself must also be a compelling product to end users.

That’s why Google has committed the professional engineering resources necessary to ensure that Android is a fully competitive software platform. Google treats the Android project as a full-scale product development operation, and strikes the business deals necessary to make sure that great devices running Android actually make it to market.

By making sure that Android is a success with end users, we help ensure the vitality of Android as a platform, and as an open-source project. After all, who wants the source code to an unsuccessful product?

Google’s goal is to ensure a successful ecosystem around Android, but no one is required to participate, of course. We opened the Android source code so anyone can modify and distribute the software to meet their own needs.

44.What is Google’s overall strategy for Android product development?
A.We focus on releasing great devices into a competitive marketplace, and then incorporate the innovations and enhancements we made into the core platform, as the next version.

In practice, this means that the Android engineering team typically focuses on a small number of “flagship” devices, and develops the next version of the Android software to support those product launches. These flagship devices absorb much of the product risk and blaze a trail for the broad OEM community, who follow up with many more devices that take advantage of the new features. In this way, we make sure that the Android platform evolves according to the actual needs of real-world devices.

45.How is the Android software developed?
A. Each platform version of Android (such as 1.5, 1.6, and so on) has a corresponding branch in the open-source tree. At any given moment, the most recent such branch will be considered the “current stable” branch version. This current stable branch is the one that manufacturers port to their devices. This branch is kept suitable for release at all times.

Simultaneously, there is also a “current experimental” branch, which is where speculative contributions, such as large next-generation features, are developed. Bug fixes and other contributions can be included in the current stable branch from the experimental branch as appropriate.

Finally, Google works on the next version of the Android platform in tandem with developing a flagship device. This branch pulls in changes from the experimental and stable branches as appropriate.

46.Why are parts of Android developed in private?
A.It typically takes over a year to bring a device to market, but of course device manufacturers want to ship the latest software they can. Developers, meanwhile, don’t want to have to constantly track new versions of the platform when writing apps. Both groups experience a tension between shipping products, and not wanting to fall behind.

To address this, some parts of the next version of Android including the core platform APIs are developed in a private branch. These APIs constitute the next version of Android. Our aim is to focus attention on the current stable version of the Android source code, while we create the next version of the platform as driven by flagship Android devices. This allows developers and OEMs to focus on a single version without having to track unfinished future work just to keep up. Other parts of the Android system that aren’t related to application compatibility are developed in the open, however. It’s our intention to move more of these parts to open development over time.

47.When are source code releases made?
A.When they are ready. Some parts of Android are developed in the open, so that source code is always available. Other parts are developed first in a private tree, and that source code is released when the next platform version is ready.

In some releases, core platform APIs will be ready far enough in advance that we can push the source code out for an early look in advance of the device’s release; however in others, this isn’t possible. In all cases, we release the platform source when we feel the version has stabilized enough, and when the development process permits. Releasing the source code is a fairly complex process.

48.What is involved in releasing the source code for a new Android version?
A.Releasing the source code for a new version of the Android platform is a significant process. First, the software gets built into a system image for a device, and put through various forms of certification, including government regulatory certification for the regions the phones will be deployed. It also goes through operator testing. This is an important phase of the process, since it helps shake out a lot of software bugs.

 Once the release is approved by the regulators and operators, the manufacturer begins mass producing devices, and we turn to releasing the source code.

Simultaneous to mass production the Google team kicks off several efforts to prepare the open source release. These efforts include final API changes and documentation (to reflect any changes that were made during qualification testing, for example), preparing an SDK for the new version, and launching the platform compatibility information.

Also included is a final legal sign-off to release the code into open source. Just as open source contributors are required to sign a Contributors License Agreement attesting to their IP ownership of their contribution, Google too must verify that it is clear to make contributions.

Starting at the time mass production begins, the software release process usually takes around a month, which often roughly places source code releases around the same time that the devices reach users.


No comments:

Post a Comment