MCQs / Computer Science / Action Bar and User Interface Design

Action Bar and User Interface Design MCQs — Computer Science (page 2)

34 multiple-choice questions on Action Bar and User Interface Design from Computer Science, each with the correct answer and, where available, a teacher's explanation. Read through them to revise the chapter, then practise the same questions one by one to test yourself.

26. A SearchView inside the app bar is an example of an:

  1. Action view
  2. Toast
  3. Context menu
  4. Overflow item

Answer: A) Action view

Explanation: Action views embed widgets in the app bar.

Discuss this question

27. The action bar was introduced in Android:

  1. 9 Pie
  2. 3.0 Honeycomb
  3. 1.0
  4. 5.0 Lollipop

Answer: B) 3.0 Honeycomb

Explanation: Honeycomb added the Action Bar for tablets.

Discuss this question

28. Which method inflates the options menu?

  1. onPrepareMenu()
  2. onCreateOptionsMenu()
  3. onCreateContextMenu()
  4. onOptionsItemSelected()

Answer: B) onCreateOptionsMenu()

Explanation: onCreateOptionsMenu inflates the menu XML.

Discuss this question

29. Menu resources are stored in:

  1. res/values
  2. res/menu
  3. res/xml
  4. res/layout

Answer: B) res/menu

Explanation: Menu XML files live in res/menu.

Discuss this question

30. The bar at the top of an activity showing the title and actions is called the:

  1. Status bar
  2. Notification drawer
  3. Navigation bar
  4. Action bar / app bar

Answer: D) Action bar / app bar

Explanation: The action bar (app bar) shows title, Up button, actions and overflow.

Discuss this question

31. onOptionsItemSelected should return true when:

  1. The item is disabled
  2. The click has been handled
  3. The menu must be hidden
  4. An error occurs

Answer: B) The click has been handled

Explanation: Returning true consumes the event.

Discuss this question

32. Which method makes a Toolbar act as the activity's action bar?

  1. toolbar.attach()
  2. setActionBar(true)
  3. setSupportActionBar(toolbar)
  4. supportActionBar = toolbar

Answer: C) setSupportActionBar(toolbar)

Explanation: setSupportActionBar() installs the Toolbar as the app bar.

Discuss this question

33. A context menu appears when the user:

  1. Opens the notification drawer
  2. Taps the overflow icon
  3. Rotates the phone
  4. Long-presses a view registered for a context menu

Answer: D) Long-presses a view registered for a context menu

Explanation: Floating context menus appear on long press.

Discuss this question

34. A dialog asking "Delete record?" with Delete/Cancel buttons is created with:

  1. NotificationCompat.Builder
  2. PopupMenu
  3. Toast.makeText
  4. AlertDialog / MaterialAlertDialogBuilder

Answer: D) AlertDialog / MaterialAlertDialogBuilder

Explanation: Alert dialogs show a title, message and buttons.

Discuss this question

Previous Page 2 of 2

Practise Action Bar and User Interface Design MCQs

More Computer Science chapters