Exam Details

  • Exam Code
    :ASSOCIATE-ANDROID-DEVELOPER
  • Exam Name
    :Google Developers Certification - Associate Android Developer (Kotlin and Java Exam)
  • Certification
    :Google Certifications
  • Vendor
    :Google
  • Total Questions
    :128 Q&As
  • Last Updated
    :May 03, 2024

Google Google Certifications ASSOCIATE-ANDROID-DEVELOPER Questions & Answers

  • Question 41:

    In Android 8.0, API level 26, some APIs regarding notification behaviors were moved from Notification to NotificationChannel. For example, what should we use instead of NotificationCompat.Builder.setPriority() for Android 8.0 and higher?

    A. NotificationChannel.setPriority()

    B. NotificationChannel.setImportance()

    C. NotificationCompat.Builder.setImportance()

  • Question 42:

    What do you want from Room when you create a DAO method and annotate it with @Delete?

    Example:

    @Dao

    public interface MyDao {

    @Delete

    public void deleteUsers(User... users);}

    A. Room generates an implementation that inserts all parameters into the database in a single transaction.

    B. Room modifies a set of entities, given as parameters, in the database. It uses a query that matches against the primary key of each entity.

    C. Room removes a set of entities, given as parameters, from the database. It uses the primary keys to find the entities to delete.

  • Question 43:

    What do you want from Room when you create a DAO method and annotate it with @Update?

    Example:

    @Dao

    public interface MyDao {

    @Update

    public void updateUsers(User... users);}

    A. Room generates an implementation that inserts all parameters into the database in a single transaction.

    B. Room modifies a set of entities, given as parameters, in the database. It uses a query that matches against the primary key of each entity.

    C. Room removes a set of entities, given as parameters, from the database. It uses the primary keys to find the entities to delete.

  • Question 44:

    What happens when you create a DAO method and annotate it with @Insert?

    Example:

    @Dao

    public interface MyDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)

    public void insertUsers(User... users);}

    A. Room generates an implementation that inserts all parameters into the database in a single transaction.

    B. Room modifies a set of entities, given as parameters, in the database. It uses a query that matches against the primary key of each entity.

    C. Room removes a set of entities, given as parameters, from the database. It uses the primary keys to find the entities to delete.

  • Question 45:

    What is demonstrated by the code below?

    // RawDao.java@Daointerface RawDao {

    @RawQuery

    User getUserViaQuery(SupportSQLiteQuery query);}

    // Usage of RawDao

    ...

    SimpleSQLiteQuery query =

    new SimpleSQLiteQuery("SELECT * FROM User WHERE id = ? LIMIT 1",

    new Object[]{userId});User user = rawDao.getUserViaQuery(query); ...

    A. A method in a Dao annotated class as a raw query method where you can pass the query as a SupportSQLiteQuery.

    B. A method in a Dao annotated class as a query method.

    C. A method in a RoomDatabase class as a query method.

  • Question 46:

    An example. In our ViewModelFactory(that implements ViewModelProvider.Factory) we have an instance of our Repository, named mRepository. Our ViewModel has such constructor:

    public MyViewModel(MyRepository myRepository)...

    Next, in our ViewModelFactory create ViewModel method (overriden) looks like this:

    @NonNull @Override public T create(@NonNull Class modelClass) {

    try {

    //MISSED RETURN VALUE HERE

    } catch (InstantiationException | IllegalAccessException |

    NoSuchMethodException | InvocationTargetException e) {

    throw new RuntimeException("Cannot create an instance of " + modelClass, e);

    }

    }

    What should we write instead of “//MISSED RETURN VALUE HERE”?

    A. return modelClass.getConstructor().newInstance(mRepository);

    B. return modelClass.getConstructor(MyRepository.class).newInstance();

    C. return modelClass.getConstructor(MyRepository.class).newInstance(mRepository);

  • Question 47:

    For example, we have a file in our assets folder app/src/main/assets/sample_teas.json. To get an InputStream for reading it, from out Context context, we can try doing this:

    A. InputStream input = context.getResources().openRawResource (R.raw.sample_teas);

    B. InputStream input = context.getAssets().open("sample_teas.json");

    C. InputStream input = context.getResources().getAssets().open ("sample_teas.json");

  • Question 48:

    For example, we have a BufferedReader reader, associated with the json file through InputStreamReader. To get a file data we can do this:

    A. String line;try {while ((line = reader.readLine()) != null) {

    builder.append(line);

    }

    JSONObject json = new JSONObject(builder.toString());

    return json;

    } catch (IOException | JSONException exception) {

    exception.printStackTrace();

    }

    B. JSONObject line;try {while ((line = reader.readJSONObject ()) != null) {

    builder.append(line);

    }

    JSONObject json = new JSONObject(builder.toString());

    return json;

    } catch (IOException | JSONException exception) {

    exception.printStackTrace();

    }

    C. String line;try {while ((line = reader.readLine()) != null) {

    builder.append(line);

    }

    JSONObject json = new JSONObject(builder.toString());

    return json;

    } catch (RuntimeException|ArrayIndexOutOfBoundsException exception) {

    exception.printStackTrace();

    }

  • Question 49:

    For example, we have a file in our raw folder app/src/main/res/raw/sample_teas.json. To get an InputStream for reading it, from out Context context, we can do this:

    A. InputStream input = context.openRawResource(R.raw.sample_teas);

    B. InputStream input = context.getRawResource(R.raw.sample_teas);

    C. InputStream input = context.getResources().openRawResource (R.raw.sample_teas);

  • Question 50:

    For example, our preferences.xmlfile was added by addPreferencesFromResource(R.xml.preferences). Our preferences.xmlfile contains such item:

    In our Fragment, we can dynamically get current notification preference value in this way:

    A. String sortBy = PreferenceManager.getDefaultSharedPreferences(getContext()).getString(getContext().getString(R.string.pref_sort_key),getContext().getResources().getBoolean(R.bool.pref_default_sort_value)

    );

    B. String sortBy = PreferenceManager.getSharedPreferences(getContext()).getString(getContext().getString(R.string.pref_default_sort_value),getContext().getString(R.string.pref_sort_key)

    );

    C. boolean sortBy = PreferenceManager.getSharedPreferences(getContext()).getBoolean(getContext().getResources().getBoolean(R.bool.pref_default_sort_value),getContext().getString(R.string.pref_sort_key)

    );

    D. String sortBy = PreferenceManager.getDefaultSharedPreferences(getContext()).getString(getContext().getString(R.string.pref_sort_key),getContext().getString(R.string.pref_default_sort_value)

    )

Tips on How to Prepare for the Exams

Nowadays, the certification exams become more and more important and required by more and more enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare for the exam in a short time with less efforts? How to get a ideal result and how to find the most reliable resources? Here on Vcedump.com, you will find all the answers. Vcedump.com provide not only Google exam questions, answers and explanations but also complete assistance on your exam preparation and certification application. If you are confused on your ASSOCIATE-ANDROID-DEVELOPER exam preparations and Google certification application, do not hesitate to visit our Vcedump.com to find your solutions here.