1

How to send an SMS in android, through code ?
Eg: If I want to send a message to destination number "8527801400", then what is the correct code to do it?

  • SmsManager s = SmsManager.getDefault();
    s.sendTextMessage("8527801400", null,
    "Hi how are you?", null, null);
  • SmsManager s = SmsManager.getDefault();
    s.sendTextMessage(null, "8527801400",
    "Hi how are you?", null, null);
  • SmsManager s = SmsManager.getDefault();
    s.sendTextMessage("8527801400", "8527801400",
    "Hi how are you?", null, null);
  • SmsManager s = new SMSManager();
    s.sendTextMessage(null, "8527801400",
    "Hi how are you?", null, null);

Answer: A SmsManager s = SmsManager.getDefault();
s.sendTextMessage("8527801400", null,
"Hi how are you?", null, null);
Description: SmsManager s = SmsManager.getDefault();
s.sendTextMessage("8527801400", null,
"Hi how are you?", null, null);
Note: first parameter is destination number, second parameter is source number which you can omit, third parameter is text to be sent, fourth parameter is sent intent, fifth parameter delivery intent.
Sent intent: You can give a pending intent that should be broad casted once your message reaches your service providers SMS center.
Delivery intent: you can give a pending intent that should be broad casted once your message is delivered to the destination phone.

2

What is the root tag of a manifest file in android? (which will be immediately after xml tag).

  • application
  • manifest
  • activity
  • uses-sdk

Answer: B manifest
Description: manifest is the root tag for Manifest file.

3

What is rooting?

  • It is the process of allowing users of smartphones, and other android enabled devices to get the privileged permissions (root access).
  • rooting allows to run any appliction that requires admin level permissions in the android system And can perform any operation which is not allowed by normal android user.
  • rooting is also done to overcome the limitations set by carriers and OEM (original equipment manufacturers) on a phone. Rooted phone can be used any where with any carrier network.
  • all are true

Answer: D all are true
Description:

4

How to take screenshot in android?

  • open camera and take a picture of that screenshot.
  • Connect phone to eclipse, open DDMS, click devices, click on camera button (on top), which opens the current screen of the phone or emulator, click save to save that screen shot as immage.
  • Right now there is no support to take screen shots in android.
  • none

Answer: B Connect phone to eclipse, open DDMS, click devices, click on camera button (on top), which opens the current screen of the phone or emulator, click save to save that screen shot as immage.
Description:

5

How to root an android phone?

  • backup current ROM.
    turn on USB debugging.
    May have to install Android SDK in the computer.
    unlock boot loader by logging in to your oem site.
  • android won't support rooting.

Answer: A backup current ROM.
turn on USB debugging.
May have to install Android SDK in the computer.
unlock boot loader by logging in to your oem site.
Description:

6

What are the different version names of android?

  • 1.5 cupcake
    1.6 donut
    2.0, 2.1 eclair
    2.2 froyo
    2.3.x ginger bread
    3.x honey comb
    4.0.x ice cream sandwitch
    4.1 jelley bean
    4.2 kitkat
  • 1.5 cupcake
    1.6 donut
    2.0, 2.1 eclair
    2.2 froyo
    2.3.x ginger bread
    3.x honey comb
    4.0.x ice cream sandwitch
    4.1, 4.2, 4.3 jelley bean
    4.4 kitkat
  • 1.5 cupcake
    1.6 donut
    2.0 eclair
    2.1, 2.2 froyo
    2.3.x ginger bread
    3.x honey comb
    4.0.x ice cream sandwitch
    4.1, 4.2, 4.3 jelley bean
    4.4 kitkat
  • 1.5 cupcake
    1.6 donut
    2.0, 2.1 eclair
    2.2 froyo
    2.3.x ginger bread
    3.x honey comb
    4.0.x ice cream sandwitch
    4.1, 4.2, 4.3 jelley bean
    4.4 key lime pie

Answer: B 1.5 cupcake
1.6 donut
2.0, 2.1 eclair
2.2 froyo
2.3.x ginger bread
3.x honey comb
4.0.x ice cream sandwitch
4.1, 4.2, 4.3 jelley bean
4.4 kitkat
Description:

7

What is the difference between permission and uses-permission in android?

  • i. permission tag is used to enforce a user defined permission on a component of your application.
  • ii. uses-permission tag is used to take a permission from the user for your application.
  • iii. permission tag is used when you want other applications to seek permission from the user to use some of your applications components.
  • i
  • i & ii
  • i, ii, & iii
  • i & iii

Answer: C i,ii,&iii
Description:

8

What is android sdk?

  • android sdk contains set of libraries, APIs, and set of tools to develop, test, and debug android applications for android powered devices.
  • android sdk comes with jdk built in.
  • both options are true
  • none

