71
In a ConstraintLayout, which of the following choices describes the constraints needed to keep a view in place during runtime?
A)
Two horizontal constraints.
B)
One vertical constraint.
C)
At least one horizontal and one vertical constraint.
D)
There is no need to constrain the view.
Answer & Solution
Answer: Option
C
72
Which of the following constraint types expands a view only as much as needed to fit its contents?
A)
Wrap content
B)
Match constraint
C)
Fixed constraint
D)
Baseline constraint
Answer & Solution
Answer: Option
A
73
Which of the following is not a reason for minimizing calls to findViewById()?
A)
Every time findViewById() is called, it traverses the view hierarchy.
B)
findViewById() runs on the main or UI thread.
C)
These calls can slow down the user interface.
D)
Your app is less likely to crash.
Answer & Solution
Answer: Option
D
74
How do you enable your project to use navigation components?
A)
Make sure every Activity class extends the class NavigationActivity.
B)
Use the NavigationController class as the launch activity.
C)
Add uses-navigation to the AndroidManifest.xml file.
D)
Add dependencies for navigation-fragment-ktx and navigation-ui-ktx in the build.gradle (module) file.
Answer & Solution
Answer: Option
D
75
Where are the possible navigation routes through your app defined?
A)
In a file (often called navigation.xml) in the res > layout folder.
B)
In a file (often called navigation.xml) in the app > navigation folder.
C)
In a file (often called navigation.xml) in the res > navigation folder.
D)
In the AndroidManifest.xml file, under the element.
Answer & Solution
Answer: Option
C
76
Where do you set the ID of a fragment to be used in navigation?
A)
In the fragment layout file, either by setting the ID attribute in the design editor or in the layout XML file in the res > layout folder.
B)
In the project navigation file, either by setting the ID attribute in the navigation graph or in the navigation.xml file in the res > navigation folder.
C)
You need to set the ID in both the navigation file for the app and the layout file for the fragment.
D)
Set the ID variable in the relevant Fragment class.
Answer & Solution
Answer: Option
B
77
Where do you define the items for a menu?
A)
It depends on where the menu will be shown. For a navigation drawer menu, add an <item> tag for each menu item in the menu.xml file in the res > drawer folder. For the options menu, add an <item> tag for each menu item in the menu.xml file in the res > options folder.
B)
In the layout file for the fragment or activity that displays the menu, add a <menu> tag that contains <item> tags for each item.
C)
In a menu_name.xml file in the res > menu folder, add an <item> tag for each menu item. Create separate XML files for each separate menu.
D)
In the AndroidManifest.xml file, add a <menus> tag that contains a <menu> tag for each menu, that in turn contains an <item> tag for each menu item.
Answer & Solution
Answer: Option
C
78
Your app contains a physics simulation that requires heavy computation to display. Then the user gets a phone call. Which of the following is true?
A)
During the phone call, you should continue computing the positions of objects in the physics simulation.
B)
During the phone call, you should stop computing the positions of objects in the physics simulation.
C)
Boath A and B
D)
None of these
Answer & Solution
Answer: Option
B
79
To make a class lifecycle-aware through the Android lifecycle library, which interface should the class implement?
A)
Lifecycle
B)
LifecycleOwner
C)
Lifecycle.Event
D)
LifecycleObserver
Answer & Solution
Answer: Option
D
80
Under which circumstances does the onCreate() method in your activity receive a Bundle with data in it (that is, the Bundle is not null)?
A)
The activity is restarted after the device is rotated.
B)
The activity is started from scratch.
C)
The activity is resumed after returning from the background.
D)
The device is rebooted.
Answer & Solution
Answer: Option
A