Android Programming Quiz # 10

Instructions
Quiz: Android Programming Quiz # 10
Subject: Basic Android Programming
Total Questions: 30 MCQs
Time: 30 Minutes

Note

  • Do not refresh the page while taking the test.
  • Results along with correct answers will be shown at the end of the test.
Android Programming Quiz # 10
Question 1 of 30
00:00
  • When creating main Android App project with Android studio, how can we support localization of the Android App?

  • What does A() function do? private void A() { B(getActivity(), "com.app.package.here"); } public void B(Context context, String packageN) { Intent i = context.getPackageManager().getLaunchIntentForPackage(packageN); if (i == null) { i.addCategory(Intent.CATEGORY_LAUNCHER); context.startActivity(i); } else { try { context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + packageN))); } catch (android.content.ActivityNotFoundException anfe) { context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + packageN))); } } }

  • An Intent object is a bundle of information and what are the object contains?

  • What does the following code do? Calendar cal = Calendar.getInstance(); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); cal.add(Calendar.DATE, -1); return dateFormat.format(cal.getTime());

  • What is the output if following code executed? Values/google_maps_api.xml google_maps_key (key from https://console.developers.google.com/) AndroidManifest.xml <meta-data android:name="com.google.android.geo.API_KEY" android:value="@string/google_maps_key" /> Build.gradle(Module: app) Dependencies{ … Compile ‘com.google.android.gms:play-services:8.4.0’ }

  • What is the output if following code executed? public int pxToDp(int px) { DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics(); int dp = Math.round(px / (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); return dp; } public int dpToPx(int dp) { DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics(); int px = Math.round(dp * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); return px; }

  • After building an Android project with Android Studio, what is the purpose of generating R.java as follows?  package com.intelstar.venus; public final class R {      public static final class attr {      }      public static final class drawable {          public static final int icon=0x7f020000;      }      public static final class layout {          public static final int main=0x7f030000;      }      public static final class string {          public static final int app_name=0x7f040000;      } }

  • If you are going to check a network connection with the below source code, what would be required to make it work? public boolean isOnline() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); if (netInfo != null && netInfo.isConnectedOrConnecting()) return true; return false; }

  • What is the output if following code executed? final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); final List pkgAppsList = getPackageManager().queryIntentActivities(mainIntent, 0); for (Object object : pkgAppsList) { ResolveInfo info = (ResolveInfo) object; File file = new File(info.activityInfo.applicationInfo.publicSourceDir); // … }

  • Which of the following common design patterns are used in Android?

  • Following methods called during the life cycle of an android activity are?

  • Which of the following are possible states of a process?

  • Android Architecture is consisted of the following components?

  • Which of the following ADT generates a debug certificate automatically for emulator and device?

  • How to show option menu using the following source on Samsung phone but cannot see it. How to fix it? try { ViewConfigurationconfig = ViewConfiguration.get(this); Field menuKeyField = ViewConfiguration.class .getDeclaredField("sHasPermanentMenuKey"); if (menuKeyField != null) { menuKeyField.setAccessible(true); menuKeyField.setBoolean(config, false); } } catch (Exception e) { e.printStackTrace(); }

  • What does mean by the following XML code?

    AndroidManifest.xml

    <application android:label=»@string/app_name» android:icon=»@drawable/icon»

    android:name=»com.intel.starApp»> … ….

    <meta-data android:name=»DATABASE» android:value=» example.db»>

    <meta-data android:name=»VERSION» android:value=»2″>

    <meta-data android:name=»QUERY_LOG» android:value=»true»>

    </meta-data></meta-data></meta-data>

     

  • What does the following code output? public class XYZ extends AsyncTask { @Override protected String doInBackground(String... params) { PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); final WakeLockwl = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK |PowerManager.ACQUIRE_CAUSES_WAKEUP |PowerManager.ON_AFTER_RELEASE, ""); wl.acquire(); return "Executed"; } @Override protected void onPostExecute(String result) {} }

  • Which of the following data types does AIDL support?

  • The 'showAsAction' attribute of in a menu resource file can have which of the following values? Check all that apply.

  • Which file contains information about the app?

  • Which statement correctly assigns the id to textView element in layout file?

  • AndroidMainfest.xml file contains the following essential information about your app: (choose all that apply)

  • The strings.xml has a _________ element, which contains one or more elements.

  • A layout can retrieve the value of the String named 'stringmessage' using `____`.

  • The best practice is to put string values in _________ file.

  • Buttons and text views both inherit from the same Android class named _____.

  • If the intent has extra integer information passed to it with a name of "message", we can retrieve that information using which of the following?

  • When publishing updates to an app on the Google Play Store, which of the following are true?

  • Which of the following correctly adds a string array resource to strings.xml?

  • Which of the following are true?

Android Programming Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

Android Programming Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it