stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
COMP 3717 Android - Midterm - 2020 Flashcards | StudBud
Explore
/
COMP 3717 Android - Midterm - 2020
COMP 3717 Android - Midterm - 2020
80 terms
·
StudBud Administration
·
31 plays
Imported from external platform
Flashcards
80 cards
F
Practice quiz
P
Host live
L
Questions
80
Answers
1
When an activity is in the paused state, the activity
has lost the focus and is completely hidden by another activity
has the focus but is completely hidden by other activities
is visible and has the focus
has lost the focus and may be partially hidden by other activities
2
What does this code do if the checkbox named
helloCheckBox
is checked?
it hides the text view
it hides the text in the text view
it makes the text view visible
it makes the text view visible
3
Which of the following is not a common property for layouts?
height
width
padding
method
4
Which of the following declares a class for an asynchronous thread?
class GetItems extends AsyncTask <String, Void, String> {}
class GetItems extends AsyncTask {}
class GetItems extends Timer {}
class GetItems extends Timer<String, Void, String> {}
5
You cannot use a
GoogleMap
object to...
display a series of connected lines on a map
start an activity
add one or more markers to a map
zoom in on a location
6
Which of the following is the latest version of android?
Pie
Oreo
Q
Nougat
7
Given the following code in the
strings.xml
, which of the following properties sets the text on the widget to "Continue"
android:textStyle="@string/name"
android:text="@string/name"
android:text="@string/continue"
android:textStyle="@string/continue"
8
Which of the following best describes a layout in the Android development context?
A layout is the space between the edge of the screen and the child elements
A layout contains all the event handling code for interacting with widgets
Layout determines how much space is between an element and child elements
Layout is container that determines which the child elements are displayed
9
When an app starts for the first time, Android calls the...
onCreate, onStart, and onResume methods
onCreate, onPause, and onDestroy methods
onCreate, onRestart, and onStop methods
onStart, onPause, and onStop method
10
For application based on "Google Maps Activity" template, google_maps_api.xml file provides you with a URL obtains a/an
Map
API_KEY
Connector
Location
11
The Async Task class provides for these generic types:
Async, Task
Params, Progress, Result
URL, Context
TimerTask, URL, String
12
When an app is rotated, Android runs which method?
onCreateOptionsMenu()
onCreate()
onPause()
onStop()
13
Android doesn't always save the data of an activity when you...
change orientation
make a selection from the Spinner widget
click a button
enter data into an EditText widget
14
Within a <style> element in
styles.xml
, which of the following elements would set the text size of the style to 15sp?
<item name="textSize">15sp</item>
<item name="android:textSize">15sp</item>
<property name="textSize">15sp</property>
<item textSize="15sp">
15
[blank] is the deployment file created by Android Studio that gets deployed to a device.
APK file
ZIP file
OBJ file
JAR file
16
Which of the following is
false
about this code?
The fragment is hidden because it has zero width
It sizes the fragment so it's as tall as the parent container
It displays the fragment defined by the ItemsFragment class
This fragment has an ID of items_fragment
17
In a linear layout, which attribute can you add to switch to horizontal orientation?
android:layout="horizontal"
android:orientation="horizontal"
android:gravity="horizontal"
android:weight="horizontal"
18
Given an
EditText
widget named
usernameEditText,
which of the following statements gets the string that's stored?
String username = usernameEditText.getText()
String username = usernameEditText.getText().toString()
String username = usernameEditText.toString()
String username = (String) usernameEditText;
19
3 steps to handling an event.
First,
import the interface that defines a listener. Second, implement listener. Third...
use the Project window to connect the listener
wire the listener to an event
drag the listener onto the graphical layout editor
edit the strings.xml file
20
Which of the following gets the current value of the
Seek Bar
named
volumeSeekBar
?
int volume = volumeSeekBar.value;
int volume = volumeSeekBar.getProgress();
int volume = volumeSeekBar.getValue();
int volume = volumeSeekBar.progress;
21
The primary key of any Firebase record (or document) is [blank]
an auto-generated number
a firebase generated id
an email address
a custom string entered by the user
22
The [blank] returns view for objects in a collection of data objects you provide. Can be used with spinner/ListView etc.
ArrayAdapter
Fragment
DatabaseReference
AsyncTask
23
It is the activity's [blank] method where the activity is associated with the XML layout.
onStart()
onProcess()
onCreate()
onResume()
24
Assume code is wired to Spinner widget that displays 12 months in order. Change the method so that month 1 = January
month = position + 1;
month = parent.getPosition() + 1;
month = parent.getPosition();
month = position;
25
For most widgets, you can use which method(s) to get and set the text that's displayed on the widget?
toString() and fromString()
toWidget() and toDisplay()
getText() and setText()
calculate() and display()
26
What kind of object can you use to add one or more markers to a map?
LocationRequest
GoogleMap
LocationListener
LocationClient
27
In the Fragment lifecycle, [blank] is the callback method where an XML layout is associated with the Fragment class.
onCreateFragment()
onCreate()
onFragment()
onCreateView()
28
Which of the following statements selects the second item in the spinner?
monthsSpinner.setSelection(2)
monthsSpinner.select(2)
monthsSpinner.select(1)
monthsSpinner.setSelection(1)
29
Which of the following statements displays a message on the user interface that says, "Hello"?
Toast.makeText("Hello", Toast.LENGTH_SHORT);
Toast.makeText(this, "Hello", Toast.LENGTH_SHORT).show();
Toast.makeText("Hello", Toast.LENGTH_SHORT).show();
Toast.makeText(this, "Hello", Toast.LENGTH_SHORT);
30
Which of the following statements gets a reference to the widget?
TextView billAmountTextView = findViewById(TextView);
TextView billAmountTextView = findView(R.id.billAmountTextView);
TextView billAmountTextView = findViewId(R.id.billAmountLabel);
TextView billAmountTextView = findViewById(R.id.billAmountLabel);
31
A/an [blank] intent specifies action you want to perform, can be used to view a URL in a web browser or to call a number
complacent
explicit
daemon
implicit
32
In a table layout, which attribute can you add to have a widget span two columns?
android:span="2"
android:layout_span="2"
android:widget_span="2"
android:col_span="2"
33
To add more than one fragment to a layout, add two or more [blank] to a layout file.
fragment elements
none of the above
fragment classes
name elements
34
Within a class for asynchronous thread, which method is executed on the UI thread after the thread finished executing?
doInBackground(Params...)
onProgressUpdate(Progress...)
onPreExecute()
onPostExecute(Result)
35
Although Android supports other units of measurement, it's a best practice to use:
density-independent pixels (dp)
ems
inches
millimeters
36
[blank] is an XML file that specifies the launcher activity for your android Application.
Application.xml
strings.xml
Android.xml
AndroidManifest.xml
37
The [blank] is a super class of all widgets.
View
Widget
Placeholder
TextView
38
An Android ______ widget allows the user to select an item from a list of items.
spinner
checkbox
image button
toast
39
Creating a Google Maps application by using the Google Maps Activity template in Android Studio, default location is...
Paris, France
San Francisco, USA
Sydney, Australia
Beijing, China
40
To determine which widget an event occured on, you use the [blank] method of the View class.
getId()
getEvent()
onClick()
CheckChanged()
41
In Android Studio, the
google_maps_api.xml
file is physically located in the [blank]
app/src/java/res/layout
app/src/main/res/values
app/src/java/res/values
app/src/debug/res/values
42
Three common types of widgets are...
TextView, DPad, EditText
TextView, Button, EditText
TextView, Input, EditText
EditText, Button, DPad
43
Which is not a Google map type?
satellite
high-view
terrain
normal
44
Within an XML file that defines styles; a property of a style is specified by a/an
application element
item element
theme element
style element
45
The style named
PrimaryButton inherits...
no styles
the Button Style and the TextView style
the Button style
the TextView style
46
Firebase:
DataBaseReference dfRef = databaseStudents.child(id);
What is the method call for deleting a record/document?
dbRef.remove()
dbRef.purge()
dbRef.delete()
dbRef.destroy()
47
For the textSize property of a widget, generally considered a best practice to use [blank] to specify the size of text.
ems
scale-independent pixels
millimeters
inches
48
The [blank] attribute aligns a widget with the top, bottom, center, left, or right of its parent...
layout_position
layout_placement
layout_gravity
layout_align
49
What type of content can a WebView widget display?
ONLY HTML, CSS, and JavaScript
Any type of content that a web browser can display
Only XML
Only HTML and CSS
50
Within a class for asynchronous thread, which following method is executed on the asynchronous thread and does most work
doInBackground(Params ... )
onPreExecute()
onPostExecute(Result)
onProgressUpdate(Progress ...)
51
You can add a Google Map to an activity by adding a MapFragment. However it will need to implement the [blank] interface
OnMapAsync
OnMapFragment
OnZoom
OnMapReadyCallback
52
In which Android Studio project folder do the files
strings.xml, styles.xml, and colors.xml
reside?
xml
drawable
layout
values
53
When a user presses a hardware button on a device, a/an [blank] occurs.
Press
Motion
SystemService
Key
54
The [blank] class is the starting point for all Database operations in Firebase.
DatabaseReference
Database
Firebase
Firebase Reference
55
For an asynchronous task, within the inner class, you can access the context for the activity by coding...
the name of the outer class
the name of the outer class, a period, and the this keyword
the this keyword
a period
56
You created an empty activity named MapsActivity.java. What would be the associated layout file name that is created?
activity_maps.xml
map.xml
maps_layout.xml
layout_maps.xml
57
Assuming this method is wired to a CheckBox widget, what happens when the user checks the box?
The deleteOldMessages variable is not changed.
A runtime exception is thrown.
The deleteOldMessages variable is set to true.
The deleteOldMessages variable is set to false.
58
Which statements can you use to get intent that started an activity and retrieve a string named title stored in intent?
Intent intent = new Intent(); String title = intent.getTitle();
Intent intent = getIntent(); String title = intent.getTitle();
Intent intent = getIntent(); String title = intent.getStringExtra("title");
Intent intent = new Intent(); String title = intent.getStringExtra("title")
59
Which method is executed when the user selects one of the items in the
ListView
widget?
onItemClick()
onCreateView()
OnDestroy()
onItem()
60
Consider code below: The setValueTask object has two listeners that handle success and failure. Which ones are they?
successListener & failureListener
onSuccess & onFailure
addOnSuccessListener & addOnFailureListener
success & failure
61
Which of the following attributes sets the style for the widget to the Spinner class?
style="@android:style/Spinner"
android:style="Spinner"
android:style="@style/Spinner"
style="@style/Spinner"
62
Which is
false
about a fragment?
It can be reused in multiple activities
It's a class that you can use to define part of the user interface
It cannot contain Android widgets
It can also be referred to as a pane
63
What does the following statement do?
It creates a menu item for the class named SettingsActivity
This statement won't compile because it uses the wrong number of parameters
It starts the activity that is defined by the class named Intent
It starts the activity that is defined by the class named SettingActivity
64
In
Colors.xml
file for the project, which of the following elements defines color for the text of
PrimaryButton
style?
<color name="primaryColor"> @android:blue</color>
<color name="primary">#141315</color>
<color style="PrimaryButton"> @android:blue</color>
<item name="textColor>#141315</item>
65
In Android Studio, when you run an app with the debugger, and it encounters a breakpoint, Android Studio...
stops at the first line of code in the first activity
stops before it executes the line of code at that breakpoint
continues to the end of the current method
displays the Breakpoint window
66
When you add a default empty activity (eg: MainActivity) in Android Studio, it extends from [blank] base class.
Android
Activity
AppCompatActivity
Fragment
67
You can connect Android Studio app to Firebase by selecting the Firebase menu item under [blank] in the IDE menu system.
VCS
Help
Window
Tools
68
A/an [blank] is a collection of styles that apply to an entire activity or app
theme
mipmap
style sheet
property
69
When you add a default empty fragment in Android Studio, it extends from [blank] base class.
Fragment
FragmentClass
AppCompatFragment
AndroidxFragment
70
If you decided to wire this event handler to multiple check boxes, which switch statement would you add to this method?
switch (checkedId) (...)
switch (widget.getId()) (...)
switch (view.getId()) (...)
switch (isChecked) (...)
71
Android is based on [blank].
Cordova
Unix
Windows
Linux
72
When using Google Maps, a location is set by using the [blank] object.
Address
Satellite
LatLng
Coordinate
73
How much height is allocated to the widget?
10dp
20sp
Just enough height to display the widget
Enough height to match parent container
74
[blank] is the activity callback method that is called just before the activity comes to foreground.
onRestore()
onDemand()
onResume()
onContinue()
75
Which of the following is the correct way of getting a reference to a Firebase collection of records named students?
getInstant().getReference("students")
Database.getInstance().getReference("students")
Firebase.getInstance().getReference("students")
FirebaseDatabase.getInstance().getReference("students")
76
[blank] is the build software used in Android Studio.
Gradle
Gulp
Maven
Ant
77
Google Maps provide many features, excluding
live satellite images
street view
3D buildings
traffic layers
78
For a
Seek Bar
, the [blank] method is executed as the user changes the value of the seek bar.
onStopTrackingTouch()
onStopStart()
onStartTrackingTouch()
onProgressChanged()
79
In a linear layout, the [blank] attribute determines how much space Android allocates to a widget.
linear
orientation
gravity
weight
80
You cannot use a
FragmentManager
object (returned by getFragmentManager() ) to...
get a reference to a Fragment object
create transactions
get a reference to the containing activity
replace one fragment with another fragment