Advanced Mobile App (1)

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Match the Android version and API with the codename: Version: 2.2 API: 8

Codename: Froyo

Match the Android version and API with the codename: Version: 2.3.3 - 2.3.7 API: 10

Codename: Gingerbread

Match the Android version and API with the codename: Version: 4.1.x API: 16 Version: 4.2.x API: 17 Version: 4.3 API: 18

Codename: Jelly Bean

Match the Android version and API with the codename: Version: 4.4 API: 19

Codename: KitKat

Unlike other methods, a static method a. is called directly from a class b. is stored in a class that can't be instantiated c. cannot accept arguments

a. is called directly from a class

What folder keeps resources such as images and music? a. res b. gen c. assets d. src

a. res

If the value of the int variable named quantity is 5, what is the value of total after this statement is executed? int total = quantity++; a. 5 b. 7 c. 6 d. 4

a.5

By default, what does @string specified in a TextView control refer to? a. A data type of string b. A file called strings.xml c. A variable named string d. ​The word "string" in a resource file

b. A file called strings.xml

You can use a Scanner object to: a. display a prompt on the console b. get the next token in an input line c. display a blank line on a console d. check your Java code for exceptions

b. get the next token in an input line

What term is used when creating an object from a class? a. initiate b. instantiate c. justify d. stabilize

b. instantiate

Explicit casts must be used to perform a. widening conversions b. narrowing conversions c. any conversion between two data types d. before implicit casts

b. narrowing conversions

What does debugging an application entail? a. Running it to see if it works correctly. b. Compiling it to make sure it doesn't contain any syntax errors. c. Identifying and fixing any bugs.

c. Identifying and fixing any bugs.

Which of these data types are used to store true/false values? a. char b. byte c. bool d. boolean

d. boolean

In Java, what is a tap of the touch screen known as? a. touch event b. tap event c. display action d. click event

d. click event

You can use a System.out object to: a. exit from a console display b. get the next whitespace in an input line c. get the next token in an input line d. display a blank line on a console

d. display a blank line on a console

What is a part of a program coded to respond to a specific event? a. action responder b. triggered method c. response method d. event handler

d. event handler

The extension for a Java source file is a. txt b. jav c. class d. java

d. java

What does the unit sp stand for? a. standard pixel b. size preference c. scaled-dependent pixels d. scaled-independent pixels

d. scaled-independent pixels

To create a Java source file, you use a a. compiler b. interpreter c. virtual machine d. text editor

d. text editor

Match the Android version and API with the codename: Version: 4.0.3 - 4.0.4 API: 15

Codename: Ice Cream Sandwich

Match the Android version and API with the codename: Version: 5.0 API: 21 Version: 5.1 API: 22

Codename: Lollipop

Match the Android version and API with the codename: Version: 6.0 API: 23

Codename: Marshmallow

Which of the following is not a binary operator? a. ++ b. + c. / d. %

a. ++

What is the range of values that x can hold after this statement is executed? double x = Math.random() * 10 + 100; a. 100 <= x < 110 b. 100 <= x < 1100 c. 100 <= x < 200 d. 100 <= x < 101

a. 100 <= x < 110

Assume that before the following code is executed, the value of totalOne is 6.728, the value of totalTwo is 116, and both are BigDecimal objects. What is the value of totalFinal after the code is executed? totalOne = totalOne.setScale(2, RoundingMode.HALF_UP); BigDecimal totalFinal = totalTwo.add(totalOne); a. 122.73 b. 123 c. 122.72 d. 122.728

a. 122.73

After the if statement that follows is executed, what will the value of discountAmount be? double discountAmount = 0.0; double orderTotal = 200.0; if (orderTotal > 200) discountAmount = orderTotal * .3; else if (orderTotal > 100) discountAmount = orderTotal * .2; else discountAmount = orderTotal * .1; a. 40.0 b. 0.0 c. 60.0 d. 20.0

a. 40.0

Where are apps written for Android sold and deployed? a. Google Play b. iTunes c. App Store d. Mobile Mall

a. Google Play

Which control can display an icon or a graphic such as a picture file or shape? a. ImageView control b. JPG control c. Display control d. Picture control

a. ImageView control

Which of the following is not true of using a IDE to develop Java programs? a. It's harder to detect syntax errors. b. It's easier to develop graphical user interfaces. c. It's harder to make mistakes when entering code. d. It's easier to debug your programs.

a. It's harder to detect syntax errors.

Which of the following is true? a. Java programs can run on different platforms, like Windows and Unix, without being recompiled. b. C++ programs have always run more slowly than Java programs. c. In contrast to Java, C# requires programmers to manage almost all memory operations. d. All of the above.

a. Java programs can run on different platforms, like Windows and Unix, without being recompiled.

