Friday 27 February 2015

Android Interview Questions

PREVIOUS

ANDROID INTERVIEW QUESTIONS 
Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google. With a user interface based on direct manipulation, Android is designed primarily for touchscreen mobile devices such as smartphones and tablet computers, with specialized user interfaces for televisions (Android TV), cars (Android Auto), and wrist watches (Android Wear). 
The OS uses touch inputs that loosely correspond to real-world actions, like swiping, tapping, pinching, and reverse pinching to manipulate on-screen objects, and a virtual keyboard. Despite being primarily designed for touchscreen input, it also has been used in game consoles, digital cameras, regular PCs (e.g. the HP Slate 21) and other electronics.

Top 50 Android Interview Questions And Answers

List of Most frequently Asked Android Interview Questions and Answers for freshers and experienced are below:

1) What is Android?
It is an open-sourced operating system that is used primarily on mobile devices, such as cell phones and tablets. It is a Linux kernel-based system that’s been equipped with rich components that allows developers to create and run apps that can perform both basic and advanced functions.


2) What Is the Google Android SDK?
The Google Android SDK is a toolset that developers need in order to write apps on Android enabled devices. It contains a graphical interface that emulates an Android driven handheld environment, allowing them to test and debug their codes.

3) What is the Android Architecture?
Android Architecture is made up of 4 key components:
- Linux Kernel
- Libraries
- Android Framework
- Android Applications

4) Describe the Android Framework.
The Android Framework is an important aspect of the Android Architecture. Here you can find all the classes and methods that developers would need in order to write applications on the Android environment.

5) What is AAPT?
AAPT is short for Android Asset Packaging Tool. This tool provides developers with the ability to deal with zip-compatible archives, which includes creating, extracting as well as viewing its contents.




6) What is the importance of having an emulator within the Android environment?
The emulator lets developers “play” around an interface that acts as if it were an actual mobile device. They can write and test codes, and even debug. Emulators are a safe place for testing codes especially if it is in the early design phase.

7) What is the use of an activityCreator?
An activityCreator is the first step towards the creation of a new Android project. It is made up of a shell script that will be used to create new file system structure necessary for writing codes within the Android IDE.

8 ) Describe Activities.
Activities are what you refer to as the window to a user interface. Just as you create windows in order to display output or to ask for an input in the form of dialog boxes, activities play the same role, though it may not always be in the form of a user interface.

9) What are Intents?
Intents are asynchronous messages which allow application components to request functionality from other Android components. Intents allow you to interact with components from the same applications as well as with components contributed by other applications.
For example, an activity can start an external activity for taking a picture.

10) Differentiate Activities from Services.
Activities can be closed, or terminated anytime the user wishes. On the other hand, services are designed to run behind the scenes, and can act independently. Most services run continuously, regardless of whether there are certain or no activities being executed.



11) What items are important in every Android project?
These are the essential items that are present each time an Android project is created:
- AndroidManifest.xml
- build.xml
- bin/
- src/
- res/
- assets/

12) What is the importance of XML-based layouts?

The use of XML-based layouts provides a consistent and somewhat standard means of setting GUI definition format. In common practice, layout details are placed in XML files while other items are placed in source files.

13) What are containers?

Containers, as the name itself implies, holds objects and widgets together, depending on which specific items are needed and in what particular arrangement that is wanted. Containers may hold labels, fields, buttons, or even child containers, as examples.

14) What is Orientation?

Orientation, which can be set using setOrientation(), dictates if the LinearLayout is represented as a row or as a column. Values are set as either HORIZONTAL or VERTICAL.

15) What is the importance of Android in the mobile market?

Developers can write and register apps that will specifically run under the Android environment. This means that every mobile device that is Android enabled will be able to support and run these apps. With the growing popularity of Android mobile devices, developers can take advantage of this trend by creating and uploading their apps on the Android Market for distribution to anyone who wants to download it.

 

16) What do you think are some disadvantages of Android?
Given that Android is an open-source platform, and the fact that different Android operating systems have been released on different mobile devices, there’s no clear cut policy to how applications can adapt with various OS versions and upgrades. 
-->  One app that runs on this particular version of Android OS may or may not run on another version. 
-->  Another disadvantage is that since mobile devices such as phones and tabs come in different sizes and forms, it poses a challenge for developers to create apps that can adjust correctly to the right screen size and other varying features and specs.

17) What is adb?

Adb is short for Android Debug Bridge. It allows developers the power to execute remote shell commands. Its basic function is to allow and control communication towards and from the emulator port.

18) What are the four essential states of an activity?

