0

Android App Development Test - 1

Description: Android App Development Test-1
Number of Questions: 15
Created by:
Tags: Android App Development Test-1 Android
Attempted 0/14 Correct 0 Score 0

Suppose if we want to create an application of calculator, what type of layout is suitable?

  1. Framelayout

  2. Gridlayout

  3. Tablelayout

  4. Relativelayout


Correct Option: C
Explanation:

Tablelayout is best for creating the calculator application due to tabular view of the number and operators.

Android will place views on the left side of the screen. To change this, we use the _____________ attribute.

  1. Layout_gravity

  2. Gravity

  3. Alignment

  4. Gravity_layout


Correct Option: B
Explanation:

Android will place views on the left side of the screen. To change this, we use the gravity attribute.

Which of the following is correct for relativelayout?

  1. The child views of a relative layout are arranged in the order they are declared.

  2. There is a circular dependency in a relative layout.

  3. We can set the width of the Relativelayout to wrap_content.

  4. We can set the height of the Relativelayout to wrap_content.


Correct Option: A
Explanation:

The child views of a relative layout are arranged in the order they are declared. We cannot have a circular dependency in a Relativelayout. Also we cannot set the width of the RelativeLayout to wrap_content.

Which one of the following is not a layout container of Android?

  1. FrameLayout

  2. TableLayout

  3. LinearLayout

  4. CardLayout


Correct Option: D
Explanation:

CardLayout is not a layout of Android. The layout container of Androids are:

1. Frame Layout
2. Table Layout
3. Linear Layout
4. Relative Layout 5. Grid Layout

Which of the following statements is/are true for ListView? A. android.R.layout.simple_list_item_1 is used to display a single line of text in a row of ListView. B. Android.R.layout.two_line_list_item displays two lines of text per row of a list.

  1. Only A

  2. Only B

  3. Both A and B

  4. Neither A nor B


Correct Option: C
Explanation:

Here are two that we could use with a ListView:

android.R.layout.simple_list_item_1 is used to display a single line of text in a row of ListView. Android.R.layout.two_line_list_item displays two lines of text per row of a list.

GridLayout makes it easier to create a common “dashboard”-style UI seen in apps like Google+. We normally create such a UI using a Tablelayout, but GridLayout allows us to create the same layout with a ________________.

  1. same hierarchy

  2. ladder hierarchy

  3. flatter hierarchy

  4. bottom-top hierarchy


Correct Option: C
Explanation:

GridLayout makes it easier to create a common “dashboard”-style UI seen in apps like Google+. We normally create such a UI using a Tablelayout, but GridLayout allows us to create the same layout with a flatter hierarchy.

Which of the following attributes is used when we have a static unchanging list of values to populate the list view?

  1. Static

  2. Constant

  3. Entries

  4. Entry


Correct Option: C
Explanation:

Android:entries attribute is used when we have a static, unchanging list of values to populate the list view.

Which of the following classes is used to simplify the process of loading the data and is available to all versions of Android through the compatibility package?

  1. Load

  2. Loader

  3. DataLoader

  4. DataLoad


Correct Option: B
Explanation:

Loader class is used to simplify the process of loading the data. This is available in Android 3 and above. But this class is available to all versions of Android through the compatibility package.

____________ populate the elements of a ________ based on some internal data storage.

  1. ListAdapters and ListView

  2. ListView and ListAdapters

  3. LayoutInflater and ListView

  4. ListView and LayoutInflater


Correct Option: A
Explanation:

ListAdapters populate the elements of a ListView based on some internal data storage.

If you created an email application, any text entered by the user should be saved to your database during ______ callback.

  1. onCreate

  2. onPause

  3. onStop

  4. onResume


Correct Option: B
Explanation:

If you created an email application, any text entered by the user should be saved to your database during onPause callback. During this your activity is still visible, but it is no longer focused.

Which of the following codes is added to XML file for vertical linear layout?

  1. <Linearlayout android:layout_height=”wrap content” android:layout_width=”match parent” android:layout_orientation=”horizontal”>

  2. <Linearlayout android:layout_height=”wrap content” android:layout_width=”match parent” android:orientation=”vertical”>

  3. <Linearlayout android:layout_height=”wrap content” android:layout_width=”match parent” android:orientation=0>

  4. <Linearlayout android:layout_height=”wrap content” android:layout_width=”match parent” android:orientations=”horizontal”>


Correct Option: B
Explanation:

<Linearlayout android:layout_height=”wrap content”

   android:layout_width=”match parent”

   android:orientation=”vertical”> The above code is correct code to set vertical Linearlayout.

Which of the following things should be remembered about activities? A. The system will aggressively destroy your activity when it’s not visible to the user. B. As all the callbacks run on the main thread, so you should not perform any long-running or computationally expensive operations in those callbacks.

  1. Only A

  2. Only B

  3. Both A and B

  4. Neither A nor B


Correct Option: C
Explanation:

Option (3) is correct.

Which of the following functions are used in Activity Life Cycle of Android?

  1. onCreate(), onStart(), onResume(), onPause(), onStop().

  2. onCreate(), onStart(), onResume(), onStop(), onDestroy().

  3. onCreate(), onResume(), onPause(), onStop(), nDestroy().

  4. onCreate(), onStart(), onResume(), onPause(), onStop(), onDestroy().


Correct Option: D
Explanation:

There are six functions are used in Activity Life Cycle of Android:

onCreate()
onStart()
onResume()
onPause()
onStop() onDestroy().

Which of the following APIs are not used to handle exception when we try to update the UI from one of our worker threads?

  1. The Activity.runOnUiThread method

  2. The View.post, View.postDelayed and View.postInValidate methods

  3. The AsyncTask class

  4. SyncTask class


Correct Option: D
Explanation:

All the APIs are used to handle exception when we try to update the UI from one of our worker threads except SyncTask because there is no such class.

- Hide questions