What does the following statement do if userNumber has an integer value of 14 and userEntry has a string value of "two"? userNumber = Integer.parseInt(userEntry); a. Throws an exception b. Stores a null value in userNumber c. Converts "two" to 2 and stores it in userNumber d. Converts "two" to "2" and stores it in userEntry

a. Throws an exception

Unlike a variable, a constant can't a. change in value as an application runs b. be initialized when it's declared c. be declared within a method d. be declared with block scope

a. change in value as an application runs

The double data type can be used to store a. floating-point numbers b. true or false values c. whole numbers only d. long integers

a. floating-point numbers

To achieve platform independence, the Java virtual machine a. interprets the bytecodes b. interprets the virtual code c. interprets the machine code d. interprets the source code

a. interprets the bytecodes

To refer to a Java class from an application without qualification, you need to import the class unless that class a. is stored in a package that has already been imported b. contains only static methods c. is stored in a package

a. is stored in a package that has already been imported

Which package is automatically available to all Java programs? a. java.lang b. java.basic c. java.util d. java.text

a. java.lang

The emulator mimics almost every feature of a real Android except for the ability to do what? a. place a phone call b. play video games c. use the Internet d. load programs

a. place a phone call

Where do you need to put a picture file that will be used with an ImageView control? a. resources folder b. pictures folder c. controls folder d. drawable folder

a. resources folder

A compile-time error occurs when a. there's a syntax error in a Java statement b. the Java compiler can't be located c. the class doesn't contain a main method d. bytecodes can't be interpreted properly

a. there's a syntax error in a Java statement

If a class contains a main method, that method is executed a. when the class is run b. when another method within the class calls it c. when an object is created from the class d. none of the above

a. when the class is run

The int data type can be used to store a. whole numbers only b. floating-point numbers c. true or false values only d. dates

a. whole numbers only

What should a * beginner* typically use to change the contents of the strings.xml file? a. ​Translations Editor b. Text Viewer c. Resource Viewer d. Emulator Editor

a. ​Translations Editor

If int variable x = 100, float variable y = 1.587F, and double variable z = 4.8, what does the following expression return? x + Math.round(y) + (int) z a. 105 b. 106 c. 105.6 d. 107

b. 106

Which of the following is a valid class name? a. Numeric#Validator b. CustomerMaintApp c. Customer-Maintenance d. 2004YearEndApp

b. CustomerMaintApp

According to standard naming conventions, which of the following is a typical class name? a. product b. Product c. $Calculate d. calculateTotal

b. Product

What does testing an application entail? a. Compiling it to make sure it doesn't contain any syntax errors. b. Running it to see if it works correctly. c. Identifying and fixing any bugs.

b. Running it to see if it works correctly.

What does SDK stands for? a. Support Development Knowledge b. Software Development Kit c. Standard Domain Knowledge d. Special Description Kit

b. Software Development Kit

When you create a new Android project, what is the default object placed into the emulator window? a. Volume control b. TextView widget c. CheckBox control d. Default button

b. TextView widget

What happens when a runtime error occurs? a. The application will get caught in an infinite loop that you have to cancel out of. b. The application will end abnormally. c. The results of the application will be inaccurate.

b. The application will end abnormally.

Which of the following * isn't * a benefit of a typical IDE for Java? a. The debugging features make it easier for you to find bugs in your applications. b. Your code compiles and runs faster. c. The IDE helps you complete code as you type. d. The syntax of your code is checked as you enter it.

b. Your code compiles and runs faster.

Using the BigDecimal class, you can a. store numbers with a maximum of 16 significant digits b. avoid rounding errors that may occur otherwise in business applications c. both A and B d. none of the above

b. avoid rounding errors that may occur otherwise in business applications

A runtime error occurs when a. there's a syntax error in a Java statement b. bytecodes can't be interpreted properly c. the Java compiler can't be located d. the name of the .java file and the class don't match

b. bytecodes can't be interpreted properly

Block scope means that a variable a. can't be used outside of the statement that it's declared in b. can't be used outside of the set of braces that it's declared in c. can't be used as a counter in a while loop d. can't be used in a Boolean expression

b. can't be used outside of the set of braces that it's declared in

You can use relational operators to a. compare string variables b. compare numeric variables c. both a and b d. neither a nor b

b. compare numeric variables

Which of the following is a valid statement for declaring and initializing a double variable named length to a starting value of 120? a. length = 120.0; b. double length = 120.0; c. double length = 120.0 d. Double length = 120.0;

b. double length = 120.0;

Which of these data types are used to store numbers with decimal positions? a. byte b. float c. short d. long

b. float

What symbol indicates errors in program code? a. green curly lines b. red curly lines c. blue solid lines d. bolded text

b. red curly lines

Which of the following is a valid variable name? a. double b. salesTax c. input-string d. 25Percent

b. salesTax

What happens when you use both integer and double values in an arithmetic expression? a. all values are cast to the type of the result variable b. the integer values are cast to double values c. the double values are cast to integer values d. an exception occurs

b. the integer values are cast to double values

5. What happens when you click the Run 'app' button in Android Studio? a. The Android debugger opens b. The Choose Device dialog box is displayed c. The app runs in a browser window d. The app runs on the device connected to the USB port

b. ​The Choose Device dialog box is displayed

If the int variables a = 5, b = 2, and c = 10, what is the value of c after the following statement is executed? c = c + a * b - 5; a. -45 b. 15 c. 25 d. None of the above

b.15

What string is placed in the default TextView control in a new Android app created using Android Studio? a. ​"Default text" b. "TextView control" c. "Hello World!" d. ​"I am Android"

c. "Hello World!"

Assume userName equals "Tom" and userAge equals 22. What is printed on the console when the following statement is executed? System.out.println(userAge + " \nis " + userName + "'s age."); a. 22 \n is Tom's age. b. 22 \nis Tom's age. c. 22 is Tom's age. d. 22 is Tom's age.

c. 22 is Tom's age.

How many times will the while loop that follows be executed if months has a value of 5? int i = 1; while (i < months) { futureValue = futureValue * (1 + monthlyInterestRate); i = i+1; } a. 5 b. 6 c. 4 d. 0

c. 4

If the variable named input is 755, what is the value of r after these statements are executed? NumberFormat n = NumberFormat.getNumberInstance(); n.setMinimumFractionDigits(3); String r = n.format(input); a. 755 b. .755 c. 755.000 d. 760.000

c. 755.000

If the variable named percent is 0.0755, what is the value of p after this statement is executed? String p = NumberFormat.getPercentInstance().format(percent); a. 0.0755 b. 7.55 c. 8% d. 7.55%

c. 8%

Based on the naming recommendations in the book, which of the following is a good identifier for a constant that will be used to hold a base shipping charge? a. BASE-SHIPPING-CHARGE b. baseShippingCharge c. BASE_SHIPPING_CHARGE d. BaseShippingCharge

c. BASE_SHIPPING_CHARGE

If you want to modify the value of the default TextView control in a new Android app, what should you do? a. ​Edit the res file b. ​Change the file named hello_world c. Edit the strings.xml file d. Change the @strings variable

c. Edit the strings.xml file

import java.util.Scanner; public class InvoiceApp { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String choice = "y"; while (choice.equals("y")) { System.out.print("Enter subtotal: "); double subtotal = sc.nextDouble(); double salesTax = subtotal * .0875; double invoiceTotal = subtotal + salesTax; String message = "Subtotal = " + subtotal + "\n" + " Sales tax = " + salesTax + "\n" + "Invoice total = " + invoiceTotal + "\n\n" System.out.println(message); System.out.print("Continue? Enter y or n: "); choice = sc.next(); } } } The name of the file that contains this source code must be a. InvoiceApp.class b. Main.class c. InvoiceApp.java d. Main.java

c. InvoiceApp.java

What is the fee you must pay to Google for each free app you publish on Google Play? a. $25 b. $1.99 c. No fee d. $1.00

c. No fee

Which of the following is an open-source business partnership of 80 firms that develop standards for mobile devices? a. Association of Wireless Computers b. Cordless Union c. Open Handset Alliance d. Mobile Computing Consortium

c. Open Handset Alliance

What happens when a logical error occurs? a. The application will end abnormally. b. The application will get caught in an infinite loop that you have to cancel out of. c. The results of the application will be inaccurate.

c. The results of the application will be inaccurate.

After the Android emulator is loaded, what must you do before you can run your app in it? a. Compile the app b. Run the debugger c. Unlock the virtual device d. Close Android Studio

c. Unlock the virtual device

When centering a control, what kind of line is displayed when you drag the control to the center of the emulator window? a. a red dashed horizontal line b. a blue solid vertical line c. a green dashed vertical line d. a green solid vertical line

c. a green dashed vertical line

What kind of Java program runs within a Java-enabled browser? a. an application b. a servlet c. an applet d. a network program

c. an applet

You typically use comments in a Java application to Selected Answer: a. none of the above b. separate blocks of code c. describe statements that are difficult to understand d. provide user instructions

c. describe statements that are difficult to understand

In which folder are resources for medium-density screens placed? a. drawable-hdpi folder b. drawable-ldpi folder c. drawable-mdpi folder d. drawable-medium folder

c. drawable-mdpi folder

Based on the naming recommendations in the book, which of the following is a good identifier for a variable that will be used to hold an employee's phone number? a. EmployeePhoneNumber b. employee_phone_number c. employeePhoneNumber d. emphonumber

c. employeePhoneNumber

