Options
1) It a component of android which responds to system wide broadcast announcements.
2) It acts like a gateway between outside world and your application.
3) both are true
4)none
How to avoid synchronization problems in threads?
Options
1) Use synchronized block
2) Use Synchronized methods
3) Use synchronized threads
4) both option 1 and 2 is right.
What is the difference between task, process, application, and thread?
Options
1) task, process, and application every thing is same, but thread is a part of process.
2) process and application are same. Task may contain 1 or more applications, thread is an internal part of a process created by OS.
3) process and task are same. application means program, thread is part of task.
4)process and thread are same. similarly application and thread are same.
How to pass data from activity to service?
Options
1) pass data in intent-putextras, and using setResult()
2) pass data in intent-putextras, and say startService() with that intent
3) store it in common database and access it through both activity and service.
4) can be done using both the ways 2 and 3 options.
Is it possible to have a service with multiple threads in it? How to achieve this?
Options
1) you can't have more than one thread in a service.
2) you can create multiple threads in a service
3) option 2 is possible by creating thread in onCreate()
4) option 2 is possible by creating thread in onStartCommand() of your service class.
How to update UI from a service that has threads?
Options
1) Create a thread in the Service class and directly access UI components of your activity
2) Since updating UI from other thread directly is not possible, communicate with Main UI thread for the UI updates
3) Use Intent Service
4) Either use option 1 or option 2
How to create a service with multiple threads in it?
Options
1) Create a service with creating thread in onStartCommand
2) Use Intent Service
3) Create a service with one thread in OnCreate().
4) Either use option1 or use Async task with service
start a service from activity and close activity, what will happen to that service, will it be alive or dead?
Options
1) service will also be killed
2) service will be alive for some time, and will be killed by android garbage collector.
3) service will run for ever, no body can stop it now, and it leaks memory.
4) service will be keep running in the background but it can stop itself when the work given to it is done. Or others also can kill that service using stopService(), or android also can kill the service forcefully in case of low memory scenarios.
What does the flag FLAG_ACTIVITY_SINGLE_INSTANCE do here?
Intent i = new Intent();
i.setAction("com.android.MYACTION");
i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_INSTANCE);
startActivity(i);
Options
1) It will start a new activity with matching intent filter, in a new task always.
2) It will start a new activity with matching intent filter, in a new task only if that corresponding task is not in memory now.
3) It will start a new activity with matching intent filter, in old task always. here old task means task in which the current activity is running which has started new activity.
4) This will start new activity in a new task, where only this activity will be there in that task and no other components. if at all new components are launched from this new activity, they will be launched in a different task.
With Mathematics you are Hero, without Mathematics you are Zero.
Piyush Pallaw
"The gaming of numbers is called maths.So participate in this wonderful game and explore in it,learn in it and enjoy in it.Then only you can pass in this wonderful game."