Sei sulla pagina 1di 10

(1) 250 Android Interview Questions - Android interview

questions - Freshers & Experienced


I am giving set of 250 Android interview questions here, which I have answered in android interview
questions and answers - skillgun
Since Java is also a part of android interview, I have included around 60 java interview questions here.
I am giving only questions here as space is a constraint for explaining every answer.
Android Interview Questions:
1.

Draw architecture diagram of android framework.

2.

Which kernel(Operating system) is used in android?

3.

In which language android framework is written?

4.

What does DVM stand for ?

5.

Why DVM why not JVM?

6.

Which layer does DVM sits?

7.

What is the latest version of android? Can you tell me what is the new concepts added in this

version?
8.

Explain life cycle of activity?

9.

If I have a broadcast receiver that updates my UI frequently, then where should I register that

broadcast receiver in my activity life cycle functions?


10. Can I save all my databse tables updations in onStop() of activity? If not explain why and also explain
where should I save db tables?
11. What is difference between persistent data and transient data, give one example. Also tell me which
activity life cycle function I need to use to save them?
12. What will happen if I remove super.oncreate() from oncreate() function of activity?
13. What is the purpose f super.oncreate() ?
14. Show me how does intent-filter of main activity looks like? What is the action and what is the
category?
15. What is the importance of version code and version name attributes in manifest file?
16. Can one application have more than on manifest file?
17. Can I create activity without xml file?
18. How to create ui without using xml file, show with one example on how to create activity with a linear
layout and with two buttons and without having xml file?
19. Give me two examples of configuration changes in phone?
20. What is the mandatory life cycle function that will get called in case of configuration changes?
21. Can I save large images downloaded from internet in onsaveinstancestate() ?

22. What is the difference between this & getapplicationcontext() ? which one to use when?
23. Every application will have by default one thread? True or false?
24. What is ANR (application not responding)? What is the reason for this problem and what is the
solution for that problem?
25. Main thread will have a looper , true or false?
26. By default a given process will have how many threads? Who will create those threads?
27. What will happen if I remove oncreate() & onstart() from activity? Will it run?
28. Can I have an activity without UI?
29. What is the difference between intent, sticky intent, pending intent?
30. What is the difference between implicit intent and explicit intent, give one example?
31. How many components are there in an intent?
32. Can I give more than one action in a given intent?
33. Can I give more than one category in a given intent?
34. Create an intent to start calling a number "12345" ?
35. what is the importance of putextras in intent? How is it different from setdata() ? any way both are
passing data only , so in that case what is the difference? 36.
What is the difference between thread and service?
37. Can I have a service without thread?
38. If I want to touch ui from another thread can I touch directly? What will happen if I do so?
39. How to achieve inter thread communication?
40. What is the difference between thread and handler thread?
41. what will happen if I bind a service from a broad cast receiver, is there any problem?
42. Can I start a service from a broadcast receiver? 43.
How to start a service with foreground priority?
44. What is the difference between broadcast receiver and a service, where most of the cases both will
not have any UI, in that case which one I should use?
45. If I start an activity with implicit intent, and there is no matching intent-filter then what will happen?
46. If I send a broad cast with implicit intent, and there is no matching intent-filter then what will happen?
47. Write a broadcast receiver that gets triggered once phone boot is done?
48. What will happen if I don't pass any action in an implicit intent, will it trigger any component?
49. Can I start a content provider using an intent?
50. I have one intent filter without any action, then can I trigger this component from outside of this
application?
51. Can I have more than one action in my intent-filter?
52. Can I have more than one category in my intent-filter?
53. Can I have extras in my intent-filter?
54. I want to start something in the background in my activity, should I use thread or should I start
service? Why?
55. If I crate a thread in my activity and if I stop my activity what will happen to that thread, will it be alive
or dead?