import java.util.Scanner; public class InvoiceApp { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String choice = "y"; while (choice.equals("y")) { System.out.print("Enter subtotal: "); double subtotal = sc.nextDouble(); double salesTax = subtotal * .0875; double invoiceTotal = subtotal + salesTax; String message = "Subtotal = " + subtotal + "\n" + " Sales tax = " + salesTax + "\n" + "Invoice total = " + invoiceTotal + "\n\n" System.out.println(message); System.out.print("Continue? Enter y or n: "); choice = sc.next(); } } } If the user enters "Y" when asked if he/she wants to continue, the application will a. repeat the while loop b. display a blank line, then repeat the while loop c. end d. display the correct total amount

c. end

You use an escape sequence to a. append a string expression to a string variable b. indicate the beginning of a comment c. include a special character in a string d. indicate the beginning of a literal string

c. include a special character in a string

Which of the following statements uses a shortcut assignment operator? a. index = index + 1; b. index++; c. index += 1; d. both b and c e. all of the above

c. index += 1;

Which of the following can you not assign to a numeric variable? a. another numeric variable b. an arithmetic expression c. null d. a numeric literal

c. null

What is the entry point of an Activity? a. prepare method b. begin method c. onCreate method d. onEntry method

c. onCreate method

Which of the following two keywords should always be used on the declaration of the main method? a. public and int b. private and static c. public and static d. private and int

c. public and static

A syntax error occurs when a. bytecodes can't be interpreted properly b. the class doesn't contain a main method c. there's a syntax error in a Java statement d. the Java compiler can't be located

c. there's a syntax error in a Java statement

If the double variables x = 2.5 and y = 4.0, what is the value of z after this statement is executed? int z = (int) x + (int) y; a. 6.0 b. 7 c. 6.5 d. 6

d. 6

What file lists the permissions needed to access other Android functions required by your app? a. styles.xml b. Strings.xml c. activity_main.xml d. AndroidManifest.xml

d. AndroidManifest.xml

What is the human-readable title for your application? a. External name b. Program namespace c. Class title d. Application name

d. Application name

What does the following statement do in a Java application? import java.util.Scanner; a. It looks for syntax errors in the application. b. It makes the classes of the Scanner package available to the application. c. It copies user entries into the main method of the application. d. It makes the Scanner class available to the application without qualification.

d. It makes the Scanner class available to the application without qualification.

Android code was released under the Apache license which means the platform is considered which of the following? a. Virtual license b. Proprietary c. Private code d. Open source

d. Open source

import java.util.Scanner; public class InvoiceApp { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String choice = "y"; while (choice.equals("y")) { System.out.print("Enter subtotal: "); double subtotal = sc.nextDouble(); double salesTax = subtotal * .0875; double invoiceTotal = subtotal + salesTax; String message = "Subtotal = " + subtotal + "\n" + " Sales tax = " + salesTax + "\n" + "Invoice total = " + invoiceTotal + "\n\n" System.out.println(message); System.out.print("Continue? Enter y or n: "); choice = sc.next(); } } } If the user enters 100 the first time the while loop is executed, what will the program display at the console? a. Subtotal = 100.0 Sales tax = 8.75 Invoice total = 108.75 b. Subtotal = 100.0 Sales tax = 8.75 Invoice total = 108.75 c. Subtotal: 100.0 Sales tax: 8.75 Invoice total: 108.75 d. Subtotal = 100.0 Sales tax = 8.75 Invoice total = 108.75

d. Subtotal = 100.0 Sales tax = 8.75 Invoice total = 108.75

Which of the following can you assign to a String variable? a. an empty string b. null c. a string literal d. all of the above

d. all of the above

You can use the Double class to a. create an object that holds a double value b. convert double types to String objects c. convert String objects to double types d. all of the above e. b and c only f. a only

d. all of the above

Which of the following formats can you not apply using the NumberFormat class? a. currency b. general number c. percent d. fraction

d. fraction

What is the first phase of program development? a. test the program b. code the program c. design the user interface d. gather program requirements

d. gather program requirements

Bytecodes are a. ready to be executed by a Windows system b. output from the Java interpreter c. input to the Java compiler d. input to the Java interpreter

d. input to the Java interpreter

What is the key to successful usage of an app ? a. sophisticated interface b. simple interface c. colorful interface d. intuitive interface

d. intuitive interface

What is a * set* (or, group) of Java statements that can be included inside a Java class? a. activity b. intent c. block d. method

d. method

What is the return type of a method that does *not* return a value? a. double b. int c. null d. void

d. void

Which of these data types are used to store whole numbers (no decimal positions)? a. int b. long c. short d. A and B only e. all of the above

e. all of the above


Set pelajaran terkait

Lesson 7: Special Conductor Overcurrent Protection Permitted, Including Taps (2023)

View Set

Finance 314 Midterm 2 Study Guide

View Set

Chapter 31: Disorders of the Liver

View Set

CONNECTIVE TISSUES AND FASCICLES

View Set