- Active – if the activity is at the foreground
- Paused – if the activity is at the background and still visible
- Stopped – if the activity is not visible and therefore is hidden or obscured by another activity
- Destroyed – when the activity process is killed or completed terminated

19) What is ANR?

ANR is short for Application Not Responding. This is actually a dialog that appears to the user whenever an application have been unresponsive for a long period of time.

20) Which elements can occur only once and must be present?

Among the different elements, the and elements must be present and can occur only once. The rest are optional, and can occur as many times as needed.

 

21) How are escape characters used as attribute?
Escape characters are preceded by double backslashes. For example, a newline character is created using ‘\\n’

22) What is the importance of settings permissions in app development?

Permissions allow certain restrictions to be imposed primarily to protect data and code. Without these, codes could be compromised, resulting to defects in functionality.

23) What is the function of an intent filter?

Because every component needs to indicate which intents they can respond to, intent filters are used to filter out intents that these components are willing to receive. One or more intent filters are possible, depending on the services and activities that is going to make use of it.

24) Enumerate the three key loops when monitoring an activity?

- Entire lifetime – activity happens between onCreate and onDestroy
- Visible lifetime – activity happens between onStart and onStop
- Foreground lifetime – activity happens between onResume and onPause

25) When is the onStop() method invoked?

A call to onStop method happens when an activity is no longer visible to the user, either because another activity has taken over or if in front of that activity.



26) Is there a case wherein other qualifiers in multiple resources take precedence over locale?
Yes, there are actually instances wherein some qualifiers can take precedence over locale. There are two known exceptions, which are the MCC (mobile country code) and MNC (mobile network code) qualifiers.

27) What are the different states wherein a process is based?
There are 4 possible states:
- foreground activity
- visible activity
- background activity
- empty process

28) How can the ANR be prevented?
One technique that prevents the Android system from concluding a code that has been responsive for a long period of time is to create a child thread. Within the child thread, most of the actual workings of the codes can be placed, so that the main thread runs with minimal periods of unresponsive times.

29) What role does Dalvik play in Android development?
Dalvik serves as a virtual machine, and it is where every Android application runs. Through Dalvik, a device is able to execute multiple virtual machines efficiently through better memory management.

30) What is the AndroidManifest.xml?
This file is essential in every application. It is declared in the root directory and contains information about the application that the Android system must know before the codes can be executed.



31) What is the proper way of setting up an Android-powered device for app development?
The following are steps to be followed prior to actual application development in an Android-powered device:

-Declare your application as “debuggable” in your Android Manifest.
-Turn on “USB Debugging” on your device.
-Set up your system to detect your device.

32) Enumerate the steps in creating a bounded service through AIDL.
1. create the .aidl file, which defines the programming interface
2. implement the interface, which involves extending the inner abstract Stub class as well as implanting its methods.
3. expose the interface, which involves implementing the service to the clients.

33) What is the importance of Default Resources?
When default resources, which contain default strings and files, are not present, an error will occur and the app will not run. Resources are placed in specially named subdirectories under the project res/ directory.

34) When dealing with multiple resources, which one takes precedence?
Assuming that all of these multiple resources are able to match the configuration of a device, the ‘locale’ qualifier almost always takes the highest precedence over the others.

35) When does ANR occur?
The ANR dialog is displayed to the user based on two possible conditions. One is when there is no response to an input event within 5 seconds, and the other is when a broadcast receiver is not done executing within 10 seconds.



36) What is AIDL?
AIDL, or Android Interface Definition Language, handles the interface requirements between a client and a service so both can communicate at the same level through interprocess communication or IPC. This process involves breaking down objects into primitives that Android can understand. This part is required simply because a process cannot access the memory of the other process.

37) What data types are supported by AIDL?
AIDL has support for the following data types:
-string
-charSequence
-List
-Map
-all native Java data types like int,long, char and Boolean

38) What is a Fragment?
A fragment is a part or portion of an activity. It is modular in a sense that you can move around or combine with other fragments in a single activity. Fragments are also reusable.

39) What is a visible activity?
A visible activity is one that sits behind a foreground dialog. It is actually visible to the user, but not necessarily being in the foreground itself.

40) When is the best time to kill a foreground activity?
The foreground activity, being the most important among the other states, is only killed or terminated as a last resort, especially if it is already consuming too much memory. When a memory paging state has been reach by a foreground activity, then it is killed so that the user interface can retain its responsiveness to the user.



41) Is it possible to use or add a fragment without using a user interface?
Yes, it is possible to do that, such as when you want to create a background behavior for a particular activity. You can do this by using add(Fragment,string) method to add a fragment from the activity.

