Professional Documents
Culture Documents
Mobile Applications Quiz 1 - Model Answer
Mobile Applications Quiz 1 - Model Answer
2- Which of the following virtual machine is used by the Android operating system?
a) JVM
b) Dalvik virtual machine
c) Simple virtual machine
d) None of the above
3- On which of the following, developers can test the application, during developing the android
applications?
a) Third-party emulators
b) Emulator included in Android SDK
c) Physical android phone
d) All of the them
5- Which of the following is the first callback method that is invoked by the system during an activity
life-cycle?
a) onClick() method
b) onCreate() method
c) onStart() method
d) onRestart() method
8- Which of the following android component displays the part of an activity on screen?
a) View
b) Manifest
c) Intent
d) Fragment
10- Which of the layer is below the down most layer of android architecture?
a) System Libraries and Android Runtime
b) Linux Kernel
c) Applications
d) Applications Framework
12- In which state the activity is, if it is not in focus, but still visible on the screen?
a) Stopped state
b) Destroyed state
c) Paused state
d) Running state
13- In Android studio, which of the following callback is called when an activity starts interacting with
the user?
a) onDestroy
b) onCreate
c) onResume
d) onStop
20- Which attribute is an identifier for a view so that it may later be retrieved using the
View.findViewById method?
a) id
b) X axis
c) Y axis
d) None
Implementation:
We have a user interface with a Button and an ImageView that displays an image representing a
lemon tree named “lemontree.png”. We are adding a listener to the button so that when the button is
clicked the image should change to a lemon as if we picked a lemon from the lemon tree, so the
ImageView will change the displayed picture to a picture named “lemon.png”.
Select the appropriate answers from the following to complete the class:
In the following code we are defining an ImageView.
1. <ImageView
2. android:id="@+id/image_view"
3. android:layout_width="wrap_content"
4. android:layout_height="wrap_content"
5. android:src=" ? " />
To load the image in the ImageView control (where the question mark is, line 5), we upload the photo
in the src as follows:
a) @drawable/lemon
b) @string/lemon
c) @values/lemon
d) Lemon.png
To change the image displayed in the ImageView control, we use the following statements:
1. ImageView imageView = findViewById(R.id.image_view);
2. imageView.setImageResource(image_source);
b) Submit_btn.setOnClickListener(this);
c) Submit_btn.setOnClickListener(onClick(View v){
//add action
});