56. If I start a service from my activity and if I stop my activity what will happen to that service, will it be
alive or dead?
57. How many ways are there to kill a service?
58. If I want my service to allow binding, then what is the function that I need to implement in my service
class?
59. Can I create a customized textview?
60. How many ways you can store persistent data?
61. What is the use of content provider? Will it support shared preferences?
62. If I want to share some data with outside applications then what is the component in android to use?
63. Can one application access other app database directly?
64. Where does the database get stored?
65. What is the extension of your shared preference file? Where is it stored?
66. What is the default shared preference file name of an activity?
67. What is the difference between task, process, application, and thread?
68. Does android support multi tasking? If yes explain how to start a new task when you are already
running one task?
69. Does android support multi threading?
70. What is the mechanism used by android for Inter-process-communication?
71. How binder is different from serialization?
72. How serialization differ from parcel?
73. If I have one application with activity, service, and contentprovider. Then when I run this program how
many process, threads will be created? Is it possible to run these components in more than one process?
74. What is looper, message queue, and a Handler? Where do you need these components?
75. Can I send a message from thread-a to thread-b, if thread-b didn't prepare its looper?
76. How to avoid synchronization problems in threads?
77. What is the difference between synchronized block(statement) and synchronized methods?
78. If I want to create a service with one worker thread how to achieve it?
79. How to create multi threaded service?
80. How to create a service with threads and that updates ui?
81. What will happen if you start a service that does heavy functionality without starting a thread?
82. What is the UI response time limit in android. (I.E with in how many seconds main thread has to
respond for user actions?)
83. What is the time limit of a broadcast receiver, what will happen if it crosses that time limit?
84. What is the difference between sendbroadcast(), sendorderedbroadcast(), sendstickybroadcast() ?
85. If I want to start an activity that gives a response, what is the function I need to use to start that
activity?
86. If I startactivityforresult() and the child activity gets crashed what is the result code obtained by the
parent?
87. In case of low memory if android closes a service forcefully, then will it restart automatically or user
has to start it?

88. What are the various return values of onstartcommand() , and when to use what?
89. Let's say my service supports both starting a service and binding a service, and currently two persons
have started my service and one person is binding to my service. After 5 minutes person who bound to my
service, unbinds it.And other person stops my service, now is my service running in memory or got moved
out from memory?
90. What is empty process and what is its priority? When android will use this concept? 91.
How does android achieves seamlessness. What is the meaning of seamlessness?
92. What is the difference between menus and dialogs?
93. How many kinds of menus are there in android?
94. How many kinds of dialogues are there in android?
95. I want to design one application where I take username, password and connect to the gmail and show
the status of login to the user. Now how to design this application? How many components will be there?
96. What is the use of httpclient class?
97. What is the difference between httpget() and httppost() methods, when to use what?
98. What does httpclient.execute() return?
99. What are static variables stored in memory segments?
100.

If I want to secure my preference file from other activities in my app, then should I use

getpreferences() or getsharedpreferences()?
101.

I want to store huge structured data in my app that is private to my application, now

should I use preferences [or] files [or] sqlite [or] content provider?
102.

My application has only a service, and my service performs heavy lift functionality to

connect to internet and fetch data, now should I create a thread or not? If so why?
103.

I want to write a game where snake is moving in all the directions of screen randomly,

now should I use existing android views or should use canvas? Which is better?
104.

Can I have more than one thread in my service? How to achieve this?

105.

When lcd goes off, what is the life cycle function gets called in activity?

106.

When a new activity comes on top of your activity, what is the life cycle function that

gets executed.
107.

When a dialog is displayed on top of your activity, is your activity in foreground state or

visible state?
108.

When your activity is in stopped state, is it still in memory or not?

109.

When your activity is destroyed, will it be in memory or moved out of it?

110.

I started messaging app -> composer activity -> gallery -> camera -> press home

button. Now which state camera activity is in?


111.

Continuation to above question, now If I launch gmail application will it create a new

task or is it part of old messaging task?


112.

Can I have more than one application in a given task?

113.

Can I have more than one process in a given task?

114.

Do all the activities and services of my application run in a single process?

115.

Do all components of my application run in same thread?

116.

How to pass data from activity to service?

117.

How to access progress bar from a service?

118.

What is the difference between intent and intent-filter?

119.

What is the difference between content-provider and content-resolver?

120.

What is the difference between cursor & contentvalues ?

121.

What is Bundle? What does it contain in oncreate() of your activity?

122.

When an activity is being started with an intent action "MY_ACTION", how can I see

that action in triggered component(activity)?


123.

How to get contact number from contacts content provider?

124.

How to take an image from gallery and if no images available in gallery I should be able

to take picture from camera and return that picture to my activity?


125.

What is the difference between linear layout and relative layout?

126.

How many kinds of linear layouts are there?

127.

What is "dp" [or] "dip" means ?

128.

What is importance of gravity attribute in the views?

129.

What is adapter? What is adapter design pattern?

130.

What is adapterview? How many adapter views are available in android?

131.

Can you tell me some list adapters?

132.

Can I give cursor to an array adapter?

133.

What is custom adapter, when should I use it. what are the mandatory functions I need

to implement in custom adapter?


134.

What is the class that I need to extend to create my own adapter?

135.

What is the android compilation and execution process/ cycle?

136.

What is adb? What is the command to install one application using adb command

prompt?
137.

What is the debugging procedures available in android?

138.

How will you analyze a crash, how will fix using logcat?

139.

What is a break point and how to watch variables while debugging?

140.

What is ddms? What are the various components in ddms?

141.

What is the difference between started service and binded service?

142.

How to achieve bind service using IPC?

143.

How will I know if a client is connected to a service or not?

144.