42) How do you remove icons and widgets from the main screen of the Android device?
To remove an icon or shortcut, press and hold that icon. You then drag it downwards to the lower part of the screen where a remove button appears.

43) What are the core components under the Android application architecture?
There are 5 key components under the Android application architecture:
- services
- intent
- resource externalization
- notifications
- content providers

44) What composes a typical Android application project?
A project under Android development, upon compilation, becomes an .apk file. This apk file format is actually made up of the AndroidManifest.xml file, application code, resource files, and other related files.

45) What is a Sticky Intent?
A Sticky Intent is a broadcast from sendStickyBroadcast() method such that the intent floats around even after the broadcast, allowing others to collect data from it.



46) Do all mobile phones support the latest Android operating system?
Some Android-powered phone allows you to upgrade to the higher Android operating system version. However, not all upgrades would allow you to get the latest version. It depends largely on the capability and specs of the phone, whether it can support the newer features available under the latest Android version.

47) What is portable wi-fi hotspot?
Portable Wi-Fi Hotspot allows you to share your mobile internet connection to other wireless device. For example, using your Android-powered phone as a Wi-Fi Hotspot, you can use your laptop to connect to the Internet using that access point.

48) What is an action?
In Android development, an action is what the intent sender wants to do or expected to get as a response. Most application functionality is based on the intended action.

49) What is the difference between a regular bitmap and a nine-patch image?
In general, a Nine-patch image allows resizing that can be used as background or other image size requirements for the target device. The Nine-patch refers to the way you can resize the image: 4 corners that are unscaled, 4 edges that are scaled in 1 axis, and the middle one that can be scaled into both axes.

50) What language is supported by Android for application development?
The main language supported is Java programming language. Java is the most popular language for app development, which makes it ideal even for new Android developers to quickly learn to create and deploy applications in the Android environment

PREVIOUS

Government Exams

Friday 20 February 2015

HR INTERVIEW QUESTION CLOCK PUZZLES

 

1. I found an unusual thing happening to my watch. I noticed that at every 65 minutes the hour and the minute hand come together. Can any anyone tell me that was my watch gaining or losing time and by how much ?

Asked In HR Interview
ANS:

In normal watch, the hour and the minute hand come together after every 65 5/11 mins but same position is achieved in your watch after 65 mins.
so watch is gaining time.

2. How many buckets of water can be there in Indian ocean ?

Asked In HR Interview
ANS:
Depends on size of Bucket

3. There are two apartments in a village in which the people from one apartment(Say Aprmnt 1) speak only truth where as the people from second apartment speak only lies(Say Aprtmnt 2) Now the question is you want to go to the apartment in which people speak only truth. You have a chance to ask only one question to any person in apartment and decide which is the correct apartment. What is the question you are going to ask to know which is the correct apartment.? (Condition: Only One Question Is To Be Asked)

Asked In HR Interview
ANS:
Which is your apartment?

Person who lives in apartment 1 will show you apartment 1 as they always speaks the truth.
Person who lives in apartment 2 will show you apartment 1 as the always speaks lies.
So all of them will always show you the apartment in which people speak only truth.

4. How to divide a cake in 8 sectors using three cuts?

Asked In HR Interview
ANS:
Just cut the cake once to make a 2 halfs... [1st cut]

Now place 1 half of d cake on the other half...
Now do a horizantal cut [2nd cut] which ll give 4 pieces [below half produce 2 nd above half produce 2]
nd then do a vertical cut [3rd cut] which ll give 8 pieces [below half produce 4 nd above half produce 4]

5. What are the negatives in your college ?

Asked In HR Interview
ANS:
The faculty of my college is so good that my interest towards the studies increasing day by day and I will give so much time to my study and can't give time to my family .
[This is tricky question at any case u should not reveal any negetives of your college.. Because hr thinks if i selects him definetly he will talk bad of our company outside :)]

6. There is a mute person who wants to buy a toothbrush. By imitating the action of brushing one\'s teeth he successfully expresses himself to the shopkeeper and the purchase is done. Now if there is a blind man who wishes to buy a pair of sunglasses, how should he express himself?

Asked In HR Interview
ANS:
He doesnt need to express by action...
a blind man can able to speak...
he ll go to d shop nd ask for a pair of sunglasses...

7. A woman gives a beggar 50 cents, the woman is the beggar's sister, but the beggar is not the woman's brother. How come?

Asked In HR Interview
ANS:
The beggar is also a women...
so she ll not be women's brother...
rather she is women's sister...