Answer: A android sdk contains set of libraries, APIs, and set of tools to develop, test, and debug android applications for android powered devices.
Description:

9

What is android emulator?

  • It is a tool used to run android applications with out having real hardware device. This can be used to test an android application without having a real physical device.
  • Android emulator simulates the real hardware device environment in workstations where programmer is developing android applications.
  • android emulator tool comes as a part of android SDK while downloading. Emulator.exe tool is part of android-sdk\tools folder.
  • all are true

Answer: D all are true
Description:

10

What is android mobile?

  • The mobile that runs on android O.S and android platform is called as android mobile. Eg: Samsung Galaxy phones, LG optimus phones, etc.
  • The mobile released by Google is called as android mobile. Eg: Samsung Nexus S phone.
  • The mobile which contains google applications and android applications is called as android mobile.
  • all are true

Answer: A The mobile that runs on android O.S and android platform is called as android mobile. Eg: Samsung Galaxy phones, LG optimus phones, etc.
Description:

11

What is android device manager?

  • android device manager is a google tool with which user can locate a phone (if stolen).
    Optionally user can ring the phone, lock the phone, and erase the data on the phone. But for that user should be registered with google account with his mobile number.
  • Location data from user device will be collected and sent to Google.
    Device location is approximate. To track your mobile using android device manager visit https://www.google.com/android/devicemanager
  • both are correct
  • none

Answer: C both are correct
Description:

12

What is android rooting?

  • Rooting an android phone to get admin level rights is called as android rooting.
  • Generally rooting will be done to overcome carrier settings and to use a mobile in any carrier network. Rooting is also useful to install an android application which might do operations that requires admin rights, which are not available for normal users.
  • Rooting a device may void the warranty and guaranty of your phone. Rooting may also brick your phone and it may become useless. Proper care has to be taken while rooting a device. It is not advisable to root a device withour proper knowledge.
  • all are true

Answer: D all are true
Description:

13

What is android application?

  • i. An application that runs on any android powered device using android framework, is called as android application.
  • ii. Android application runs in a sandbox , an isolated area of the system that does not have access to the rest of the system's resources.
  • iii. Android applications runs in linux Operating system.
  • i
  • i & ii
  • i,ii, & iii
  • none

Answer: C i,ii, & iii
Description:

14

what is MODE_PRIVATE when creating shared preference file?

  • only the process or application which has created that preference file can access it. other applications can't access it.
  • only the activity which has created that preference file can access it. other activities can't access it.
  • only the thread which has created that preference file can access it. other threads can't access it.
  • only the process or application which has created that preference file can write to it. other applications can only access it.

Answer: A only the process or application which has created that preference file can access it. other applications can't access it.
Description: MODE_PRIVATE is meant for accessibility permission for an application. only that app which has created that preference file can access it.

15

How to share preference file to other activities of same application?

  • Use getPreferences(MODE_PRIVATE);
  • Use getSharedPreferences("name", MODE_PRIVATE);
  • Use getSharedPreferences("name", MODE_WORLD_READABLE);
  • Use getSharedPreferences("name", MODE_WORLD_WRITABLE);

Answer: B Use getSharedPreferences("name", MODE_PRIVATE);
Description: If the preference file is having some name, then only other activities can access it.
MODE_PRIVATE says it is accessible with in the application.

16

What does below code do?

  • in.setAction(Intent.ACTION_GET_CONTENT);
  • in.setType("image/*");
  • startActivityForResult(in, 1);

  • i. It will start gallery app only if images are there in the gallery.
  • ii. It will start gallery app only even if there are no images in the gallery.
  • iii. after selecting any image in gallery, it will return the URI of that image to this caller.
  • i
  • ii
  • i & iii
  • ii & iii

Answer: D ii & iii
Description: It will start gallery app, even if there are no images in the gallery.after selecting any image in gallery, it will return the URI of that image to this caller.
Note: if there are no images in the gallery, then you can start camera from there, capture an image, and it will return that captured image as URI to the calling activity.

17

