Free AND-401 Exam Braindumps (page: 24)

Page 23 of 58

Which of these is the incorrect method for an Application to save local data?

  1. Extend PreferencesActivity and save in an XML file.
  2. Save as a file in the local file system.
  3. Save in the database using SQLite.
  4. Save in the hash table file using the Dictionary class.

Answer(s): D

Explanation:

Incorrect:
B: You can save files directly on the device's internal storage.
C: Android provides full support for SQLite databases. Any databases you create will be accessible by name to any class in the application, but not outside the application. Reference:
http://developer.android.com/guide/topics/data/data-storage.html



Which UI does the following code builds?

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android=http:// schemas.android.com/apk/res/android
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name:" />
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10" />
</LinearLayout>
<Button android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Post" />
</LinearLayout>

  1. An edit text to the left of a text view and a button beneath it
  2. An edit text to the right of a text view and a button to the right of the text view
  3. An edit text to the right of a text view and a button beneath them
  4. A text view, an edit text beneath it and the button beneath the edit text

Answer(s): C



Consider the following code:
Intent i = new Intent(this, MainActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);

What best explains the code above?

  1. The activity being launched is already running in the current task, then instead of launching a new instance of that activity, all of the other activities on top of it will be closed and this Intent will be delivered to the (now on top) old activity as a new Intent.
  2. Any existing task that would be associated with the activity to be cleared before the activity is started.
  3. A new Activity will be launched and it will be on the top of the stack
  4. A new activity will be launched but will be in full-screen mode.

Answer(s): A



Which of the following lines of code is used to pass a value to the next activity?

  1. Intent i = new Intent(this,newActivity); i.addExtra(“test”);
    startActivity(i);
  2. Intent i = new Intent(this,newActivity); i.putValue(“test”);
    startActivity(i);
  3. Intent i = new Intent(this,newActivity); i.putValue(“value1”,“test”);
    startActivity(i);
  4. Intent i = new Intent(this,newActivity); i.putExtra(“value1”,“test”);
    startActivity(i);

Answer(s): D






Post your Comments and Discuss Android AND-401 exam with other Community members: