Hi guys,


I have a android quiz(1 days time) and my friend gave me some question to work on but he forgot the answers.. I tried to refer to android developers page but not sure my answers are right... Can some guide me .. Really appreciate if someone can help me with this. Thanks!!


Q1. Which of the following statement is TRUE? (Select one or more answers)

1. Shared Preferences stores private primitive data in key-value pairs
2. OnSharedPreferenceChangeListener is used to capture SharedPreference key-value changed
3. SharedPreference.registeredOnSharedPreferenceChangeListener methode is used to initiate listener to capture change event
4. Shared Preferences data stored is temporary. It will be cleared whenever the app is launched again

My answer: 1 & 2


Q2. Which of the following statement is TRUE? (Select one or more answers)
1. CREATE TABLE info (_id INTEGER PRIMARY KEY AUTOINCREMENT,Firstname TEXT, Lastname TEXT);
2. SELECT _id, Firstname, Lastname FROM info ORDER BY Firstname

1. Line 1 - A new table named "info" is created
2. Line 1 – The fields created in the table are “_id”, “Firstname” and “Lastname” field
3. Line 2 – Retrieve all records from info table and sort by “Firstname” field
4. Line 2 – To number of “_id” field increase automatically whenever a new record is added

My answer: 1, 2 & 3


Q3. Which of the following statement is TRUE? (Select one or more answers)

1. ArrayAdapter is used to handle ArrayList
2. CursorAdapter is used to handle database
3. CursorAdapter use bindView() method to recycle row in LIstView
4. ArrayAdapter uses getView() method to recycle row in ListView

My answer: 2 & 3


Q4. Which of the following statements is(are) TRUE? (Select one or more answers)
Intent i = new Intent(RestaurantList.this, DetailForm.class);
i.putExtra(ID_EXTRA, String.valueOf(id));
startActivity(i);

1. This is an Implicit Intent
2. Line 1 - The Intent call to RestaurantList activity
3. Line 2 - The value of “id” will be passed to
4. Line 3 – Execute the DetailForm activity

My answer: 2 & 3

Q5. Which of the following statement is TRUE about the manifest file given below? (Select one or more answers)

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="testingapp.com"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".Activity2"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Activity1">
</activity>
</application>
</manifest>


1. There are two activities in the app
2. The app icon’s name is “ic_launcher”
3. the app's name is "app_name"
4. Activity1 will start when the app is first launched

My answer: 1 & 2

Q6. Which of the following statement is TRUE? (Select one or more answers)

1. public void onCreate(Bundle savedInstanceState) {
2. super.onCreate(savedInstanceState);
3. setContentView(R.layout.main);
4. helper = new TestAppHelper(this);
5. prefs = PreferenceManager.getDefaultSharedPreferences(this);
6 initList();
7. prefs.registerOnSharedPreferenceChangeListener(prefListener);
8.}


1. Line 3 - LoadsUI View with the layout defined by main.xml
2. Line 4 - create a new SQLiteOpenHelper object
3. Line 5 - get a SharedPreferences object which points to the default file that is used by the preference framework in the given activity
4. Line 7 - activate the SharedPreferences change listener

My answer: I have no idea