How to send an email in android through code? What is the correct intent to send an email?

  • Intent in = new Intent(Intent.ACTION_SEND);
    in.setType("message/rfc822");
    in.putExtra(Intent.EXTRA_EMAIL, new String[]{"user@gmail.com",
    "more@gmail.com"});
    in.putExtra(Intent.EXTRA_SUBJECT, "Hey imp!");
    in.putExtra(Intent.EXTRA_TEXT, "WHAT ARE YOU DOING?");
    startActivity(Intent.createChooser(in, "Select one option"));
  • Intent in = new Intent(Intent.ACTION_SEND_MAIL);
    in.setType("message/rfc822");
    in.putExtra(Intent.EXTRA_EMAIL, new String[]{"user@gmail.com",
    "more@gmail.com"});
    in.putExtra(Intent.EXTRA_SUBJECT, "Hey imp!");
    in.putExtra(Intent.EXTRA_TEXT, "WHAT ARE YOU DOING?");
    startActivity(Intent.createChooser(in, "Select one option"));
  • Intent in = new Intent(Intent.ACTION_SEND);
    in.setType("*/*");
    in.putExtra(Intent.EXTRA_EMAIL, new String[]{"user@gmail.com",
    "more@gmail.com"});
    in.putExtra(Intent.EXTRA_SUBJECT, "Hey imp!");
    in.putExtra(Intent.EXTRA_TEXT, "WHAT ARE YOU DOING?");
    startActivity(Intent.createChooser(in, "Select one option"));
  • Intent in = new Intent(Intent.ACTION_SEND_MAIL);
    in.setType("*/*");
    in.putExtra(Intent.EXTRA_EMAIL, new String[]{"user@gmail.com",
    "more@gmail.com"});
    in.putExtra(Intent.EXTRA_SUBJECT, "Hey imp!");
    in.putExtra(Intent.EXTRA_TEXT, "WHAT ARE YOU DOING?");
    startActivity(Intent.createChooser(in, "Select one option"));

Answer: A Intent in = new Intent(Intent.ACTION_SEND);
in.setType("message/rfc822");
in.putExtra(Intent.EXTRA_EMAIL, new String[]{"user@gmail.com",
"more@gmail.com"});
in.putExtra(Intent.EXTRA_SUBJECT, "Hey imp!");
in.putExtra(Intent.EXTRA_TEXT, "WHAT ARE YOU DOING?");
startActivity(Intent.createChooser(in, "Select one option"));
Description: Intent in = new Intent(Intent.ACTION_SEND);
in.setType("message/rfc822"); //this is MIME type of email
in.putExtra(Intent.EXTRA_EMAIL, new String[]{"user@gmail.com",
"more@gmail.com"}); // to address field
in.putExtra(Intent.EXTRA_SUBJECT, "Hey imp!"); //subject of your mail
in.putExtra(Intent.EXTRA_TEXT, "WHAT ARE YOU DOING?"); //body of your email
startActivity(Intent.createChooser(in, "Select one option"));

18

what is the priority of an empty process in android?

  • empty process(5)
  • service process priority (4)
  • foreground process(1)
  • service process priority (3)

Answer: D service process priority (3)
Description: Empty process is priority 5. that is last priority (least priority).
Note: in case of low memory scenarios, android will start killing from empty processes.

19

How to access shared preference file of one application from other application?

  • By using getPreferences(MODE_PRIVATE);
  • By using getPreferences(MODE_WORLD_READABLE);
  • By using getSharedPreferences("name",MODE_WORLD_READABLE);
  • No, it is not possible.

Answer: C By using getSharedPreferences("name",MODE_WORLD_READABLE);
Description: Either we can use
getSharedPreferences("name",MODE_WORLD_READABLE); or getSharedPreferences("name",MODE_WORLD_WRITABLE);
Note: But accessing or sharing preference file to outside world is deprecated with recent versions. so it is no more supported. But in older versions you can use above mentioned flags to share a preference file with outside world applications.

20

What is the difference between this context and getapplicationcontext ?

  • i. If the control or variable you are creating should belong to application level then use applicationContext.
  • ii. If the control or variable you are creating should belong to Activity level then use this pointer..
  • iii. If this is not available, still we can get activity context by specifying ActivityName.this.
  • i & ii
  • ii & iii
  • iii
  • i, ii, & iii

Answer: D i, ii, & iii
Description: There are two types of contexts available in android to create any component.
1. this context (or) this pointer
2. application context
When programmer wants to create any component or control, then you have to use one of the contexts.
eg: TextView t = new TextView(this);
Here we are using this pointer (context).
eg: static TextView st = new TextView(getApplicationContext());
Here we are using application context, because it is a static variable whose life time will be through out application life time.
If you use this pointer here, then it will leak memory (memory wastage) of your activity.
When to use this & getapplicationcontext:
1.If the control or variable you are creating should belong to application level then use applicationContext.
2.If the control or variable you are creating should belong to Activity level then use this pointer or this context.
Note: Generally people will think that java will not have memory leaks. But if you don't use contexts properly, then it might lead to some dangerous memory leaks in your android application.
Tip : Don't ever link between this pointer and static variables. If you follow this simple tip, you can almost reduce most of your memory leaks in your program.