Android quiz questions

Android interview questions

  • 1.

    Which of the following is NOT true about onMeasure() method of class View?

    1. When overriding this method, a developer must call setMeasuredDimension().

    2. It is invoked by measure().

    3. It measures the view and its contents to determine the measured width and height.

    4. It takes three parameters: the height, width, and the depth of the view.

    Answer
  • 2.

    To create a customized Adapter for a compound list item layout, you should:

    1. Extend class android.widget.ListView or any of its descendants, then override method getView()

    2. Extend class android.widget.AbsAdapter or any of its descendants, then override method getView()

    3. Extend class android.widget.Adapter or any of its descendants then override method getView()

    4. Extend class android.widget.Adapter or any of its descendants, then override method getAdapterView()

    Answer
  • 3.

    Which of the following is NOT true about the SharedPreferences interface?

    1. Modifications to preferences saved should go through class SharedPreferences.Editor

    2. It only saves primitive data in key-value pairs.

    3. The data it saves is persistent even if application is killed.

    4. It can save any data type in key-value pairs.

    Answer
  • 4.

    What two methods you have to override when implementing Android option menus?

    1. onCreateOptionsMenu, onOptionsltemSelected

    2. onCreateOptionsMenu, onContextItemSelected

    3. onCreateOptionsMenu, onCreateContextMenu

    4. onCreateContextMenu, onContextItemSelected

    Answer
  • 5.

    What does the following code do?

    dialog.getWindow().setFlags(LayoutParams.FLAG_BLUR_BEHIND, LayoutParams.FLAG_BLUR_BEHIND);

     

    1. Any EditText behind the dialog will be disabled.

    2. When dialog is displayed the activity behind it will be dimmed.

    3. When dialog is displayed the activity behind it will be blurred.

    4. When the dialog is displayed, the edges of the dialog will be blurred.

    Answer
  • 6.

    What Activity method you use to retrieve a reference to an Android view by using the id attribute of a resource XML?

    1. retrieveResourceByld(int id)

    2. findViewByReference(int id)

    3. findViewById(int id)

    4. findViewByld(String id)

    Answer
  • 7.

    Which UI does the following code builds?

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmins: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 right of a text view and a button beneath them

    2. An edit text to the right of a text view and a button to the right of the text view

    3. A text view, an edit text beneath it and the button beneath the edit text

    4. An edit text to the left of a text view and a button beneath it

    Answer
  • 8.

    Which of the following is not an Activity lifecycle call-back method?

    1. onStart

    2. onPause

    3. onBackPressed

    4. onCreate

    Answer
  • 9.

    How to enable JavaScript in WebView?

    1. JavaScript is always enabled in WebView

    2. myWebView.getSettings().setJavaScriptEnabled(true);

    3. myWebView.SetJavaScriptEnabled(true);

    4. myWebView.getJavaScriptSettings.setFinabled(true);

    Answer
  • 10.

    Which manifest file permission you should add to allow your application to read the device's address book?

    1. READ_PHONE_STATE

    2. READ_ADDRESS_DATA

    3. READ_CONTACTS

    4. READ_PHONE_CONTACTS

    Answer
  • 11.

    Which of the following lines of code starts activity Activity2 from a current activity Activity1?

    1. Intent intent = new intent(this,Activity2.class);
      startActivity(intent);

    2. Intent intent = new Intent(new Activity2());
      startActivity(intent);

    3. intent intent = new Intent (Activity1.class, Activity2.class);
      startActivity(intent);

    4. Intent intent = new intent(this, new Activity2());
      startActivity(intent);

    Answer
  • 12.

    During an Activity life-cycle, what is the first callback method invoked by the system?

    1. onStart()

    2. onCreate()

    3. onRestore()

    4. onStop()

    Answer
  • 13.

    Which of the following is the correct way to add access permission to your application?

    1. Add a <uses-permission> tag as a child tag of the <application> tag in AndroidManifest.xml.

    2. Add a <add-permission> tag as a child tag of the <manifest> tag in AndroidManifest.xml.

    3. Add a <uses-permission> tag as a child tag of the <manifest> tag in AndroidManifest.xml.

    4. Add a <permission> tag as a child tag of the <application> tag in AndroidManifest.xml.

    Answer
  • 14.

    Which of the following sets the entire Activity window as a WebView?

    1. setContentView(R.layout.webview);

    2. WebView webview = new WebView(this);
      Webview.setAsWindow;

    3. setContentView(“http://www.androidatc.com”);

    4. WebView webview = new WebView(this);
      setContentView(webview);

    Answer
  • 15.

    Which of the following is correct about file access in the Android system?

    1. The content of file created by application cannot be accessed by any other application.

    2. Generally, files are handled as dedicated resources per each application

    3. You can only access a file from within an Activity.

    4. Files created by an application can be directly accessed by any application.

    Answer
  • 16.

    What is not true about the AndroidManifest.xml file?

    1. It declares the views used within the application

    2. It declares hardware and software features used within the application

    3. It declares application components

    4. It declares user permissions the application requires

    Answer
  • 17.

    Which of the following is incorrect about intents?

    1. They can be used to start a service

    2. They can be used to start a dialog-themed activity.

    3. They can be used to start an Activity

    4. They can be used to start database insertion

    Answer
  • 18.

    Which of the following statements about DDMS is incorrect?

    1. You can use it to acquire screenshots of a terminal.

    2. You can forcibly execute garbage collection and check the present heap usage status.

    3. You can do simulations of network zone speed and bandwidth limitations.

    4. You can display a list of currently running threads and select one to check its stack trace.

    Answer
  • 19.

    What Eclipse plugin is required to develop Android application?

    1. Android Development Tools

    2. Android Software Development Kit

    3. J2EE

    4. Web Development Tools

    Answer
  • 20.

    Which of these is the correct explanation regarding the following methods?
    (1)android.content.Context.sendBroadcast
    (2)android.content.Context.startActivity

    1. Both methods are asynchronous.

    2. Both methods throw an exception.

    3. Both methods are defined by overloading.

    4. Both methods are able to broadcast an Intent.

    Answer

© 2017 QuizBucket.org