Midterm Review for Advanced Java
What is the one-time cost for a developer's account at Google Play?
$25.00
How much is Amazon's annual fee for a developer account?
$99.00
Which picture file types are acceptable for an ImageView control?
.jpg, .png, and .gif
What is the preferred file extension of the launcher icon?
.png
Which picture file type is preferred for an ImageView control?
.png
Answer the question below about the following initialized array: String[] pizzaToppings = new String[10]; How many toppings can this array hold?
10
What is the solution to the following arithmetic expression? 3 + 4 * 2 + 9
20
What is the solution to the following arithmetic expression? 16 / 2 * 4 + 4
36
What is the solution to the following arithmetic expression? 40 - (6 + 2) / 8
39
Which Android version is Kit Kat?
4.4
When you post an Android app at Google Play, what percentage of the app price does the developer keep?
70%
What is the solution to the following arithmetic expression? 3 + 68 % 9
8
What character is placed at the end of most lines of Java code?
;
In an app, suppose you want to use the theme with a grey title bar and a white background. What entire line of code is needed in the styles.xml file to support this theme?
<style name="AppTheme" parent="Base.Theme.AppCompat.Light">
What is the difference between a Linear layout and a Relative layout?
A Linear Layout organizes layout components in a linear fashion vertically or horizontally. A Relative Layout organizes layout controls in relation to each other. This provides more flexibility of control positioning than Linear Layouts.
What is the name of the icon that appears at the top-left of the opening bar across the opening screen (Activity) of the app?
Action bar icon
What is a soft keyboard? Be sure to include its location in your answer.
An on-screen keyboard positioned at the bottom of the screen.
What is the name of the default theme?
App Theme
Why is sp the preferred measurement for text size?
Because you can scale it to fit a device.
Write one line of code that declares a Button control with the variable name btn that references a button in the XML layout with the Id property of btnStarWars.
Button btn = (Button)findViewById(R.id.btnStarWars);
Write one line of code that declares a Button control with the variable named btn that references a button in the XML layout with the Id property of btnStarWars.
Button btn = (Button)findViewById(R.id.btnStarWars);
Which two keys are pressed to auto complete a line of Java code?
CTRL + Spacebar
What does XML stand for?
Extensible Markup Language
True or False: A toast notification is also called a muffin message.
False
True or False: You can select one or more radio buttons at one time in a RadioGroup control.
False
True or False: This is the proper way to initialize an array: doubles { } driveSize = ["32.0", "64.0", "128.0"];
False (double[] driveSize = { "32.0", "64.0", "128.0" };)
True or False: URL stands for Unified Resource Locator.
False (Uniform Resource Locator)
True or False: Hexadecimal color codes are defined as a triplet of three colors using hexadecimal numbers, where colors are specified first by a ampersand sign followed by how much red (00 to FF), how much green (00 to FF), and how much blue (00 to FF) are in the final color.
False (it's a pound sign!)
True or False: There are 7 drawable folders available in the res folder.
False (there are 5 for low-, medium-, high-, extra high-, and extra extra high-density screens: ldpi, mdpi, hdpi, xhdpi, and xxhdpi respectively)
Which color is represented by the hexadecimal code of #00FF00?
Green (yellow is #FFFF00, red is #FF0000, blue is #0000FF)
What is the property that defines the name of a Button control?
Id
In which subfolder is the activity_main.xml file storage?
It is in a subfolder of the res folder named layout
Which two languages are used in creating an Android app in Android Studio?
Java and XML
Which Android control displays a vertical listing of items?
ListView
What is the dessert name that starts with an "L" to describe an Android version?
Lollipop
Which two key combinations can you press to run an Android app in Android Studio?
Shift + F10
What does SDK stand for?
Software Development Kit
Answer the question below about the following initialized array: String[]pizzaToppings = new String[10]; Rewrite this statement to initially be assigned the following four toppings only: extra cheese, black olives, mushrooms, and bacon.
String[] pizzaToppings = { "extra cheese", "black olives", mushrooms, "bacon" };
Name three widgets mentioned in chapter 1, "Meet the Android".
TextView, Button, and CheckBox
Write a line of code that creates an instance of the TimerTask class with the object named welcome.
TimerTask welcome = new TimerTask(){@Override public void run() {}};
Write a warning message that would display the comment "The maximum credits allowed is 18" with a long interval.
Toast.makeText(MainActivity.this,"The maximum credits allowed is 18", Toast.LENGTH_LONG).show();
True or False: A ListActivity is a class that displays a list of items within an app.
True
True or False: A scroll bar appears in a list when the list exceeds the size of the window.
True
True or False: Gravity is a tool that changes the linear alignment of a control.
True
True or False: The default layout for an Android screen is Relative.
True
True or False: The default option in the switch decision structure is used if none of the cases match the testing condition.
True
True or False: You can use the Image Asset Wizard to display a custom icon.
True
What does URI stand for?
Uniform Resource Identifier
a. If you were creating an app in many different languages, would you have to write the entire program from scratch for each language? b. What part of the program would stay the same? c. What part of the program would be different?
a. No b. Java code c. XML layout file
An _____ provides a data model for the layout of a list and for converting the data from the array into list items.
adapter
Write a single line of XML code that changes the size of the text of a TextView control to 39 scaled-independent pixels.
android:textSize="39sp"
Which property of TextView displays a solid color behind the text?
background
Which property of TextView displays an image as a backdrop behind the text?
background
Write a statement that is needed to change the text on a button named btnJazz to the text "Pause Unforgettable."
btnJazz.setText("Pause Unforgettable.");
What is the name of the property used to center an EditText control hint property horizontally?
center_horizontal gravity property
When a RadioGroup control is placed on the emulator, the first RadioButton control is selected by default. Which property is set as true by default?
checked
What does dpi stand for?
dots per inch
A(n) _____ is software that duplicates how an app looks and feels on a particular device.
emulator
You assign the ___________ property to the string array that you create for a Spinner.
entries
Write a GetText( ) statement that converts a variable named deficit to a double data type and assigns the value to the variable named financeDeficit.
financeDeficit =Double.parseDouble(deficit.getText().toString());
Write a line of code that closes the resources of the existing Activity.
finish( ); OR onDestroy( );
Name two numeric data types that can contain a decimal point
float and double
What is the preferred prefix for a filename of the launcher icon?
ic_launcher
Write an If statement that tests if the value in the variable age is between 18 and 21 years of age, inclusive, with empty braces.
if ( age >= 18 && age <=21) { }
Write an If statement that tests if the radio button named gender is selected with empty braces.
if (gender.isChecked()) { }
Fix this statement: if (hours < 2 || > 8){ }
if (hours < 2 || hours > 8) { }
Name two decision structures.
if and switch
Write an If statement to compare if a string variable named company is equal to AT&T with empty braces.
if(company.equals("AT&T")) { }
Initialize an array named temps with the integers 22, 56, 38, 30, and 57.
int[] temps = { 22, 56, 38, 30, 57 };
A(n) _____ is a single string of information in a string array.
item
What is the name of the icon on the Android home screen of your device that opens an app?
launcher icon
A(n) ______ is a container that can hold widgets and other graphical elements to help you design an interface for an application.
layout
Write the following variable in camel case: NUMBEROFDELAYS.
numberOfDelays
Which method follows an onPause( ) method?
onResume() onStop() also accepted
px stands for _____
pixel
Answer the question below about the following initialized array: String[]pizzaToppings = new String[10]; What is the statement to assign mushrooms to the first array location?
pizzaToppings[0] = "mushrooms";
Answer the question below about the following initialized array: String[]pizzaToppings = new String[10]; What is the statement to assign green peppers to the fourth location in the array?
pizzaToppings[3] = "green peppers";
What is the web address of Google Play?
play.google.com
The ____ property of the Spinner control adds text at the top of the control such as instructions.
prompt
Which type of pictures can be used for free fair use without copyright?
public domain
What is the name of the folder that typically holds media files in the Android project?
raw
What folder are music and image files saved within the Android project view?
res folder
In which subfolder in the Android project view are the XML files stored?
res/layout (answer 'res/values' also accepted)
What does the "R" in R.id.travel stand for?
resource
What does sp stand for?
scaled-independent pixels
Write one line of code that opens the XML layout named lemon.
setContentView(R.layout.lemon);
Which measurement is more preferred for text size?
sp
What is the name of the initial window that typically displays a company logo for a few seconds?
splash screen
Write a statement that opens the Android Help Site: http://developer.android.com
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://developer.android.com")));
Write a startActivity statement that launches a class named Studio.
startActivity(new Intent(MainActivity.this, Studio.class));
Write one line of code that would launch a second class named Wireless from the present MainActivity class.
startActivity(new Intent(MainActivity.this, Wireless.class));
What are the four states of an Activity?
stopped, dead, active, paused
The ____ file (full name) holds commonly used phrases (arrays) of text in an application.
strings.xml
A _______ is a piece of code that serves as a placeholder to declare itself, containing just enough code to link to the rest of the program.
stub
Change the following If decision structure to a Switch decision structure: if (count == 3){ result = "Password incorrect"; } else { }
switch(count){ case 3: result = "Password incorrect"; break; default: result = "Request password"; break; }
Which Plain TextView property is changed to identify the color of the control?
textColor
An Android _____ is a style applied to an Activity or an entire application.
theme
A ______ is a single sequential flow of control within a program.
thread
What does ADS refer to as a message that appears as an overlay on a user's screen, often displaying a validation warning?
toast
Using the layout:margin property, in which text box would you type 18dp to move a control 18 density pixels down from the upper edge of the emulator?
top