Android Interview Questions And Answers For Beginners

Recommended by 42 users

Nov 22, 2012
Android Interview Questions And Answers For Beginners
Add to Bookmark Email this Post 30.1K    38

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. 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? Elaborate!

The main components of Android are:

1) Activity

2) Intent

3) Service

4) Broadcast receiver

5) Content Provider

5-Components-of-Android-android-interview-questions-and-answers

1) Activity

Activity provides an interface for users to interact with the application and take an action (for instance: Login to a website). The different screens/windows of an application are the different activities. An application generally has multiple activities.

Activities are like the pages in a website. For instance, in a Facebook app, the login screen is one activity, and the news feeds from your friends after signing in would be another one.

Activity-Component-android-interview-questions-and-answers

2) Intent

Think of Intent as a message to allow the application to request action from the other application components (like activity), for instance VIEW, CALL, PLAY etc.

Suppose, on your Facebook app, the running activity is the Newsfeed, and you want to view (in full frame) a pic your friend posted. The click action on the photo would be the View Photo Intent, and the Photo screen (which is a new activity) gets loaded on the click (as the message is communicated).

Intent-Component-android-interview-questions-and-answers

3) Services

Services are components that do not have a User Interface; they run in the background. An example of Service component in Facebook app would be the friend request notifications. They would continue to run, even if you switch to another activity or application.

Service-Component-android-interview-questions-and-answers

4) Content Provider

Content provider is a data store that enables data sharing across different applications. Content providers provide a uniform interface to access the data. An example is Call logs.

5) Broadcast Receiver

A Broadcast receiver comes into action only in specific situations. Suppose an Intent for which a particular broadcast receiver has been registered occurs, the broadcast receiver is triggered into action and the user gets a notification for the same. (For example: Battery low notification)

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

Android Project : Droid Remote

Android Project : BlackJack Game

The Beginner’s Guide to Android: Android Architecture

Share on
Comments
38 Comments
  • sunil kuntal

    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

  • Ranjith

    Nice collection of questions, I found some advanced interview questions at http://chikkooos.blogspot.jp/p/advanced-android-interview-questions.html which might be useful for you

  • Tapan Parmar

    Hey there . i want some more questions discussed as above in java. Plz send me appropriate material on : tapanhp95@gmail.com

    • EdurekaSupport

      Hi Tapan,
      You can get in touch with us by contacting our sales team on +91-8880862004 (India) or 1800 275 9730 (US toll free). You can also mail us on sales@edureka.co.

  • Rashid

    hello friendss!!!
    i want OOPs concept data where i can learn more about oops concept clearly .
    plz send me some data regarding OOPs Concepts
    i want to strong OOPs topic
    thank you
    mail me:-rsd.083@gmail.com

    • EdurekaSupport

      Hi Rashid, You can learn a good deal about OOPS in our Java/J2EE & SOA course. You can check out the course details here: http://www.edureka.co/java-j2ee-soa-training-course-curriculum .You can call us at US: 1800 275 9730 (Toll Free) or India: +91 88808 62004 to discuss about this in detail or you can mention your contact number and we will call you.

    • sunil kuntal

      You can also download DroidQuest app that will help you get the right resources to start learning and latest Android interview questions to crack interview. Stay connected to community of developers for latest Android development news and JOBS.
      https://play.google.com/store/apps/details?id=in.technodroid.swap

  • Joe

    Again, this swap function will potentially produce overflow. The one I normally use for integer swap is x=x^y; y=x^y; x=x^y.

24 X 7 Customer Support X

  • us flag 1-800-275-9730 (Toll Free)
  • india flag +91 88808 62004