8. The day before yesterday, Chris was 7 years old. Next year, she'll turn 10. How is this possible?

Asked In HR Interview
ANS:
Today is Jan 1st...
Day before sday was dec 30th...
dec 31st she turned 8 years...
nd this year dec 31st , she ll turn 9 years...
nd next year she ll celebrate her 10th bday...

9. What goes up and down, but still remains in the same place?

Asked In HR Interview
ANS:
staircase...

v can go up nd down using staircase., but it ll remain in the same place...

10. how to prove 0!=1

Asked In HR Interview
ANS:
1! = 2!/2
2! = 3!/3
3! = 4!/4
similarly
n! = (n+1)!/(n+1)
so, 0! = 1!/1 = 1
(OR)
we know that n!=1*2*3...*(n-1)*n
n!=(n-1)!*n
n!/(n-1)!=n
put n=1
1!/0!=1
0!=1!/1=1
Thus proved

11. What is the lcm and hcf of
10/21, 1/2, 5/7

Asked In HR Interview
ANS:
LCM in case of fraction = LCM of Numerator terms / HCF of Denominator terms

Similarly HCF in case of fraction = HCF of Numerator / LCM of Denominator terms

therefore LCM = LCM of (10,1,5) / HCF of (21,2,7)
= 10 / 1
=10

HCF = HCF of (10,1,5) / LCM of (21,2,7)
= 1 / 42

12. Divide the 12 hour clock in 3 parts such tat summation of 3 parts must be equal

Asked In HR Interview
ANS:
I think Parts of clock should be properly divided as per number position on clock.

1,2,11,12...; sum =26
3,4,9,10; sum =26
5,6,7,8; sum =26

13. What is the difference between Verilog and C?

Asked In HR Interview
ANS:
verilog is used for hardware description language for designing of digital circuits.....
whereas c is used for software description language for programming....

14. Suppose there are 100 gates for going in and out,first dog open the 1st,2nd, 3rd upto 100, second dog changes the pattern of 2 ,4, 6...100, 3rd dog changes the earlier pattern of 3,6,9....100 and its continue upto 100th dog , in the end which gate is open...

Asked In HR Interview
ANS”
ans -100 as
1st dog 1 2 3 4 5 ......100
2nd dog 2 4 6 8........100
3rd dog 3 6 9 12........100
likely 5th dog 5 10 15 20....100
therefore 100th dog opens the 100th gate only

15. Prove that 15-6=10 without using any operations and modifications in the above expression.

Asked In HR Interview
ANS:
15-6=10
=> 9=10
we can wriite them in roman number form,them(9=IX , 10=X)
=> IX=X
on multiplying both sides with 'V' (since 5=V)
=> V(IX)=V(X)
=> V(X-1)=V(XI-1)
=> VX-V=VXI-V
=> VX=VXI
=> (VX/VX)=I
=> 1=I
=> I=I
PROVED (LOGICALLY)

16. What will be next number in series.
3,6,7,12,13,18,19,24,?.
Options are-
(a) 31
(b) 32
(c) 33
(d) 34

Asked In HR Interview
ANS:
Add 1 with alternate prime numbers

3
5+1=6
7
11+1=12
13
17+1=18
19
23+1=24
29
31+1=32


Ans : 32

17. cross+roads=danger then d+a+n+g+e+r=?

Asked In HR Interview
ANS:
ans is 49
C=0
R=4
O=16
S=3
A=2
D=1
N=7
G=30
E=5
Therefore:
(CROSS + ROADS = DANGERS)        d+a+n+g+e+r = 1+2+7+30+5+4 = 49

18. 3,5,7,11,15,17,19......which is the next number

Asked In HR Interview
ANS:
Difference between first and second number - 2
Difference between Second and third number - 2

Difference between third and fourth number - 4
.
.
.
.
Difference between seventh and eighth number - 4

19+4 = 23Ans

19. We get 0,0,0,0 .there are four zero's.we can use any one operator on that four zero's that the answer will be 24.

Asked In HR Interview
ANS:
here is the soltn : (0!+0!+0!+0!)!=24

20. Q. What is the next number of the following sequence
31,28,31,30,31,30,31,31

Asked In HR Interview
ANS:
Given sequence
31,28,31,30,31,30,31,31,.....

It's a sequence of number of days in a month of a year
January - 31 days
February - 28 days
March - 31 days
April - 30 days
May - 31 days
June - 31 days
July - 30 days
August - 31 days
similarly ;
september- 30 days

so answer will be 30 (option 2)

Technical Interview

PREVIOUS