This section presents you various set of Mock Tests related to Android. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
Fragment is a peace of an activity. If you want to move your application in 360 degrees, you can do this by using a fragment.
Q 2 - Fragment in Android can be found through
Using FragmentManager.findFragmentByID(R.id.fragment), we can find the fragment/fragments which are placed on the layout
According to the Google documentation, Android supports 4 types of orientations, those are landscape, portrait, sensor and No orientation
Q 4 - What is fragment life cycle in android?
C - onAttach()->onCreate() −> onCreateView() −> onActivityCreated() −> onStart() −> onResume()
Fragment life cycle is as shown below −
onAttach() OnCreate() onCreateView() onActivityCreated() onStart() onResume() onPause() onStop() onDestroyView() onDestroy() onDetach()
Q 5 - What is sandbox in android?
A - Each application runs securely in sandbox without interrupting another process
Each application runs securely in sandbox without interrupting another process. If an application is running in a sandbox, outside application can't touch sandbox application
Q 6 - How many levels of securities are there in android?
Android is having two levels of securities, they are as App level security and kernel level security
Q 7 - How many protection levels are available in the android permission tag?
A - There are no permission tags available in android
B - Normal, kernel, application
Android is having four levels of protection in android permission tag. They are normal, dangerous, signature, and signatureOrsystem
Q 8 - What is the purpose of super.onCreate() in android?
B - To create a graphical window for subclass
The super.onCreate() will create the graphical window for subclasses and place at onCreate() method.
Q 9 - Is it mandatory to call onCreate() and onStart() in android?
A - No, we can write the program without writing onCreate() and onStart()
B - Yes, we should call onCreate() and onStart() to write the program
It is not mandatory, the program will work perfectly without fail, but the programmer has to implement the life cycle of activity.
Q 10 - Is it possible activity without UI in android?
Without UI, we can call an activity, It will do some background functionalities.
Q 11 -What are return types of startActivityForResult() in android?
strartActivityforResult() returns RESULT_OK and RESULT_CANCEL.
ANR responding time is 5 sec. If an application is not responding within 5 sec, ANR will occur
Q 13 - What is transient data in android?
Transient data is logical data and we can store application logic in it.
Q 14 - Why don't we give MIN SDK as 1 in android?
A - Android deprecated version
Android version 2.2 is deprecated so we don't need to call MIN version to be 1
Q 15 - What are commands needed to create APK in android?
A - No need to write any commands
B - Create apk_android in command line
Using with Javac, we can compile Java files
Use dx tool to convert all Java class files to single dex file
Use AAPT tool to create apk file
Sign the apk file by using jar signer
Zipalign of signed apk
Q 16 - How do you join two notifications in android?
A - Give same id for both notifications
B - Write notification code two times
Give same id for both notifications.
nm.notify(1,notification);
Q 17 - What is the main difference between set and list in android?
B - Set can't contain duplicate values
Set can't contain duplicate values. Examples of set are hashset,treeset and linked hash set
The list contains duplicate values. Example of list is linked list and array list
Q 18 - What is an interface in android?
A - Interface acts as a bridge between class and the outside world.
The Interface acts as a bridge between class and the outside world. Interface contains method declaration, nested types, and constants.
Q 19 - What is anchor view?
B - provides the information on respective relative positions
Anchor View provides the information on respective relative positions of views.
Q 20 - What is the life cycle of foreground activity in android?
A - onCreate() −> onStart() −> onResume() −> onStop() −> onRestart
B - onCreate() −> onStart() −> onResume() −>onStop()
Foreground activity should be onCreate() −> onStart() −> onResume() in activity life cycle.
Q 21 - Can a class be immutable in android?
B - Yes, Class can be immutable
Class can be immutable.
Q 22 - What is a thread in android?
The concurrent executable unit is called a thread. It's performs some background functionalities with services.
Q 23 - What are the main components in android?
The main components in android are Activity, services, Broadcast Receiver and content providers.
Q 24 - What is bean class in android?
A - A class used to hold states and objects
B - A bean class can be passed from one activity to another.
Bean class can hold other states and objects. It contains all fields which are private with setter and getter.
Q 25 - What is off-line synchronization in android?
A - Synchronization with internet
B - Background synchronization
Synchronization without internet in which we can take the application data without internet.
Question Number | Answer Key |
---|---|
1 | B |
2 | D |
3 | A |
4 | C |
5 | A |
6 | A |
7 | C |
8 | B |
9 | A |
10 | B |
11 | D |
12 | B |
13 | D |
14 | A |
15 | C |
16 | D |
17 | D |
18 | A |
19 | B |
20 | C |
21 | B |
22 | D |
23 | A |
24 | B |
25 | C |