I want to access a functionality from one application to other application, then should I

use content provider or startservice or bind service?


145.

I want to access data of another application in my application, now do I need to

implement content providers in my application or other application has to implement it?


146.

What is the difference between local variables, instance variables, and class variables?

147.

What is anonymous class? Where to use it?

148.

What is singleton class, where to use it? show with one example how to use it?

149.

If I want to listen to my phone locations, what all the things I need to use? Is it better to

use network providers or gps providers?


150.

My phone don't have network signal and satellite signal, now is there any way to fetch

my last location where signal was available?


151.

I have some data available in docs.google server, and I want to display it in tabular

fashion, tell me the sequence of steps to achieve this?


152.

If I want to start some heavy weight functionalities that takes lot of battery power like

starting animation or starting camera, should I do it in oncreate() or onstart() or onresume() of my activity?


And where should I disable it?
153.

Why you should not do heavy functionality in onresume and onpause() of your activity?

154.

What things I can do in onrestart() of my activity?

155.

What is the life cycle of a service?

156.

What is the life cycle of a broadcast receiver?

157.

What is the life cycle of a content provider?

158.

What is the life cycle of a thread?

159.

What is the life cycle of your application process?

160.

How to kill one activity?

161.

What is log.d ? where to use log functions?

162.

Draw the life cycle of an activity in case of configuration change?

163.

What is the difference between viewgroup and layout?

164.

Draw the key event ow in android?

165.

When you fire an intent to start with ACTION_CALL , what is the permission required?

166.

What are the permissions required to obtain phone locations?

167.

How many levels of security available in android?

168.

How to achive security to your service programmatically in such a way that your service

should not get triggered from outside applications?


169.

What are the sequence of tests done to map intent with an intent-filter?

170.

Describe various folders in android project in eclipse?

171.

What is raw folder in eclipse project?

172.

Under what thread broad cast receiver will run?

173.

If I want to notify something to the user from broadcast receiver, should I use dialogs or

notifications? Why?
174.

Can you create a receiver without registering it in manifest file?

175.

If I want to broadcast BATTERY_LOW action, should I use sendbroadcast() or

sendstickybroadcast? Why?
176.

If I want to set an alarm to trigger after two days, how should I implement it? assume

that I may switch off the phone in between.


177.

I want to trigger my broadcast receiver as long as my activity is in memory, else it

should not get triggered, how should I achieve this?


178.

What is sleep mode? What will happened to CPU once screen light goes off?

179.

How many kinds of wake locks are available, which one to use when?

180.

If I am using full wake lock and user presses screen lights off, what will happen?

181.

When phone is in sleep mode, what are the two components that will keep running

even though phone is in sleep mode?


182.

Every day night at 12 o clock I need to post some images to facebook, in that case I will set

repeating alarm for every day night 12 am. But to upload images I want to start service, how should I do
this ?
183.

When you start an activity from a notification, will it start as new task or old task?

184.

Why android follows single threaded ui mode? How other threads can manipulate ui

views?
185.

What is the purpose of SQLiteOpenHelper?

186.

What is the procedure to upgrade database after first release?

187.

Show with one example where memory leak possibility in Android?

188.

If I want to write one application for both phones and tablets, what should I use in my

UI?
189.

I have a thousands of items in my array, and I want to display it in listview, what is the

most optimized way to achieve this?


190.

What is r.java file? What does it contain?

191.

Write one application which will get triggered immediately after booting.

192.

What does .apk file contains?

193.

How will pass information from one activity to other activity, let's say pass userid, city, and

password to next activity and display it.


194.

Write code for an xml file having a relative layout with employee registration form.

195.

Get a table information from the database and show it in table UI format.

196.

I have thousands of columns and thousands of rows to display it in UI tabular format,

how should I show it this dynamically growing UI. Should I load all in single shot or any optimization can be
done?
197.

When to use String, StringBuffer, & StringBuilder?

198.

What is String constant pool? What is the difference between below two statements?
i.

199.

Which is preferred way to use?

ii.

String str1 = "hi";

iii.

String str2 = new String("hi");

If I want to share a String between two threads, and none of threads are modifying my

String which class I have to use?


200.

If I want to use my String within only one thread which is modifying my String, then

which class I have to use? Similarly if I want to my string to be changed by more than one thread then
which class I have to use?
201.

How does String class look like? What is final class meant for? How will you implement

your own String class?


202.

What is immutable object? How is it different from immutable class?

203.

Depict one example for immutable class in java framework?

204.

How will you write a class in such a way that it should generate immutable objects?

205.

Does String class uses character array internally in its implementation?

206.

What is the difference between char & Character classes? Which one is value type and

which one is ref type?


207.

What is the meaning of pass by reference? If I have an integer array and if I pass that

