Sapient Company Programming Database

Which of the following statements is/are correct about Application Object?

A. The application object is created whenever an Android component starts.
B. The application object starts in a new process with a unique ID under a unique user.
C. The application obejct starts before any components and runs at least as long as another component of the application runs.

1) A, B and C
2) B and C
3) Only A
4) Only C

Read Solution (Total 1)

Sapient Other Question

Following is the list of Activity Lifecycle methods along with the next method that can be invoked in the Activity Lifecycle. Which of the following options is/are correct?

1) onCreate() --> onStart()
2) onRestart() --> onStart()
3) onDestroy() --> No method is called
4) All of the given options
The following code snippet will create a new alarm in Android. In order to invoke the ACTION_SET_ALARM intent, your app must have the SET_ALARM permission. Which of the followinig options correctly sets the SET_ALARM permission?

public void createAlarm(String message, int hour, int minutes){
Intent intent = new Intent(AlarmClock.ACTION_SET_ALARM)
.putExtra(AlarmClock.EXTRA_MESSAGE, message)
.putExtra(AlarmClock.EXTRA_HOUR, hour)
.putExtra(AlarmClock.EXTRA_MINUTES, minutes);

if(intent.resolveActivity(getPackageManager()) != null){
startActivity(intent);
}
}

1)
2)
3)