In our last post we discussed the most common interview questions a beginner can expect while appearing for an Android developer interview. This Android for beginners tutorial covers the responses to those questions. These questions and their answers have been strictly curated under the supervision and guidance of Android Certification experts, who are also working professionals with years of experience in development, training and recruitment. Having read the last post, you now have an idea of the interviewer’s expectations from you, both technically and behaviorally. So, you can prepare accordingly!
Android Interview Questions and Answers
I) What are the components of Android?
Component | Description |
Activity |
|
Intent |
|
Service |
|
Broadcast Receiver |
|
Content Provider |
|
You’ll get a walk-through of the entire process using examples, in Edureka’s Android for beginners training.
II) Some C programming Question for you
1) How can you print “hello world” without using semicolon (;)?
Think about it a little before looking at the solution.
Solution
This question can be solved in more than one way:
a)
#include<stdio.h> void main() { if(printf("Hello World")) { } }
b)
{ while(printf("Hello World")){} }
c)
{ do{} while(printf("Hello World")){} }
Sometimes, multiple choice programming questions can be asked in Android for beginners interviews. Check this one out for instance:
2) What will be output of following C code?
#include<stdio.h>
int main()
{
int *a1;
char **a2;
float ***a3;
double ****a4;
printf("%d %d %d %d ",sizeof(a1),sizeof(a2),sizeof(a3),sizeof(a4));
return 0;
}
Options
a) 1 2 4 8
b) 2 4 4 8
c) 2 4 2 4
d) 2 2 2 2
Answer: d.
Size of pointer is same no matter what type it is (2 byte)
Note – This is assuming that we are on a 32 bit machine. On 64 bit it will be 4 bytes.
III) Java Coding Question
1) Can you write a java code to swap two numbers?
Solution
public class Swap { public static void main(String[ ] args) { int x = 5; int y = 6; //store 'x' in a temp variable int temp = x; x = y; y = temp; System.out.println("x=" + x+ "y=" + y); } }
2) Write Java code to swap two numbers without using a third variable i.e. temp in the above case.
Tough..??
Not really; in fact you know it already :)
Solution
public class Swap { public static void main(String[ ] args) { int x = 5; int y = 6; //Add both the variables and store them in x i.e x = 11 (x=5 + y=6). x = x + y; //Now subtract y from x and store in y i.e y = 5 (x=11 - y=8) . Hence initial value of x is assigned to y. y = x - y; //Now subtract y from x and store in x i.e x = 6 (x=11 - y=5) . Hence initial value of y is assigned to x. x = x - y; // Both the values are swapped successfully without using the third variable System.out.println("x=" + x+ "y=" + y); } }
Candidates with advanced knowledge would be expected to answer questions much difficult than these. This post however deals with Android for beginners basics, so we’ll
handle interview questions for an experienced Android developer in later posts! Stay tuned.
Happy Learning!
Got a question for us? Please mention it in the comments section and we will get back to you.
Related Posts:
Get started with Android Training
Top 5 Android Interview Questions for freshers
Android Tutorials for Beginners: Activity component
Again, this swap function will potentially produce overflow. The one I normally use for integer swap is x=x^y; y=x^y; y=x^y.
Oops, typo. Should be x=x^y; y=x^y; x=x^y.
x=x+y , y=x-y , x=x-y
Must have App for Android application developers – DroidQuest
Latest Interview questions , Jobs opportunities , Developer community , Android tips and tricks , Save your favorite questions
Download from Google Play :
https://play.google.com/store/apps/details?id=in.technodroid.swap
pointer size is 2 bytes in 32 bit system??? 32/8=?
Hi Joe, the pointers will be always be size 2 on a 16-bit system and 4 on a 32-bit system (32/8=4).
Heya just happened upon your website from Bing after I typed in,
“Android for beginners: Interview Questions and Answers for freshers” or perhaps something similar (can’t
quite remember exactly). Anyways, I’m delighted I found it because your content is exactly what I’m looking for (writing a university paper) and I hope you don’t mind if I
collect some information from here and I will of course credit
you as the source. Thanks.
Thank you…
Superb website you have here but I was curious if you knew of any discussion boards
that cover the same topics talked about here? I’d really love to be a part of
online community where I can get responses from other knowledgeable individuals that
share the same interest. If you have any recommendations, please let me know.
Cheers!
Its very useful.thank you for the information
Your Interview question doesn’t cover all the topics. It will be great if you provide few question on each topic like on broadcast reciever,location based service.Thank You
thank you
I just want to mention I’m beginner to blogging and certainly savored your website. Probably I’m likely to bookmark your blog post . You really have beneficial writings. Thanks a lot for sharing with us your website page.
Having read this I thought it was really enlightening. I appreciate you finding the time and effort to put this content together. I once again find myself personally spending a significant amount of time both reading and posting comments. But so what, it was still worth it!