array name to a function, is it pass by value or pass by reference?


208.

I want to use array in my program which has to grow dynamically, in that case should I

use Array [or] ArrayList [or] Vector? What is the difference between arraylist and vector? Which one of
them is not part of collections framework of JAVA?
209.

I want to use dynamically growing array shared between two threads, should I use

arraylist or vector?
210.

I want to store values of my employees in a data structure using java collections

framework in such a way that I should be able to read, write, modify & delete them very fastly. Which
datastructure should I use ? arraylist [or] linkedlist [or] hashsets [or] hashmap ?
211.

Write a program in such a way that Thread1 will print from 1-1000 & Thread2 will print

from 1000-1. Thread1 should sleep for 1 second at every 100th location. Thread2 should interrupt thread1
once thread2 reaches 500.
212.

How will you stop a thread, which is currently running?

213.

If Thread1 interrputs Thread2, how Thread2 should handle it? (Generally how threads

should handle interruptions?) how will thread2 know that other threads are interrupting it?
214.

What is interrupted exception? Which functions will throw this exception? How to

handle it?
215.

Assume that two threads t1, & t2 are running simultaneously in single core CPU. How

does t2 will request OS that it wants to wait till t1 is finished?


216.

I want to implement threads in my program, should I extend Thread class or implement

Runnable interface? Which one is better, justify your answer in terms of design.
217.

What will happen if you return from run() function of your thread?

218.

What is the difference between checked & unchecked exceptions? Which one

programmer should handle?


219.

arrayIndexOutOfBounds, NullPointerException, FileNotFoundException,

ArithmeticException, InterruptedException, IOError, IOException. In this list which exceptions programmer has
to handler compulsorily? Categorize above exception list into ERROR/ RUNTIME EXCEPTION/ REST
categories.
220.

Assume that I am writing a function which likely to throw checked exception, in that

case if I don't handle it will compiler throw any error?


221.

How one should handle checked exceptions? Mention 2 ways to handle it.

222.

I am writing a function where it is likely that checked exception may come, I want to

handle it in my function and I want to pass that exception to my parent caller also. How do I achieve it?
223.

What is difference between throw, throws?

224.

Can I write a try block without catch statement?

225.

What is difference between final, finally, & finalize.

226.

Will java ensure that finalize will be executed all the time immediately after object is

destroyed? How to mandate it?


227.

What is 9 patch image, how is it different from .png images? Why we have to use this in

android? How will it help in the scalability of an image for various screens?
228.

What is the difference between synchronized method and synchronized block? If I have

a huge function where only two lines of code is modifying a shared object then should I use synchronized
block or method?
229.

Implement insertion sort, binary search, and heap sort.

230.

How many ways a server can communicate (Send data) to a mobile application? Which

is fastest way json or xml?


231.

What is JSONArray & JSONObject. Show this with one example by requesting one

URL using HTTP, which gives JSON object.


232.

Name some sites which extensively use JSON in communicating their data with clients.

233.

What is the permission you need to take for fetching GPS locations, & reading contacts.

Where will you have to write permissions in manifest file?


234.

How will you display data base information in a table kind of architecture in android?

Which view will you use?


235.

How many kinds of adapter-views, and adapters available in android?

236.

What is notifydatasetchanged() function meant for?

237.

Take data base cursor of employee (eno, ename, salary) into a cursor, fill into a list view

where each item should have a check box also, how will you implement it in android?
238.

What is the difference between constructor and static block. Can I initialize static

variables in constructor?
239.

I want to use a private variable of Class-A in classB directly without using any function.

How to achieve this?


240.

I want to create a class in such a way that nobody should be able to create object for

that class except me. How to do it?


241.

Can I access instance variables in a static function? Can I access static function

/variable from an instance method?


242.

Why is multiple inheritance of classes not allowed in java? If I want to get functions of

Class-A & Class-B into class-C. how do I design this program?


243.

Does java allow multiple inheritance of interfaces? Can one interface extend other

interface ? when should I extend interface from other interface?


244.

What is the difference between over loading and over riding?

245.

Can I over ride base class constructor in derived class?

246.

Can I over load a constructor?

247.

How does default constructor look like? What super() call does in a constructor?

248.

Why does base class constructor gets executed before executing derived class

constructor? Justify this with appropriate example?

249.

How will you achieve dynamic polymorphism using over riding? Justify usage by taking

some example (note: use client-server example)


250.

Why overloading is static polymorphism, justify your answer?

251.

What is the difference between static/compile time linking & dynamic/run time linking?

Are static functions dynamically linked?


252.

Show one Is-A relation with one example.

253.

Show one Has-A relation with one example.

Happy job hunting


Best wishes
Team,
Palle Technologies
The training expert in Bangalore.

Potrebbero piacerti anche