Free AND-401 Exam Braindumps
Android Application Development Questions 91–95 (page: 20)

Updated On: 9-Feb-2026

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



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

  1. WebView webview = new WebView(this);
    webview.setAsWindow;
  2. setContentView(R.layout.webview);
  3. WebView webview = new WebView(this);
    setContentView(webview);
  4. setContentView(“http://www.androidatc.com”);

Answer(s): C



Consider the following the code:
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.game_menu, menu);
return true;
}
Which of the following is true about the code above?

  1. The code is auto generated and should not be edited
  2. This method handles clicks and assign actions to menu items
  3. This function inflates an XML file in the res/menu folder into menu items
  4. This method inflates an XML file in the res/layout folder into layout.

Answer(s): C



Consider the following AndroidManifest.xml file:

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

Supposing the application connects to the internet at startup, which of the following is true?

  1. The application throws an exception indicating it does not have permission to access the URL
  2. The application will work as intended
  3. The application won’t compile
  4. The application throws a java.lang.SecurityException

Answer(s): A

Explanation:

The program will compile, but then it will not be able to access the internet, as it does not have usespermission=” android.permission.INTERNET”



Viewing page 20 of 47
Viewing questions 96 - 100 out of 228 questions


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

AI Tutor AI Tutor 👋 I’m here to help!