Learning Mobile App Development A Hands-on Guide to Building Apps with iOS and Android Jakob Iversen

Page 1

Learning Mobile App Development A Hands-on Guide to Building Apps with iOS and Android by Jakob Iversen

Email: richard@qwconsultancy.com


Chapter 1 Why Mobile Apps? 1.1 True/False Questions 1. Mobile devices have most of the same features as traditional computing devices. Answer: True 2. The usability of mobile devices is typically worse than a traditional computing device, such as a desktop computer. Answer: False 3. Smartphone sales are far behind the number of traditional PCs sold. Answer: False 4. Mobile devices can be used to increase customer loyalty and brand awareness. Answer: True 5. Drastic changes in technology enable new business processes and can have profound implications for how business is conducted. Answer: True 6. The cheaper a technology is, the less impact it will likely have on business processes. Answer: False 7. Mobile technology may cause an aggressive approach to business process engineering when implementing the mobile technology. Answer: True 8. Most business apps are sold for much higher prices than consumer apps. Answer: True 9. One of the major challenges for mobile app developers is distributing their apps and managing payments from customers. Answer: False 10. Developing a mobile app has the potential to make significant amounts of money for its creator. Answer: True 11. App developers have to be very creative in coming up with a good strategy for making significant money from apps that are available in the app stores. Answer: True

1.2 Multiple Choice Questions


1. Which of the following is NOT a way that a mobile device can communicate with other devices and networks? A. Wi-Fi B. Bluetooth C. Cellular data D. GPS Answer: D 2. Which of the following is most appropriate to use for communication when the mobile device is a few feet away from another device? A. Wi-Fi B. Bluetooth C. NFC D. Cellular Answer: B 3. Introduction of smartphones and tablets in a business means that A. Most businesses can keep doing business as usual. B. Mobile devices will not have profound impact in many business sectors, but a few, such as computer companies, will have to adjust. C. Some companies that like to take advantage of new technology will have added capabilities. D. Most businesses will have to reexamine their products and processes to survive and thrive. E. Only tech-savvy companies will have to consider the implications for their business. Answer: D 4. The best way to engage customers on a mobile device is by implementing which of the following? A. A mobile version of the organization’s website B. A mobile app C. A way to allow customers to pay with NFC D. Advertising sent by text message (SMS) Answer: B 5. Which of the following is NOT an advantage of a mobile app over a mobile version of the company’s website? A. Full access to device hardware B. Capability to interact with the service when disconnected from the network C. Easier to update the content D. More responsive and richer user interface experience Answer: C


6. Which of the following is NOT an approach that companies use to engage users on mobile devices? A. Interacting with their brand in a positive way through a game B. Letting customers purchase products or services through an app C. Giving customers access to their customer data D. Using the device’s hardware sensors, such as a camera, to let customers interact with the company’s offerings E. All of the above Answer: E 7. In some situations, organizations were investing a significant amount of money in information technology without recognizing corresponding significant increases in productivity. This phenomenon is known as The ________________. A. Technology Productivity Limit B. Productivity Paradox C. Productivity Equilibrium D. Cost of Doing Business Answer: B 8. Which of the following is NOT an advantage for small businesses in adopting mobile technology compared to traditional computing platforms? A. Less costly B. Less complex C. Easily available to all employees D. Able to reduce the number of employees. Answer: D 9. When insurance customers are able to submit claims from their smartphone using a dedicated app developed by the insurance company, the benefit to the insurance company would NOT include: A. More detailed and accurate descriptions of the event B. Lower processing costs C. Lower insurance payouts D. Timelier reports of claims Answer: C 10. Which of the following is NOT a service handled by Apple and Google through their app stores? A. Billing B. Support for end users C. Distribution of apps D. Returns E. Marketing of apps


Answer: B 11. Which of the following is NOT a common way for app developers to make money from their apps through an app store? A. In-App purchases B. Merchandising C. Have users pay for the app up front D. Advertising within the app E. Subscriptions Answer: B 12. How does mobile technology facilitate process innovation? A. By providing capabilities on a mobile computing platform that are not available on traditional computing devices B. By providing a broad set of development and implementation tools C. By having a moveable technology that is available to everyone in the organization D. By bringing technology to the source of the process rather than the finish of the process Answer: A 13. Which of the following is NOT a reason identified by the chapter for mobile technology being more than a fad? A. Mobile technology allows businesses to reach their customers in new ways. B. Mobile technology automates the business process. C. Mobile technology enables business process change. D. Mobile technology provides a marketplace for people to easily sell their apps. Answer: B 14. Which of the following is NOT a reason that mobile devices are considered transformative? A. They are easily transportable and becoming ubiquitous. B. They are aware of their environment. C. They have the capability to communicate with other computing devices through a variety of mechanisms. D. They have the capability to allow data input by the user. Answer: D 15. Why is mobile technology potentially disruptive? A. Mobile technology provides many new services. B. Mobile technology is becoming ubiquitous in the business and personal world. C. Mobile technology has the potential to invalidate underlying process assumptions.


D. Mobile technology is available on a variety of platforms and devices that can be tailored to any business situation. Answer: C

1.3 Matching Questions 1. Match the following terms with their explanation. Mobile device ______ Bluetooth ______ Mobile app ______ Sensors ______ Business Process Reengineering ______ Productivity Paradox ______ App stores ______ In-App purchase ______ NFC ______ Disruptive ______ A. A mechanism built into apps that allows the user to buy additional features. B. A communications protocol that allows for communicating with other devices in distances measured in feet. C. Virtual places where consumers can purchase mobile apps created by different developers. D. Hardware features of a mobile device that allows it to get information about its physical environment. E. An approach to changing business processes. F. A smartphone or tablet capable of running apps and connecting to a network. G. The notion that implementing information technology into an organization often didn’t produce any improvements in productivity. H. Any technology that invalidates previous assumptions about what can be done in a business process. I. A program written to run on a mobile device. J. A communication protocol that allows for communicating with other devices in distances measured in inches. Answer: F, B, I, D, E, G, C, A, J, H


Chapter 2 App Design Issues and Considerations 2.1 True/False Questions 1. Porting an existing application directly to a mobile platform is a good idea. Answer: False 2. The operating system on a mobile device is not a true multitasking operating system. Answer: True 3. Only Android devices have an app life cycle. Answer: False 4. All apps must be designed to handle changes in the apps life cycle. Answer: True 5. Both Android and iOS have an app and a view life cycle. Answer: False 6. In both Android and iOS, you should turn off system services being used by the app when the app moves out of the running state. Answer: True 7. When the user changes the orientation of the device, the app that is running at the time remains in the running state. Answer: False 8. Horizontal scrolling is a good way to expand limited screen real estate. Answer: False. 9. Vertical scrolling is good for lists but should be used in a more limited fashion for other types of screen elements. Answer: True 10. Uploading and downloading of data should be done outside the main thread of the app. Answer: True 11. Uploading data outside the main thread of the app eliminates the need to check whether it has completed successfully. Answer: False 12. Battery use is not a concern for all app developers. Answer: False 13. Differences in hardware capabilities are limited between devices. Answer: False


2.2 Multiple Choice Questions 1. Which of the following is NOT an important design consideration for the app developer? A. The app life cycle B. Screen size C. Connectivity problems D. Programming language limitations Answer: D 2. Instead of multitasking, a mobile operating system places apps in different ______ when it changes between running apps. A. Life cycles B. States C. Memory locations D. Positions Answer: B 3. What is the difference between the Paused and the Stopped states in the Android life cycle? A. In the Stopped state, all hardware resources used by the app are automatically stopped. In the Paused state, they are stopped only if the developer codes them to stop. B. In the Paused state, the activity is no longer visible. In the Stopped state, the activity’s resources are reclaimed by the operating system. C. In the Paused state, the user can see but not interact with the activity. In the Stopped state, the activity is not visible. D. There is no difference. Answer: C 4. In iOS, the proper life cycle method to load data into a view is ______. A. viewDidLoad: B. viewWillAppear: C. application:didFinishLaunchingwithOptions: D. dataWillDisplay: Answer: B 5. The proper life cycle method to save app status is _____ in Android and _____ in iOS. A. onPause, viewWillDisappear: B. onResume, viewWillAppear: C. onStopped, viewDidUnload: D. onDestroy, applicationDidEnterBackground:


Answer A. 6. Horizontal scrolling is an important part of user interface design that should be used when A. The elements needed for a complete design will not fit on the screen. B. Only when an element on the screen needs to extend horizontally. C. Only when the device is in a horizontal orientation. It should not be used in the vertical orientation. D. A horizontal layout makes more sense than a vertical layout. Answer: B 7. When the user rotates the device A. The app layout automatically reorganizes for that orientation. B. The horizontal and vertical real estate remain the same because the device size does not change. C. The app remains in the running state. D. The user experience is enhanced by more accessible screen elements. Answer: A 8. When an app needs to upload data A. The app should immediately connect and transmit the data. B. The app should halt user interaction until the upload is completed. C. The app should cache the data until the user exits the app. D. The app should send the data asynchronously. Answer: D 9. When an app downloads data, that download should be performed asynchronously unless A. The connection is immediately established. B. A data signal of 3G or greater is available. C. The user cannot perform work with the app without the data. D. The data is less than 5K in size. Answer: C 10. Which of the following is NOT a reason that connectivity can be lost? A. The device moves. B. The user has the device in airplane mode. C. The app has both a 3G and Wi-Fi connection. D. Machinery or other sources produce signal interference. Answer C 11. The biggest battery drain on a mobile device is _____? A. The display


B. The GPS C. Wi-Fi D. The operating system Answer: A 12. To reduce an app's drain on the battery, the app should do which of the following? A. Never use any sensors. B. Monitor to determine whether a sensor reading needs an update before it uses the sensor. C. Shut down all activity when an app is paused. D. Use sensors only on start up. Answer: B 13. When designing an app that uses hardware sensors, two important aspects to consider with the sensor readings are ____ and _____. A. Hardware availability, distribution B. Accuracy, speed of acquisition C. Availability, start-up time D. Accessibility, communication status Answer: B 14. When designing an app that uses hardware sensors, what is it important to plan for if the device cannot provide a reading? A. What the user can do with the app without the data provided by the sensor B. How to enter the data manually C. Where to direct the user to turn on the sensor D. When to turn off the sensor Answer: A 15. If desired sensor accuracy cannot be attained immediately, what should the app be designed to do? A. Block the user until the desired accuracy level can be achieved. B. Let the user continue working with the app, but inform the user of progress toward achieving the desired level of accuracy. C. Let the user continue working with the app. D. Inform the user that the accuracy level has not been achieved. Answer: B 16. What happens to a running app if a hardware button is pressed on either platform? A. The app is destroyed. B. The app moves from the running state to another state.


C. The app is paused. D. The app is resumed. Answer: B

2.3 Matching Questions 1. Match the term with the best definition/explanation. Life cycle ______ Home button ______ State ______ Asynchronous ______ Cached ______ Orientation ______ Sensor______ onPause______ Paused______ Back button ______ A. Hardware on a device that can capture data about the device’s external environment. B. Running code outside the main thread. C. A button on an iOS device that causes an app to move through a portion of its life cycle. D. A state on an iOS device where the app is no longer visible. E. A type of existence for an app that determines what the user and the operating system can do with the app. F. The movement of an app between different states. G. Temporarily stored data. H. Can move one app to the Paused state and another app to the Running state. I. The position of a phone as it relates to the horizon. J. A method executed on an Android device when the app is interrupted. Answer: F, C, E, B, G, I, A, J, D, H


Chapter 3 Using Eclipse for Android Development 3.1 True/False Questions 1. The Android user interface screen is coded in the Java programming language. Answer: False 2. An Android app should be designed for just one API. Answer: False 3. The choice of minimum and target SDK limits how you can design your app. Answer: True 4. Most of the core functionality of an app is provided by an activity and its associated screen (called a layout). Answer: True 5. Android apps should have the same icon in different sizes. Answer: True 6. The Android Manifest file is used by the Android operating system to properly implement the app’s life cycle. Answer: False 7. The Android Manifest file is written in XML. Answer: True 8. The Android Emulator provided by Eclipse can be configured to emulate many types of Android devices. Answer: True 9. The Android screen or layout is designed primarily with the visual editor. Answer: False 10. To add behavior to a button on a layout, you must get a reference to it in the associated activity. Answer: True

3.2 Multiple Choice Questions 1. Which of the following widgets is used when you want a user to be able to enter data via the keyboard? A. TextBox B. TextView C. InputBox D. EditText


Answer: D 2. Which of the following widgets is used when you want to display static text on a layout? A. TextBox B. TextView C. Label D. LabelText Answer: B 3. What is a workspace? A. A folder on your computer where Eclipse keeps your projects B. A folder in the Android app project where source code is stored C. The location where you grab widgets to drag on to the layout D. The location in Eclipse where you write Java code Answer: A 4. How does the Play Store identify your apps? A. With a key you apply for using a code from your computer B. With a key gotten from the Google Developer Console C. With the portion of the package name prior to the application name D. With your code signature Answer: C 5. How do you limit which Android devices can download your app? A. By setting the <allowed-devices> element in the Android manifest B. By setting the application’s minimum and target SDK C. By setting the target device in the AVD manager D. Not possible, all Android devices can download apps from the Play Store Answer: B 6. Which of the following best describes an Activity? A. An element of the app’s UI B. An alternative name for a method in a Java class, used specifically by Android C. A class that has the code to provide the functionality associated with a screen in an app D. Any action taken by an Android app in response to a user selection Answer: C 7. Which of the following best describes a Layout? A. An XML file associated with an Activity to provide the UI


B. A widget that dictates how other widgets are organized C. A mockup of a screen used to design user-app interaction D. A folder that contains all the widgets available for Android UI design Answer: A 8. Which of the following holds text values for use in an Android app? A. textvalues.xml B. text.xml C. values.xml D. strings.xml Answer: D 9. Why does Android want you to store text values associated with a layout in a file rather than hardcode them? A. They are taking reusable coding to the extreme. B. To ease app maintenance. C. So the text can more easily be adapted to different languages. D. So the layouts can be used in more than one app. Answer: C 10. Which of the following files holds configuration information for an Android app? A. config.xml B. your_app_name.xml C. android.xml D. AndroidManifest.xml Answer: D 11. What is an AVD? A. A component of the Android package used to configure the user’s device B. A simulated device configuration for use with the emulator C. A manager used to emulate alternative designs D. A component of the Eclipse IDE used to update the Android SDK Answer: B 12. What is the difference between the sp and dp dimensions in Android? A. sp is used for data in an EditText and dp is used for static text. B. sp is fixed (static pixel and not relative to the user’s screen size or resolution), whereas dp is relative. C. sp is used for text and dp for other dimensions. D. Nothing—they are interchangeable.


Answer: C 13. What is the EditText attribute android:inputType used for? A. To modify the appearance of the EditText B. To enable or disable hard keyboard input C. To limit the type of data that can be entered D. To limit the data that the user can enter, to configure the soft keyboard, and to determine how the data is configured as it is entered Answer: D 14. Which of the following methods is required in an Android Activity? A. onCreate B. onPause C. onStart D. createActivity Answer: A 15. Which of the following is used to pass data between activities in an app? A. Bundle B. Structure C. Package D. DataExtra Answer: A 16. Which of the following best describes the use of the findViewById method? A. To open a view on an activity’s layout B. To get a reference to a widget on an activity’s layout C. To find a widget in the Palette D. To cast an object to a button Answer: B 17. What is an OnClickListener? A. A device that determines if the user clicked something on the phone B. An object used in conjunction with a resource (R) to listen for abnormal actions C. An object that can be added to a widget so that the widget can respond to the user tapping it D. A line of code used to respond to clicks Answer: C


3.3 Matching Questions 1. Match the term to the best definition. Activity Layout Element Widget EditText src Manifest Target SDK XML Attribute A. An object that allows a user to enter information on a layout. B. The configuration file for an Android app. C. A language used to create layout files. D. A type of object that provides the core functionality of an Android app. E. Used to declare an object in an XML file. F. The folder that holds the source code in an Eclipse Android project. G. The version of Android that the app is designed for. H. A file that defines the user interface for an activity. I. An item used to configure a widget in an XML file. J. A prebuilt user interface element. Answer: D, H, E, J, A, F, B, G, C, I


Chapter 4 Android Navigation and Interface Design 4.1 True/False Questions 1. An Activity is a class that is designed to handle a single task that the user can perform. Answer: True 2. The Activity class has no subclasses other than the ones you implement. Answer: False 3. A layout is the visual component of a user interface in Android. Answer: True 4. An Intent is a class that is used to describe an operation to be performed. Answer: True 5. An Intent is used to start new activities within an app. Answer: True 6. ImageButtons can use image files located anywhere on the development machine. Answer: False 7. Colors are defined in the color.xml file, and the specific color is defined with a name that matches the standard Crayola colors. Answer: False 8. All widgets in a layout must have an @+id. Answer: False 9. The size of an EditText is specified in “ems”. Answer: True 10. The DatePicker widget will display only at runtime. Answer: True 11. Autoformatted characters in an EditText do not count toward the total length of the input. Answer: False 12. The height and width of a widget can be set to a specific size, not just a relative size. Answer: True 13. Any button in a layout automatically responds to a click. Answer: False

4.2 Multiple Choice Questions


1. Which of the following objects is coded to handle a single user task? A. Activity B. Intent C. CustomDialog D. Task

Answer: A 2. Which of the following objects is used to start an Activity? A. Task B. Bundle C. Intent D. Launcher Answer: C 3. Which of the following objects is used to include multiple tasks within a single Activity? A. Activity B. FragmentActivity C. FragmentManager D. MultiActivity Answer: B 4. What is the relationship between a layout and a widget? A. A widget is an attribute of a layout. B. A layout is the super class of all widget classes. C. A layout is an element of a widget. D. A layout is made up of widgets. Answer: D 5. Which of the following is the correct attribute value to set the widget's width to match the size of the widget or the data it contains? A. match_content B. wrap_content C. fill_to_content D. match_size Answer: B 6. Which of the following is the correct attribute value to set the widget's height to match the size of the widget that contains it? A. match_parent B. fill_container


C. match_container D. expand_to_parent Answer: A 7. Which of the following is the best description of the function of this attribute: layout_marginLeft=”20dp”? A. Positions the widget 20dp to the left of the parent B. Positions the widget 20dp to the right of the parent C. Positions the widget 20dp from the widget on its left D. Positions the widget 20dp from the widget on its right Answer: C 8. Which of the following attributes would you use to position a widget right at the bottom of a RelativeLayout? A. layout_alignParentBottom=true B. layout_alignBottom C. layout_bottomPadding=0dp D. alignRootBottom Answer: A 9. Which of the following is the proper way to name a widget textViewTest? A. id=textViewTest B. @id=textViewTest C. @+id/textViewTest D. id :textViewTest Answer: C 10. How do you place more than one widget in a ScrollView? A. Set the ScrollView attribute: canContainMultiple to true. B. Place them within a layout within the ScrollView. C. Trick question. By definition, a ScrollView can contain only one widget. D. Trick question—just like placing in any other layout. Answer: B 11. The unit of measure “ems” specifies the size of an EditText as what? A. The number of metric dynamic pixels B. A shorthand for “millimeter“ size of the EditText C. The number of characters that can be displayed in it D. The number of capital Ms that can be displayed in it


Answer: D 12. How is tabbing implemented in an Android layout? A. Using the attribute layout_tabNumber=#. B. Using the attribute imeOptions=actionNext. C. Using the attribute tabOrder in the root layout. D. Trick question. It's done in the code, not the layout. Answer: B 13. Which of the following best describes the function of the following EditText attribute: inputType=”textCapWords”? A. Displays a soft keyboard with alpha characters and capitalizes all words as they are entered B. Displays a soft keyboard with alpha and beta characters and capitalizes the first word of a sentence C. Displays a normal QWERTY keyboard and numeric characters D. Has no impact Answer: A 14. Which of the following is the best dimension to use when setting the size of a TextView? A. dp B. sp C. ems D. px Answer: B 15. When is the attribute nextFocusDown used? A. When tabbing from a widget within a ScrollView to one outside it B. When tabbing from an EditText to a Button C. Whenever the imeOption attribute is used D. When it is not clear which is the next widget that should be tabbed to Answer: D 16. In a TableLayout, you define what? A. The table, the rows, and the cells B. The number of rows with the layout_rows= attribute in the TableLayout C. Rows but not cells D. Only rows that have a different number of cells than the other rows Answer: C 17. Which of the following best describes the function of the setContentView= attribute of a layout?


A. It associates a layout with an activity. B. It embeds another layout file within the current layout. C. It tells the layout which Palette library to get its widgets from. D. Trick question—setContentView is code in the activity class. Answer: D 18. Which of the following best describes the function of Intent.FLAG_ACTIVITY_CLEAR_TOP? A. It tells the Intent to remove the last activity and start the previous one. B. It clears all previous data from the new activity. C. It's used in an Intent to tell the Android OS not to make multiple copies of the same activity. D. It's used in an Intent to put the current activity in the Paused state. Answer: C 19. Which of the following is used by the activity to get a reference to a widget in a layout? A. findViewById B. getWidgetWithId C. layoutWidget= D. getWidget= Answer: A 20. Which of the following is the best description of an OnClickListener? A. A widget used to get a button to perform some operation B. An activity object that responds to all user touches or clicks the activity’s layout C. An attribute of a button widget to associate to code D. An object used in the activity code to make a widget respond to a user touch Answer: D 21. What is the final keyword used for? A. To stop a variable assignment from changing during execution B. To create a class variable for the activity C. To create a constant D. To preserve the variable value between life cycles Answer: A 22. Which of the following is the correct code for disabling an EditText? A. disable() B. setEnabled(false) C. setDisabled() D. enabled(false)


Answer: B 23. What does the interface do that is declared in a DialogFragment? A. Allows the custom dialog to present a user interface B. Handles the response to all user input to the dialog C. Allows the dialog to be declared in the Activity D. Enables communication of the dialog result back to calling activity Answer: D 24. How does the time object store dates and times? A. Days since the millenium plus seconds from midnight. B. Short Gregorian format. C. Number of milliseconds from 1/1/1970. D. Trick question. It stores only time, not dates. Answer: C 25. What is the function of the FragmentManager? A. Displays activities in any app running on a device running SDK 11 or earlier B. Displays and keeps track of all fragments displayed in an activity C. Manages the active widgets on the UI D. Retrieves data from dialogs Answer: B

4.3 Matching Questions 1. Match the term to the best definition. Intent Widget RelativeLayout Milliseconds FragmentManager @+id match_parent ScrollView inputType maxLenth A. An attribute that specifies the number characters that can be input in an EditText. B. A layout that can have only one widget in it. C. An object used to start activities.


D. An object used when an activity wants to display custom dialogs. E. An attribute that specifies how data is formatted in an EditText. F. Used to name a widget. G. A measurement of time. H. An object that allows widgets to be positioned by referencing one another. I. A specification of widget height or width. J. Any object used in a layout. Answer: C, J, H, G, D, F, I, B, E, A


Chapter 5 Persistent Data in Android 5.1 True/False Questions 1. Android apps can only store data in a SQLite Database. Answer: False 2. The SharedPreferences object is used to store single bits of primitive data in a key/value pair. Answer: True 3. Data stored in a SharedPreferences object persists even if the app is uninstalled. Answer: False 4. SQLite is a fully functional, relational database management system. Answer: True 5. The database version number of a SQLite database has no functional implications. Answer: False 6. To use SQLite in an Android app, you must implement your own subclass of the SQLiteOpenHelper object. Answer: True 7. Implementing a data source object is required to use SQLite in an Android app. Answer: False 8. Primitive data may not be passed to a SQLite data source object. Only object data is allowed. Answer: False 9. The soft keyboard is automatically dismissed by the system when data is saved. Answer: False 10. Data persists in a SharedPreferences object throughout the phases of the activity life cycle. Answer: True 11. Flat files in Android are read and written as a stream of characters. Answer: False 12. Flat files in Android can be stored on either internal or external storage. Answer: True 13. Flat files in Android stored on an SD card are private to the app that stores them. Answer: False


5.2 Multiple Choice Questions 1. When data is made to exist through many iterations of an app’s life cycle, it is said to ______? A. Persist B. Stored C. Archive D. Continue

Answer: A 2. The object used to make primitive bits of data persist across changes in the app life cycle is the _____ object. A. DatabaseHelper B. SharedPreferences C. OutputStream D. Persistent Answer: B 3. The method used to store and retrieve primitive data that only needs to be used by one activity is? A. getPrimitiveData B. getSharedPreferences C. getPreferences D. getActivityData

Answer: C 4. Which of the following objects would be used to read a flat file in an Android app? A. CharacterInputReader B. ByteInputReader C. InputStreamReader D. FileInputStream Answer: D 5. Which of the following is the language used to read and write data to a SQLite database? A. Java B. Structured Query Language C. Objective C D. Relational Query Language

Answer: B 6. Which of the following best describes the function of the Database helper class?


A. To read and write data to a SQLite database B. To provide methods to access the data in a SQLite database C. To create and upgrade a SQLite database D. To open and close a SQLite database Answer: C 7. When is the onUpgrade method of a SQLite database executed? A. Whenever the database is accessed B. Whenever the data in the database is updated C. Whenever the database version number is incremented D. The first time the database is accessed after the version number has been incremented

Answer: D 8. Which of the following components of Eclipse is used to collect and view system debug information? A. LogCat B. DebugPerspective C. SystemDebug D. DebugConsole Answer: A 9. When should a SQLite database be closed? A. Never. The OS determines if it should be closed. B. In the onPause method of the activity that uses the database. C. In the onDestroy method of the activity that uses the database. D. As soon as the activity is done using the database.

Answer: D 10. The SQLite database’s insert method returns what? A. True if the insert was successful, false if it failed. B. 0 if the insert was successful, -1 if it failed. C. The number of rows successfully inserted. D. It does not return anything. Answer: C 11. Which of the following is the best description of the ContentValues object? A. It is an object used to hold a set of key/value pairs. B. It is an object used to add data to a database. C. It is an object used to make data persist. D. It is an object used to store complex data in a data set.


Answer: A 12. Which of the following is the best description of a TextWatcher object? A. It is an object used to format data as it is entered into a TextView. B. It is an object used to detect changes in data entered into an EditText. C. It is an object used to detect changes in the data in the database to ensure database integrity. D. It is not a real object. The correct object is TextListener. Answer: B 13. Which of the following would be the best event to format user-entered data as it is typed? A. afterTextChanged B. onFormatText C. onTextChanged D. onFocusLost

Answer: C 14. Which of the following objects is required to hide the soft keyboard? A. KeyboardManager B. KeyboardSystemService C. InputSystemService D. InputMethodManager Answer: D 15. Which of the following best describes a Cursor object? A. It is an object used to manage screen tabbing through activity code rather than in XML. B. It is an object used to hold and navigate through a query’s result set. C. It is an object that executes a database query. D. It is an object that both executes and manages query results.

Answer: B 16. When are cursors closed automatically? A. When there is only one record produced by the query. B. When the cursor reaches the end of its data. C. When the cursor goes past the end of its data. D. Cursors are never closed automatically. Answer: D 17. Why would you use a RadioGroup with a set of RadioButtons rather than just use the RadioButtons by themselves? A. Because the RadioGroup makes the buttons interdependent without coding.


B. Because the RadioGroup allows you to access the individual RadioButtons by executing only one findViewById method in the code. C. Because the RadioGroup negates the need to provide separate IDs for each button. D. You would never do this.

Answer: A 18. The edit() method is used with a SharedPreferences object to do what? A. Save primitive data in a key/value pair B. To enable the insertion of a key/value pair into the SharedPreferences object C. To insert and save a key/value in the SharedPreferences object D. To modify the characteristics of the SharedPreferences object. Answer: B 19. The commit() method is used to do what? A. Make updates to the database persist B. Make modifications to the SharedPreferences object persist C. Make the SharedPreferences object persist through life cycle changes D. Modify the characteristics of the SharedPreferences object

Answer: B

5.3 Matching Questions 1. Match the term to the best definition/explanation. Persistent data SharedPreferences SQLiteOpenHelper ContentValues TextWatcher Breakpoint RadioGroup LogCat Relational Database FileOutputStream A. A point in the code set to stop program execution during debugging. B. An object that must be subclassed in an app to use a SQLite database. C. A way to store data in a set of related tables. D. An object used to make bits of primitive data persist. E. An object that can be associated with an EditText to identify changes in the content of the EditText.


F. A widget used to group a set of RadioButtons. G. An object used to write flat files. H. Data that continues to be available through many iterations of the app life cycle. I. A system for collecting and viewing system debug information. J. An object used to store data as a set of key/value pairs. Answer: H, D, B, J, E, A, F, I, C, G


Chapter 6 Lists in Android: Navigation and Information Display 6.1 True/False Questions 1. The widget used to display a list in an Android layout is TableView. Answer: False 2. A list can be directly linked to its underlying data source. Answer: False 3. An Adapter object is used to connect the UI component of an Android app to a data source. Answer: True 4. An Activity that uses a list must always be converted into a ListActivity. Answer: False 5. An ArrayAdapter is used to bind an Array or ArrayList to a view. Answer: True 6. To get the full functionality of the ListActivity, the ListView widget can have any @+id that makes sense. Answer: False 7. To get the tap of an item in a list to do more work, such as start another activity, you have to add a listener to the ListView widget. Answer: True 8. For proper execution, ArrayList must be told what type of objects it can hold. Answer: True 9. Adapters cannot be subclassed. Answer: False 10. A list adapter creates a list item for every item in the underlying data source. Answer: False 11. A list item can contain only TextView widgets. Answer: False 12. Changes to the underlying data source are not automatically displayed on the list. Answer: True 13. The only way to change the app’s first activity is to modify the manifest file. Answer: True


6.2 Multiple Choice Questions 1. Which of the following is not a subclass of AdapterView, a view that is bound to an underlying data source? A. ListView B. GridView C. Spinner D. TableView

Answer: D 2. Which of the following IDs allows the developer to take advantage of built-in features of the SDK for displaying data in a vertically scrollable form? A. @id/android:list B. @id/android:scrollableList C. @+id/autoList D. @+id/listView1 Answer: A 3. Which of the following is the best description of an Adapter? A. A View that allows the user to scroll through a list of data B. An Object that connects a View to an underlying data source C. A Widget that connects a displayed list to an Array D. An Object that connects a data source to an Activity

Answer: B 4. Which of the following is not a subclass of BaseAdapter? A. ArrayAdapter B. CursorAdapter C. DataAdapter D. SimpleAdapter Answer: C 5. Which of the following is the best description of an ArrayList? A. An Array that can be designated to hold only certain types of objects B. An Array that can grow and shrink in size C. A List that can hold/display an Array D. An Object that can hold Arrays

Answer: B


6. Which of the following best explains the following code: ArrayList<Time> myTimes; A. Assigns the myTimes object to an ArrayList that can hold Time objects B. Instantiates an ArrayList object that can only hold Time objects C. Instantiates a Time object within an ArrayList called myTimes D. Declares a variable called myTimes as an ArrayList that can only hold Time objects Answer: D 7. Which of the following is the best description of a Cursor object? A. An object that declares a SQLite database query B. An object that executes a query C. An object that holds the results of a query D. An object that executes and holds the results of a query

Answer: C 8. Which of the following is the correct code to advance the cursor one record in the dataset? A. cursor.move(); B. cursor.moveToNext() ; C. cursor.step() ; D. cursor.move(1); Answer: B 9. Which of the following is the correct code to determine if the cursor is at the end of the dataset? A. cursor.isDone() B. cursor.atEnd() C. cursor.isLast() D. cursor.isAfterLast()

Answer: D 10. Which of the following will retrieve integer data from the second item in the current record of the dataset? A. cursor.getInt(1) ; B. cursor.getInt(2) ; C. cursor.intValueOf(1) ; D. cursor.intValueOf(2) ; Answer: A 11. The code getListView() replaces which of the following lines of code? A. (ListView) getList(Id.list) ; B. (ListView) findViewById(R.id.list) ; C. (List) getListById(list) ; D. getList(R.id.listView) ;


Answer: B 12. Which types of widgets, by default, control all clicks of a list item? A. Button. B. EditText. C. No widgets do that. D. All widgets that respond to a user event. Answer: D 13. How do you stop a widget from controlling all user actions on a list item? A. Set the widget’s focusAfterParent attribute to true. B. Set the widget’s enabled attribute to false. C. Set the following widget attributes to false: focusable and focusableInTouchMode. D. This does not need to be done. No widget can take over the parent list item.

Answer: C 14. Which of the following best describes the function of the getView method in a custom adapter? A. Retrieves any instance of View B. Creates a list item view and puts data in it C. Creates or reuses a list item and populates it with the required data D. Reuses a list item view Answer: C 15. What is the term used to describe making a layout usable in code? A. Instantiate B. Inflate C. Create D. Substantiate

Answer: B 16. Which of the following is the best description of a list item? A. A layout with data associated with a single item in the underlying data source B. A widget that can display individual pieces of data (or data sets) C. A view that is always reused D. A view that is never instantiated but rather retrieved from the system service Answer: A 17. What is the function of this line of code: intent.putExtra(“myAge”, 21);? A. Stores 21 with the key “myAge” in the Activity B. Places a key/value pair in the intent’s bundle to be delivered to the activity being started


C. Stores 21 with the key “myAge” in SharedPreferences D. Starts an intent with 21 as the value for myAge

Answer: B 18. What does the database.delete method return after execution? A. -1 if the delete failed, 0 if it succeeded B. -1 if the delete failed, 1 if it succeeded C. True if the delete succeeded, False if it failed D. The number of rows deleted Answer: D 19. Which of the following is used to notify the ListView to update its display because the underlying data was changed? A. refreshDisplay() ; B. displayNeedsRefreshing() ; C. notifyDataSetChanged() ; D. updateWithChangedData() ;

Answer: C 20. How do you stop a list item from responding to a user click? A. Set the list’s onItemClickListener to null ; B. RemoveOnClickListener() ; C. Reload the ListView with a new adapter. D. disableOnClickListener(true) ; Answer: A 21. Which of the following is the best description of when the onResume method will execute? A. At activity start B. Anytime the activity is about to become visible C. Immediately after the user touches any part of the app UI D. Whenever the user navigates between activities Answer: B

6.3 Matching Questions 1. Match the following terms to the best explaination/definition. ListView Adapter


ArrayAdapter ListActivity android:list <aClassName> getView notifyDataSetChanged onResume DateFormat A. The method used to populate a list item in a custom adapter. B. An object used to connect a ListView to an Array or ArrayList. C. The method executed every time just before the activity is fully visible. D. The ListView ID required for the ListView to be used in a ListActivity. E. A widget that displays data in a vertically scrollable table. F. The method used to tell a ListView to refresh its display. G. An Activity subclass that implements special list functionality. H. An object used to display the value of a Time object as a specific string. I. The super class of all objects that connect ListViews to an underlying data source. J. The syntax used to tell an ArrayList that it can hold only a certain type of data. Answer: E, I, B, G, D, J, A, F, C, H


Chapter 7 Maps and Location in Android 7.1 True/False Questions 1. To use both the network and GPS location services, you must instantiate two LocationManagers. Answer: False 2. A LocationListener must be instantiated for the location sensor you want to get location data from. Answer: True 3. A location change identified by the location sensor is broadcast as an Intent with Extras. Answer: False 4. Location changes detected by the location sensors is reported as a Location object. Answer: True 5. The map used in Android is a widget available to any Activity. Answer: False 6. You need an Application Program Interface key to display maps on an Android device. Answer: True 7. You cannot use a standard Activity if you want to display a Map in an Android device. Answer: True 8. A Location object reports latitude and longitude but not accuracy. Accuracy is reported by the listener directly. Answer: False 9. To use maps, you must implement code provided by Google that has nothing to do with map functionality. Answer: True 10. Geocoding is the process of changing an address into GPS coordinates. Answer: True 11. Your app must always check to see that the new reported location is better than the last reported location. Answer: False 12. Markers on a map can contain a title but no other data. Answer: False 13. A map type (satellite, street) is set at map creation and cannot be changed. Answer: False


14. A change in accuracy is reported as a new Location. Answer: True 15. An app needs several permissions to use a Google map. Answer: True 16. You cannot get a device’s GPS location from a Google map. Answer: False 17. You cannot add multiple markers to a Google map. Answer: False 18. The standard marker on a GoogleMap object can be replaced with a custom image. Answer: True

7.2 Multiple Choice Questions 1. Which of the following best describes a LocationManager? A. An object that reports location changes to an app B. A system service that can start and stop the network sensor but not the GPS sensor C. A system service that can request location updates from the network and GPS sensors D. An object that is subclassed in a MapFragment Activity

Answer: C 2. Which of the following best describes the onLocationChanged method? A. A required method of a LocationListener that responds to any reported Location object B. A required method of a LocationListener that responds only to Location objects that are newer C. A method of the LocationManager that formats a Location object for use in an app D. A method of the Location object that responds to the detection of a new location Answer: A 3. Which of the following best describes a MapFragment? A. A subclass of Activity B. A GoogleMap object embedded in a layout file C. A subclass of FragmentActivity D. A dialog used to display a map

Answer: B 4. Where is your Android Map's API key embedded in the app?


A. The MapFragment B. The GoogleMap object C. The onCameraActivate method D. The manifest file Answer: D 5. Where do you get an Android Maps API key? A. The Developer Console B. The API Console C. The Debug Keystore D. The Google Keystore

Answer: B 6. Which of the following is the correct variable declaration to hold the results of a call to the Geocoding service? A. Coordinates returnedCoords B. Address[] returnedAddresses C. List<Address> returnedAddresses D. Array[Address] returnedAddresses Answer: C 7. Why should the call to the Geocoder service be protected with a try and catch statement? A. Because the results of the call to the service are outside the control of the developer. B. Because Geocoding is inherently error prone. There might not be a GPS location. C. Because Geocoding is not in the Android SDK. D. It should not be used with a try and catch.

Answer: A 8. Which of the following is the best description of a Location object? A. An object that detects a change in location reported by the network or GPS sensor. B. An object that is created when a location change is detected by the network or GPS sensor. C. An object that responds to onLocationChanged. D. Any object that contains location or Geocoding data. Answer: B 9. What is a Toast? A. An object created when the GPS or network sensors fail to detect any location B. An object created when the sensors produce a location detection outside the bounds of the requestUpdates parameters C. An object that reports errors through onLocationChanged D. An object that displays a short message on the user screen for limited amount of time


Answer: D 10. Which of the following objects can turn off the GPS sensor? A. LocationManager B. LocationListener C. LocationSensor D. GPSManager Answer: A 11. Which sensor produces the most accurate location determinations? A. Network sensor B. Wi-Fi sensor C. Position sensor D. GPS sensor Answer: D 12. After your app sets MyLocationEnabled to true, what do you need to do to detect the device’s location? A. Nothing. Enabling this displays and reports GPS coordinates to the map. B. Add a OnMyLocationChangeListener to the FragmentActivity. C. Add the onMyLocationChanged method to the FragmentActivity. D. Set a new LatLng point to track the device’s location. Answer: B 13. Which of the following is NOT a type of map that can be set for a GoogleMap object? A. NORMAL B. SATELLITE C. TERRAIN D. STREET Answer: D 14. Which of the following is the method that is used to zoom the map to a specific location? A. animateCamera B. zoomTo C. displayMap D. zoomLevel Answer: A 15. Which of the following is the correct method to add a marker to a GoogleMap object?


A. displayMarker B. animateMarker C. addMarker D. addPinWithImage Answer: C 16. Which of the following objects is used to collect a set of locations for display on a GoogleMap object? A. LatLngSet B. LatLngBounds.Builder C. LatLngPointSet D. GpsPointSet.BoundingBox Answer: B

7.3 Matching Questions 1. Match the following terms with the best definition or explanation. requestLocationUpdates LocationManager GoogleMap object FragmentActivity Location Geocoding onMyLocationChange isBetterLocation LocationListener Snippet A. An object that holds the data reported from a LocationListener. B. The method used to start listening for location changes from a location sensor. C. Text that is displayed when the user touches a marker on a map. D. An object in an SDK separate from the Android SDK. E. An object that determines what an app will do when its location changes. F. The method used to get location updates from a map. G. A system service object that can request location updates from either location sensor. H. A procedure to turn a street address into GPS coordinates. I. A method not provided by the map, or any other object in the Android SDK. J. An activity used to display multiple Activities on a single layout. Answer: B, G, D, J, A, H, F, I, E, C


Chapter 8 Access to Hardware and Sensors in Android 8.1 True/False Questions 1. All hardware features on an Android device are accessed through a Manager. Answer: False 2. The Android platform supports about 12 different sensors. Answer: True 3. A SensorEvent is an object created by the SensorEventListener. Answer: False 4. The SensorManager object is never instantiated. It is a system service. Answer: True 5. Access to the phone and camera is made through calls to their API. Answer: True 6. Accessing information about the device’s battery requires use of a SensorManager. Answer: False 7. The SensorManager broadcasts every few seconds with an update on the sensor’s status. Answer: False 8. An IntentFilter is used with a BroadcastReceiver to limit the Intents that it responds to. Answer: True 9. BroadcastReceivers must be registered with the appropriate Manager to receive broadcast Intents. Answer: True 10. To use a sensor, you must instantiate a SensorEventListener. Answer: True 11. An app requires a permission in its manifest to use the Camera but not the Phone. Answer: False 12. To use the phone, you must first create an Intent. Answer: True

8.2 Multiple Choice Questions 1. What is a sensor?


A. Any hardware resource on an Android device B. A device that reports the status of hardware components, such as the battery, on an Android device C. A hardware device that captures information about the Android device’s environment D. A hardware device that is used by the Android device to interact with its environment or other devices

Answer: C 2. Which of the following best describes a SensorManager? A. A system service used by an app to interact with a sensor B. An object that can send Intents to update sensor readings C. An object that can receive Intents with status updates from sensors D. An object used to manipulate sensor capabilities Answer: A 3. Which of the following best describes a BatteryManager, Power Manager, and StorageManager? A. Objects that produce the appropriate event when status changes (for example, BatteryEvent). B. System services that monitor the status of hardware on the Android device C. Objects that listen for hardware status changes D. Objects that are instantiated by an app to monitor the specific device

Answer: B 4. Which of the following objects limits what a BroadcastReceiver can respond to? A. EventFilter B. ReceivedAction C. ActionResponder D. IntentFilter Answer: D 5. Which of the following objects is used to listen for Intents sent from inside or outside an app? A. IntentFilter B. ActivityFilter C. BroadcastReceiver D. IntentReceiver

Answer: C 6. Which of the following is the best description of the Extras object? A. An object used to identify all the sensors on an Android device B. An object that is used to send data with an Intent C. An object used to expand the events that a BroadcastReceiver can respond to D. An object used to capture Sensor status changes


Answer: B 7. Which of the following is the correct code to get a reference to an Android device’s proximity sensor? A. sensorManager.getSystemService(TYPE_PROXIMITY) B. getSystemService(Context.PROXIMITY_SENSOR) C. getSystemService(Sensor.TYPE_PROXIMITY) D. sensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY)

Answer: D 8. Which of the following best describes a SensorEventListener? A. A private class instantiated in an app to respond to SensorEvents B. A system object used to respond to SensorEvents C. A sensorManager method used to respond to SensorEvents D. An object that responds to Intents sent by a Sensor Answer: A 9. Which of the following is the correct code to call a phone number from within an app? A. startActivity(Intent.ACTION_CALL) ; B. startActivity(new Intent(Uri.parse(phoneNumber))) ; C. startActivity(new Intent(Intent.ACTION_CALL).setData(Uri.parse(“tel :“+phoneNumber))) ; D. startIntent(new Intent(Uri.parse(“tel :“+phoneNumber))) ;

Answer: C 10. What is the difference between a URL and a URI? A. A URL is used only with a web browser, whereas a URI can be used only locally. B. A URL identifies a location on the Web, whereas a URI can be used to identify a local resource. C. A URL identifies a resource anywhere, whereas a URI can only be used to access a resource external to an app. D. No difference. They can be used interchangeably. Answer: B 11. What is the function of the requestCode when you execute the method startActivityForResult? A. It is used by the onActivityResult method to determine if the result it received is one it should respond to. B. It is used by the IntentFilter to identify which service to start. C. It is used by the Android OS to determine which service to start. D. It is used by the Android OS to determine if the app has permission to start a service.

Answer: A


12. Which of the following data is needed to start an Activity for a result? A. The service to start and a timestamp for the request B. An Intent that identifies the service to start and the BroadcastReceiver that will respond to the result C. The name of the service to start and a result Intent D. An Intent that identifies the service to start and a unique code to identify the result Answer: D 13. Which of the following is the SQLite data type used to store a picture? A. bytearray B. blob C. bytestream D. bitmap

Answer: B 14. A variable that holds an image provided by the camera should be declared as what type? A. Image B. ImageButton C. Bitmap D. ByteArray Answer: C 15. Before an image can be stored in the SQLite database, it must convert to a _____? A. ByteArray B. Bitmap C. Blob D. ImageMap

Answer: A

8.3 Matching Questions 1. Match the term to the best definition. SensorEvent getSystemService BroadcastReceiver SensorEventListener URI onActivityResult onSensorChanged


setData ByteArrayInputStream Bitmap A. An object that can receive Intents from activities. B. A method executed when an external resource completes its requested work. C. An object used to read a blob from storage. D. An object produced when the status of the accelerometer changes. E. An object used to hold a picture. F. An object used to identify a local resource. G. An object that is registered with a Manager to respond to status changes of a system service. H. A method executed when a sensor reading changes. I. A method used to get a reference to a SensorManager. J. A method used to tell an Intent what it wants to do. Answer: D, I, A, G, F, B, H, J, C, E


Chapter 9 Using Xcode for iOS Development 9.1 True/False Questions 1. Eclipse is the IDE most commonly used to develop iOS apps. Answer: False 2. A Universal iOS app is one that can run on iPads, iPhones, and iPod touches. Answer: True 3. Wiring up an outlet will add a method to the underlying code. Answer: False 4. Wiring up an action will add a method to the underlying code. Answer: True 5. The user interface for an iOS app is designed primarily in code. Answer: False 6. iOS apps should have the same icon in different sizes. Answer: True 7. The keyboard that shows up when the user types in text can be configured to fit the type of data the user is expected to enter. Answer: True 8. The launch image is recommended to contain information about the developers of the app. Answer: False 9. The app delegate contains graphics for use in the app. Answer: False 10. A Text Field is used to allow the user to enter text using the onscreen keyboard. Answer: True

9.2 Multiple Choice Questions 1. A Universal iOS app can run on which of the following types of devices? A. iPad B. iPhone C. iPod touch D. All of the above


Answer: D 2. What is the Storyboard used for? A. Writing the program logic for the app B. Designing the user interface for the app C. Uploading the app to the App Store D. Describing the functionality of the app Answer: B 3. Which type of file contains the program logic for a portion of an app? A. Main.Storyboard B. Images.xcassets C. ViewController.m D. AppDelegate.m

Answer: C 4. How do you limit which iOS devices can download your app? A. By setting the target device setting in the app’s Plist file. B. By changing the Deployment Target setting on the Project Summary screen. C. By setting the app’s minimum Scheme number. D. Not possible. All iOS devices can download apps from the App Store. Answer: B 5. What is the effect of changing the Scheme within Xcode? A. Changes the minimum iOS version that the app will target B. Determines which set of icons to use in the app C. Changes the look and feel of the app D. Changes the device used by the simulator

Answer: D 6. Which of the following UI objects is used when you want a user to be able to enter data via the keyboard? A. Label B. Text Field C. EditText D. Text Box Answer: B 7. Which of the following UI objects is used when you want to display static text on a screen? A. Label B. Text Field


C. LabelText D. Outlet

Answer: A 8. What is the primary purpose of an outlet in an iOS app? A. This is a place where apps are sold at a discount. B. Provides a name for a user interface element that can be used in code. C. It’s a way to provide feedback to the user about what the app is doing. D. The method that is called when the user interacts with a UI control. Answer: B 9. What is the primary purpose of an action in an iOS app? A. Provides a name for a user interface element that can be used in code B. A general term for an Obective-C method C. The method that is called when the user interacts with a UI control D. A name for any user interaction with a UI control

Answer: C 10. What does it mean that a device is equipped with a retina screen? A. Nothing. It’s just a marketing term. B. The screen has an anti-glare coating. C. The programmer has to use points instead of pixels when determining how to lay out the user interface. D. The screen resolution is doubled in both directions. Answer: D 11. Which of the following is NOT a graphic asset that is used with an iOS app? A. Launch image B. App Icon C. Profile picture D. App Store icon Answer: C 12. When wiring up an outlet, what happens in the underlying code? A. A property is added to the code. B. A method is added to the code. C. It reformats the indentation in the code file. D. Nothing. It is only related to the user interface. Answer: A


13. Which of the following is not a type of keyboard available in iOS apps? A. Number Pad B. Email Address C. Phone Number D. Voice Entry Answer: D 14. A launch image in the resolution 640x1136 should be supplied for which type of device? A. iPad Air B. iPad Mini C. iPhone 5 D. iPod touch 4th generation Answer: C 15. What is Apple’s recommendation about the content of the launch image? A. A splash screen with a graphic that represents the app. B. A blank version of the app’s first screen. C. Information about the developers of the app and the app version number. D. Nothing. A launch image is not recommended by Apple. Answer: B

9.3 Matching Questions 1. Match the term to the best definition. Outlet Action Storyboard Retina screen Label Text View Scheme Universal app Asset Catalog Launch image A. A tool used to design the interaction between multiple screens in an app. B. A user interface element used to display static text. C. A connection between a user interface element and the code allowing for referencing the element in code. D. A screen technology where the resolution has been doubled in both directions.


E. A user interface element allowing for input from the keyboard. F. An app that is targeted at both iPhone and iPad. G. An image that is displayed when the app is launching. H. A container for graphical images used in the app. I. An identification of a particular device to be used for executing an app. J. A connection between a user element and the code with a method that is called when a certain event happens. Answer: C, J, A, D, B, E, I, F, H, G


Chapter 10 iOS Navigation and Interface Design 10.1 True/False Questions 1. The Tab Bar Controller shows up at the bottom of iPhone apps and allows the user to choose between different screens in the app. Answer: True 2. All user interface elements must be wired to an outlet. Answer: False 3. The Navigation Controller is used to allow the user to drill down through multiple screens while keeping track of the path so the user can later go back the same way. Answer: True 4. All user interface screens in an iOS app are described in the storyboard. Answer: False 5. The Attributes Inspector is used to specify connections between code and user interface elements. Answer: False 6. The Connections Inspector is used to specify connections between code and user interface elements. Answer: True 7. Images used for the Tab Bar icons must be exactly 20x20 pixels. Answer: False 8. A Scroll View can allow the user to zoom in on an image. Answer: True 9. A Date Picker can be used to choose a time. Answer: True 10. A Scroll View can be used to dismiss the keyboard from the screen. Answer: True

10.2 Multiple Choice Questions 1. Which of the following allows the user to choose from different screens in an app? A. Navigation Controller B. Tab Bar Controller C. Screen Controller


D. View Controller

Answer: B 2. Which of the following allows the user to move through multiple screens and back again the same way? A. Navigation Controller B. Tab Bar Controller C. Path Controller D. Table Controller Answer: A 3. After adding a new View Controller to the Storyboard, how do you add it into the Tab Bar? A. Specify the connection in the Connection Inspector. B. Control-drag from the Tab Bar to the new View Controller. C. Drag a segue from the toolbox to connect the two. D. Control-drag from the new View Controller to the Tab Bar.

Answer: B 4. How do you change the title of a View Controller? A. Add this code to viewDidLoad: viewController.title = “<Title of Controller>”; B. Change the Title property in the Connections Inspector. C. Double-click the Title in Interface Builder and type a new one. D. Change the Title property in the Attributes Inspector. Answer: D 5. Why is it recommended to NOT use the system icons for Tab Bar icons? A. It’s not allowed by Apple. B. It allows for higher resolution than the icons Apple provides. C. It allows for a greater variety than the icons Apple provides. D. Trick question: You can’t add icons to the Tab Bar.

Answer: C 6. What’s the difference between 1x and 2x graphics? A. 2x are for iPad and 1x are for iPod touch and iPhone. B. 2x are used for retina screens and are supposed to be twice the resolution of 1x. C. 2x are more expensive versions of the graphics. D. 2x allows the device to run faster than the 1x files. Answer: B 7. How do you add multiple controls to a Scroll View?


A. Select all the controls and control-drag onto the Scroll View. B. Use the Connections Inspector to specify which controls to include in the Scroll View. C. Use the Assistant Editor and control-drag into the ScrollView.h file. D. Select all the controls and then choose Editor > Embed In > Scroll View.

Answer: D 8. What is the content size used to specify for a Scroll View? A. The size of the widest control included in the Scroll View B. The size of the rectangle that is scrolled C. The size of the rectangle that encompasses all the controls in the Scroll View D. The size of the screen Answer: B 9. Which of these is NOT a valid way to use a Scroll View to dismiss the keyboard? A. Dismiss interactively B. Dismiss on drag C. Dismiss on tap D. Do not dismiss

Answer: C 10. How do you add a View Controller to a Navigation Controller using Storyboard (in an app with no pre-existing Navigation Controllers)? A. Control-drag from the View Controller to the Navigation Controller. B. Use the Connections Inspector to specify that the View Control should be embedded in the Navigation Controller. C. Select the View Controller and choose Editor > Embed In > Navigation Controller. D. Drag a Navigation Controller from the toolbox and drop it on top of the View Controller. Answer: C 11. How do you add a View Controller to a preexisting Navigation Controller using Storyboard? A. Control-drag from a control on one controller to the second controller and choose Push on the pop-up menu. B. Control-drag from a control on one controller to the .h file for the other controller and add an Action to Push the controller. C. Select the View Controller and choose Editor > Embed In > Navigation Controller. D. Use the Connections Inspector to specify that the View Control should be embedded in the Navigation Controller. Answer: A 12. Which of the following is the correct method for disabling a Text Field called txtField? A. [txtField.disable()]


B. [txtField setEnabled:NO] C. [txtField setDisabled:YES] D. [txtField.enabled(NO)] Answer: B 13. How is the maximum date value set for a Date Picker? A. Use the Size Inspector to set the Maximum Date Constraint. B. It can’t be set. C. Control-drag from the Date Picker to the Date Controller and choose Maximum Date in the popup menu. D. Use the Attributes Inspector to set the Maximum Date Constraint. Answer: D 14. Which of these classes can be used as the basis for allowing the user to drag content horizontally and vertically on the screen? A. UIDragView B. UIView C. UIScrollView D. UISlider Answer: C 15. What is the Dock used for in Xcode? A. Choosing a specific user interface element to work with. B. It holds all the user interface elements that can be dragged into the app. C. It has the list of all the files in the project. D. It’s the place where you control execution of the app. Answer: A

10.3 Matching Questions 1. Match the term to the best definition. Attributes Inspector Segmented Control Connection Inspector Navigation Controller Scroll View UIKit Tab Bar Controller Date Picker


View Controller UIView A. Allows the user to move through multiple screens and return the way they came. B. A control resembling several rotating wheels. C. In this area of Xcode, the developer can manage how user interface elements are wired to code. D. Allows the user to choose from multiple screens. E. The most generic user interface class. F. Used to manage a single screen in an iOS app. G. Allows the user to indicate a choice among several predetermined options. H. Lets the developer set specific properties for a user interface element. I. Allows several controls to be moved horizontally or vertically around the screen by the user. J. The framework containing all user interface classes. Answer: H, G, C, A, I, J, D, B, F, E


Chapter 11 Persistent Data in iOS 11.1 True/False Questions 1. The default storage engine for Core Data is SQLite. Answer: True 2. NSUserDefaults saves data by default in a relational database. Answer: False 3. SQLite is not available for use directly in iOS apps. Answer: False 4. Primitive data may not be passed to a Managed Object. Only object data is allowed. Answer: False 5. NSUserDefaults allows for saving primitive data values, not objects. Answer: False 6. Data persists in an NSUserDefaults object throughout the phases of the activity life cycle. Answer: True 7. Core Data storage files can be stored on either internal or external storage. Answer: False 8. To save data in Core Data, the developer must write a SQL query. Answer: False 9. Strings stored in NSUserDefaults are case sensitive. Answer: True 10. Implementing a database helper object is required to work with Core Data in iOS. Answer: False

11.2 Multiple Choice Questions 1. Which of the following is NOT an option for storing data in an iOS App? A. User Defaults B. SQLite C. SQL Server D. Core Data

Answer: C


2. What is the default storage mechanism for Core Data? A. XML B. SQLite C. Binary data D. NSUserDefaults Answer: B 3. When you need to store small amounts of data in an app, what is the best technology? A. Core Data B. Serialization C. Archiving D. NSUserDefaults

Answer: D 4. Which of these describes the data design in Core Data? A. Managed Object Context B. Managed Object Model C. Managed Object Design D. Persistent Store Coordinator Answer: B 5. Which of these allows the developer to manage the objects that are stored in Core Data? A. Managed Object Context B. Managed Object Model C. Managed Object Design D. Persistent Store Coordinator

Answer: A 6. In Core Data, what is the relationship between attributes and entities? A. Entities describe an attribute in detail. B. Attributes describe an entity in detail. C. Attributes describe the app delegate, and the entities describe the delegate protocol. D. Entities describe the app delegate, and the attributes describe the delegate protocol. Answer: B 7. What is the purpose of the delegate pattern? A. Delay execution of certain tasks until later. B. Allow one object to act on behalf of another object to speed up execution. C. Allow one object to call methods in another object without knowing at design-time which object those methods would be available in.


D. It provides a very nice texture for user interface controls.

Answer: C 8. What is the purpose of a segue in an iOS app? A. It handles switching between two tabs in the Tab Bar. B. It manages the transition of data from the user interface to NSUserDefaults. C. It manages the transition of data inside Core Data. D. It manages the transition between two different screens in the user interface. Answer: D 9. Consider the following code snippet: UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(saveContact:)];

What is the meaning of the last line? A. A method called saveContact: has to be created in the file, and this method will be called whenever the user interacts with the control. B. A method called @selector has to be created in the file, and this method will be called whenever the user interacts with the control. C. This will call the saveContact: method in the UIBarButtonItem class whenever the user interacts with the control. D. This will call the saveContact: method on the selector object.

Answer: A 10. Which of the following lines of code will properly store the value “Jim” to the firstName attribute in a managed object referenced by the variable name contact? A. [contact setValue:jim forKey:firstName]; B. [contact setKey:@”Jim” forValue:@”firstName”]; C. contact.firstName = @”Jim”; D. [contact setValue:@”Jim” forKey:@”firstName”]; Answer: D 11. The synchronize: method is used to do what? A. Synchronize the state of the app with iCloud. B. Save any changes made to data in Core Data. C. Save any changes made to data in NSUserDefaults. D. Make sure that two screens in the app are updated to the same state. Answer: C 12. With NSUserDefaults, data is stored using a Key-Value scheme. What does that mean?


A. It is used to store password values in the key chain. B. Two items are stored: a key and a value. The key is used to identify the value. C. Data is stored in an object graph where the key is used as an index to identify the value. D. Two items are stored: a key and a value. The value is used to identify the key. Answer: B 13. What is the advantage of declaring global constants in a separate file? A. Avoids the programmer mistyping constant values in different parts of the program. B. Reduces the programming effort required to create the program. C. Improves performance of the app. D. None. Global variables, constant or otherwise, should not be used in properly written code. Answer: A 14. Why is it necessary to store the work the user is working on in an iOS app when the app becomes inactive? A. To free up memory for the system to use B. To increase performance of the device overall C. Because the system can terminate the app in the background if the resources are needed D. Because the protocol used to transfer the user interface data is stateless Answer: C 15. When should a Core Data database be closed? A. Never. The OS determines if it should be closed. B. In the viewWillDisappear: method of the View Controller that uses the database. C. In the viewDidUnload: method of the View Controller that uses the database. D. As soon as the code is done using the database. Answer: A 16. When data is made to exist through many iterations of an app’s life cycle, it is said to ______? A. Persist B. Be stored C. Archive D. Continue

Answer: A

11.3 Matching Questions 1. Match the term to the best definition.


Protocol Managed Object Model Delegate Core Data SQLite Entity User Defaults Attribute Managed Object Context Segue A. Keeps track of which objects are stored on disk. B. Describes the layout or design of data in Core Data. C. A specification of methods that must be implemented in a class. D. A group of fields to be stored in Core Data. E. A framework for storing large amounts of data in an app. F. A transition between two screens in an iOS app. G. A cross-platform database management system that can be added to mobile apps. H. An XML file for storing small amounts of data. I. A field to be stored in Core Data. J. An object that implements a protocol to make certain well-known features available to another object. Answer: A, B, C, D, E, F, G, H, I, J


Chapter 12 Tables in iOS: Navigation and Information Display 12.1 True/False Questions 1. The number of objects required for cells in a table is usually less than the number of objects in the underlying data being displayed in the table. Answer: True 2. A Detail Disclosure Button is used to indicate that selecting this row will show another table in the hierarchy. Answer: False 3. Tables in iOS apps are used to display a grid of data organized in rows and columns. Answer: False 4. The viewWillAppear: method executes anytime a View is about to become active. Answer: True 5. In iOS, setting up tables can be done mostly using Storyboard and very little code. Answer: False 6. A cell in a table can have an image displayed in addition to text. Answer: True 7. NSFetchRequest does not support sorting data. Answer: False 8. Adding a View Controller to the navigation stack requires a modal segue. Answer: False 9. A table can be directly linked to Core Data. Answer: False 10. Deleting a row from a table also requires reloading the data for the entire table. Answer: True

12.2 Multiple Choice Questions 1. How many columns does a table in an iOS app have? A. Zero B. One C. No more than three D. As many as needed to display the data


Answer: B 2. How many objects are generated for the cells in a table? A. One B. Two C. One for every cell visible on the screen plus a few extra D. One for every item in the underlying data source Answer: C 3. Which of the following is NOT an Accessory View for a cell? A. Radio Button Indicator B. Detail Disclosure Indicator C. Checkmark D. Detail Disclosure Button

Answer: A 4. Which of the following best describes UITableViewCellStyleSubtitle? A. A single title and an optional image B. A single title and an optional image with a smaller line of text right-aligned below the title C. Does not permit images and right-aligns smaller text in blue D. Aligns the title and smaller text against each other down the middle Answer: B 5. What is the purpose of UITableViewDelegate? A. It allows for viewing a table from other objects. B. It controls the data source for a table. C. It delegates control over the table to other objects. D. It manages user interaction with a table.

Answer: D 6. Which of the following is the best description of an NSArray? A. An array that can be designated to hold only certain types of objects B. A read-only array that can grow and shrink in size C. A List that can hold/display an array D. An object that can hold arrays

Answer: B 7. What is the responsibility of the tableView:numberOfRowsInSection: method? A. It creates the sections for the table. B. It returns the selected row.


C. It returns the number of rows in a section of a table. D. It determines the look and feel for the row.

Answer: C 8. Which of the following is typically not handled by the method tableView:cellForRowAtIndexPath:? A. Manage reusing objects for the cells to be displayed B. Determine the look and feel for the cell C. Set the text that shows up in the cell D. Return a cell selected by the user Answer: D 9. Creating a segue between two screens; after control-dragging from one to the other, which option do you have to choose to have the second screen become part of the Navigation Controller for the first screen? A. Push B. Modal C. Custom D. Pull

Answer: A 10. When a user selects a row in a table, the tableView:didSelectRowAtIndexPath: method that is declared in the Table View Controller is called. What is the mechanism that ensures this call is made? A. An action was set up for the table cell to call the method. B. The Table View Controller is a subclass of UITableViewController, which conforms to UITableViewDelegate. C. The Table View Controller is a subclass of UITableViewDelegate. D. The system always knows to look for this method name based on polymorphic lookup. Answer: B 11. Which of the following steps are not needed when deleting a row in a table where the data is stored in Core Data? A. Getting a reference to the Storyboard with the Table View Controller B. Deleting the object from the managed object context C. Saving the object context D. Deleting the row from the table Answer: A 12. Which Accessory Button is used to indicate that tapping a row will provide another level of data in a table on the next screen?


A. Disclosure Indicator B. Detail C. Checkmark D. Detail Disclosure Button Answer: D 13. Which of the following is the best description of when the viewWillAppear: method will execute? A. Immediately after the app launches B. Anytime a view is about to become active C. Immediately after the user touches any part of the app UI D. Whenever the user navigates between views Answer: B 14. What is the effect of this line of code? [self.navigationController pushViewController:controller animated:YES];

A. Push the View Controller called controller onto the navigation stack in an animated fashion. B. Push the Navigation Controller onto the navigation stack in an animated fashion. C. Specify that anytime a view controller is pushed onto the navigation stack, it should be animated. D. Navigate back to the previous controller in the navigation stack in an animated fashion. Answer: A 15. How can Core Data be instructed to return data that is sorted by one field first and then another (for example, sort by Country, and then City within each country)? A. Add multiple fields to the Sort parameter (Country followed by City). B. Add the fields after the ORDER BY keyword in the SQL statement (Country followed by City). C. Add Country as the first and City as the second object in the sortDescriptors array in the fetch request. D. Can’t be done. Core Data supports only a single sort field. Answer: C 16. Which of the following cannot be displayed in a table cell? A. Title text B. Video C. Image D. Accessory Button Answer: B

12.3 Matching Questions


1. Match the term to the best definition. Table View Controller Alert View Disclosure Indicator Fetch Request Navigation Controller Prototype Cell NSArray Accessory Button Detail Disclosure Button Cell Identifier A. A control that shows a message to the user that must be dismissed before anything else can be done in the app. B. Selecting this will show a more detailed view of the data. C. A View Controller that divides the screen into equal-spaced areas separated by horizontal lines. D. A definition for a row in a table—used in Storyboard. E. An adornment of a row in a table. F. Indicates that selecting this piece of data will lead to a new screen with more detailed data. G. A read-only data structure that can be used to hold objects of any type. H. A controller that manages a stack of View Controllers indicating the history of screens the user has visited. I. Helps limit the number of objects created, thereby managing system resources. J. This object contains the definition of what data to retrieve from Core Data. Answer: C, A, F, J, H, D, G, E, B, I


Chapter 13 Maps and Location in iOS 13.1 True/False Questions 1. Displaying maps in an iOS app requires signing up for a Maps API key. Answer: False 2. Developers of iOS apps don’t have to decide which hardware sensors provide the best accuracy for the task at hand. Answer: True 3. An iOS device is always able to provide location data to an app. Answer: False 4. Geocoding requires an active Internet connection. Answer: True 5. Google Maps isn’t available for use in iOS devices. Answer: False 6. All View Controllers added to Storyboard must also have a set of .h and .m code files. Answer: False 7. CLGeocoder can be used for both forward and reverse geocoding. Answer: True 8. Separate Location Managers are needed to handle location and heading data. Answer: False 9. Accuracy of heading information is reported in degrees. Answer: True 10. Accuracy of heading information is reported in feet. Answer: False 11. There is no limit to the number of annotations that can be added to a map. Answer: True 12. On any given map, a maximum of 64 annotations can be displayed at a time. Answer: False

13.2 Multiple Choice Questions


1. Which of the following sensors are not used to improve location accuracy? A. Wi-Fi B. Bluetooth C. GPS D. Cell towers

Answer: B 2. Which of the following sensors are not available on iPod touch? A. GPS B. Wi-Fi C. Bluetooth D. All of the above Answer: A 3. What functionality does an altimeter sensor provide? A. Improves accuracy of location data B. Information about which direction the device is headed (compass) C. Altitude above/below sea level D. Degrees of rotation of the device

Answer: C 4. Which framework allows for working with the current location and heading data? A. MapKit B. Core Motion C. Core Heading D. Core Location Answer: D 5. What is a geo fence? A. An area that the device is not allowed into B. A geographic region set up by the app developer to take action when the device enters or leaves the region C. A dead zone where location data is not available D. A physical fence around a GPS base station

Answer: A 6. Which of the following is not a feature provided by MapKit? A. Display a map on the screen B. Detect the device’s current heading C. Add callouts and pins to a map D. Detect the device’s current location


Answer: B 7. The process of translating a human-readable address to geographical coordinates is called ______. A. Reverse geocoding B. Coordinate transformation C. Forward geocoding D. Address translation

Answer: C 8. When creating the code file for a View Controller to display a map, which class should be used as the super class for the View Controller? A. UILocationViewController B. UIViewController C. UIMapViewController D. NSObject Answer: B 9. Why is a completion handler used when doing a geocoding? A. To keep the app responsive while geocoding looks up the address over the Internet. B. To ensure that the geocoding completes and returns a valid result. C. To make it easier to handle the data that is returned when the geocoding completes. D. It formats the data properly for display in the app.

Answer: A 10. How many results are returned from forward geocoding? A. None B. One C. Two D. Potentially multiple results Answer: D 11. If you are developing an app to track a run or walk in a fitness app, which accuracy setting should be chosen? A. kCLLocationAccuracyKilometer B. kCLLocationAccuracyNearestTenMeter C. kCLLocationAccuracyBestForNavigation D. kCLLocationAccuracyBest Answer: D 12. How is accuracy of heading information reported?


A. Number of degrees the device is deviating from true North B. Number of degrees the heading may be off in either direction C. Number of meters the device can be away from the actual position D. Number of meters the heading may be off in either direction Answer: B 13. What is the most common error situation that the location manager may encounter? A. Inaccurate readings B. GPS signal unavailable C. User has turned off location services D. No compass available on the device Answer: C 14. Which of the following is NOT a way that can be used to display the device’s location on the map? A. In the Simulator, go to Debug > Location > Display Device Location. B. In Xcode, use the Attributes Inspector for the map control to turn on Show User Location. C. Set up an outlet for the map, and then add this line of code: [_mvMap setUserTrackingMode:YES]; D. Implement MKMapViewDelegate and add these lines of code: _mvMap.showsUserLocation = YES; _mvMap.delegate = self; Answer: A 15. Which of the following are NOT options for adding to an annotation? A. Title B. Subtitle C. Address D. Coordinate Answer: C 16. Which map type shows a satellite image along with roads and city names? A. MKMapTypeStandard B. MKMapTypeHybrid C. MKMapTypeMilitary D. MKMapTypeSatellite Answer: B


13.3 Matching Questions 1. Match the term to the best definition. Location Manager Annotation Hybrid GPS Forward geocoding Reverse geocoding Core Location CLPlaceMark MapKit struct A. An object that contains a description of a geographic location. B. A type of map that shows both roads and satellite imagery. C. A framework for displaying maps in apps. D. An object that interfaces between the hardware location sensors and your app. E. Look up latitude and longitude based on an address. F. Text and other identification that can be used to describe a particular point on a map. G. A hardware sensor that provides location data based on satellite data. H. A set of classes created to manage a range of functionality related to where the device is located. I. A lightweight way to keep track of multiple pieces of data. J. Look up an address based on longitude and latitude. Answer: D, F, B, G, E, J, H, A, C, I


Chapter 14 Access to Hardware and Sensors in iOS 14.1 True/False Questions 1. UIDevice can be used to get information about the name the user has given to the device. Answer: True 2. UIDevice can be used to call a phone number from an app. Answer: False 3. The Notification Center can be used to get information about the battery status of the device. Answer: True 4. The Notification Center can be used to take a picture using the device camera. Answer: False 5. Determining the battery status requires using Notification Center. Answer: False 6. Images can be stored directly in Core Data. Answer: True 7. UIImagePickerController is the only way to take a picture from inside an iOS app. Answer: False 8. Only a single control can be associated with a gesture recognizer at a time. Answer: True 9. A Long Press Gesture Recognizer cannot be attached to a Text Field that is disabled. Answer: True 10. Getting motion data does not affect battery life on the device. Answer: False

14.2 Multiple Choice Questions 1. Which of the following is NOT available through the UIDevice class? A. Device orientation B. Geographic location of the device C. OS version D. Battery charge level

Answer: B


2. The property identifierForVendor in UIDevice has the same value for ______. A. All apps installed by the same user B. All apps from the same vendor regardless of device C. All apps from the same vendor running on one device D. All devices owned by the same user regardless of app Answer: C 3. As an app developer, knowing the battery status can be useful for _______. A. Reminding the user to swap to a fresh battery B. Not launching an operation that needs a lot of battery power unless the device is plugged in C. Reporting device performance to Apple D. Avoiding overcharging the battery

Answer: B 4. What role does the Notification Center play in monitoring battery status? A. It shows a message onscreen with the new battery status. B. It allows for a particular method to be called whenever the battery status changes. C. It turns on and off the monitoring of the battery. D. It allows for immediate updates of the current battery status. Answer: B 5. What is a sensor? A. Any hardware resource on an Android device B. A device that reports the status of hardware components, such as the battery, on an Android device C. A hardware device that captures information about the Android device’s environment D. A hardware device that is used by the Android device to interact with its environment or other devices

Answer: C 6. Current battery charge level is reported as _____. A. A percentage of full charge B. A decimal number between 0 and 1 corresponding to the full charge C. Minutes left on the battery D. Hours and minutes left on the battery Answer: B 7. The easiest way to take pictures within an iOS app is to use the ______. A. Default camera app B. AVFoundation framework


C. Instagram app D. Built-in UIImagePickerController

Answer: D 8. What does the following line of code do? [[[UIDevice currentDevice] systemVersion] floatValue]

A. Returns a decimal number representing the version of iOS currently installed on the device B. Sets the version of iOS to float between two predetermined values C. Gets the hardware version as a decimal number for the current device D. Ensures that the device will be able to float between several versions of iOS currently installed Answer: A 9. Which of the following is NOT a feature provided by UIImagePickerController? A. Cropping image B. Access to camera flash C. Image filters D. Video camera

Answer: C 10. Which pattern is used to handle images returned by UIImagePickerController? A. Set up Notification Center to indicate which method should be called B. Implement a class that inherits from UIImagePickerController C. Send image to the Camera Roll on the camera D. Implement a delegate method to be called by the control Answer: D 11. Which data type is used to store an image in Core Data? A. UIImage B. Image C. Binary Data D. Bitmap Answer: C 12. A variable that holds an image provided by the camera should be declared as what type? A. UIImage B. BinaryData C. Bitmap D. Image Answer: A


13. Which pattern is used to call a phone number from within an app? A. Implement a delegate method to be called by the built-in phone app. B. Send a URL to the built-in phone app. C. Use UIDevice to access the phone. D. Set up Notification Center to indicate which method should be called. Answer: B 14. Why is the CMMotionManager object retrieved from the App Delegate? A. Because the app delegate is responsible for device-level access to the motion sensors B. Because the motion manager has to be instantiated when the app is first launching C. To ensure a single object only is instantiated D. To make sure detection of motion data is stopped before the app goes to the background Answer: C 15. Which of the following is NOT a strategy that helps reduce battery strain when using CMMotionManager? A. Retrieve only a single instance of CMMotionManager from the App Delegate. B. Set a long update interval. C. Stop getting updates as soon as possible. D. Only get updates from the sensors needed. Answer: A

14.3 Matching Questions 1. Match the term to the best definition. Notification Center Gyroscope NSURL CMMotionManager UIDevice UIImagePickerController Core Motion Accelerometer UIImage UILongPressGestureRecognizer A. A sensor that detects the device rotation. B. A class that can used to find out if the device is currently upside down.


C. Objects of this class can hold a picture. D. A system for broadcasting messages to different parts of an app. E. A sensor that can detect the movement of the device. F. A class that can contain a phone number to be called by the default phone app. G. A class that allows for taking pictures with the built-in camera. H. This object is used to detect if the user holds a finger for more than about a second on a particular control. I. A set of classes used to manage all aspects related to the movement of the device. J. A class that is used to start and stop detection of sensor data. Answer: D, A, F, J, B, G, I, E, C, H


Chapter 15 Monetizing Apps 15.1 True/False Questions 1. Google takes 30% of the app sales price for apps in the Play Store. Answer: True 2. After buying an app, the user will get free updates as long as the app stays in the app store. Answer: True 3. Developers can make money from apps without selling the apps. Answer: True 4. Ads on Android devices pay for both clicks and impressions. Answer: False 5. Certain features in an app can be unlocked after it’s purchased. Answer: True 6. Google Play Billing Library is needed for ad-supported apps on Android. Answer: False 7. To avoid having Apple or Google take a cut of a developer's revenue, users can buy subscriptions on the developer’s website. Answer: True 8. Apps developed for one mobile platform can be recompiled to work on other platforms. Answer: False 9. All the necessary development tools to create iOS apps are free. Answer: True 10. Freelancing is a viable approach to making money developing apps. Answer: True

15.2 Multiple Choice Questions 1. If an app developer raises the price of an app in the app store, what is likely to happen to the number of purchases of the app? A. It would go down. B. It would go up. C. It would stay roughly the same. D. Impossible to say without knowing more about the app.


Answer: A 2. Which type of app is likely to be able to command a price premium? A. High-graphic games B. Contact List apps C. Apps that take advantage of most of the sensors on the device D. Apps that solve business problems Answer: D 3. Which of the following is NOT required to launch an ad-supported app? A. Submitting bank information to Apple or Google B. Design ads C. Submitting a W-9 tax form to Apple or Google D. Adding functionality to the app to serve up ads

Answer: B 4. Which framework allows for serving up ads on Android devices? A. AdMob B. iAd C. gAd D. AdSense Answer: A 5. Which framework allows for serving up ads on iOS devices? A. AdWorld B. iAd C. gAd D. AdSense

Answer: B 6. What percentage do Apple and Google take on app purchases? A. 5% B. 10% C. 30% D. 50% Answer: C 7. What percentage do Apple and Google take on in-app purchases? A. 5% B. 10%


C. 30% D. 50%

Answer: C 8. Which of the following generates the most revenue for developers? A. Paid apps B. In-app purchasing C. Ad-supported apps D. Subscription Answer: B 9. Which framework is needed to support in-app purchases on Android? A. Google StoreKit B. Google Purchasing API C. Google Play Billing Library D. AdMob

Answer: C 10. Which framework is needed to support in-app purchases on iOS? A. Google Play Billing Library B. iAd C. InAppKit D. StoreKit Answer: D 11. Which of the following is a significant reason to set up a company for selling apps? A. Clean separation of personal and business assets. B. It’s required by Apple and Google. C. It’s required by the Internal Revenue Service. D. Potential for making more money. Answer: A 12. Which is the surest way to make money for creating apps? A. Paid apps B. In-app purchasing C. Freelancing D. Contract development Answer: D 13. Which mobile platform has the largest market share in terms of devices sold?


A. iOS B. Android C. Blackberry D. Windows Phone Answer: B 14. Which mobile platform has the largest potential for generating revenue for developers? A. iOS B. Android C. Blackberry D. Windows Phone Answer: A 15. Which of these do NOT involve extra work when developing an app for multiple platforms compared to a single platform? A. Programming the business logic B. Keeping apps updated in multiple marketplaces C. Designing user experience and interface D. Learning multiple development environments Answer: C

15.3 Matching Questions 1. Match the term to the best definition. Android Subscription LLC Monetization iOS Paid apps Platform Ad supported Freemium In-app purchase A. Making money from apps. B. A small percentage of users finance free service for everyone else. C. Mobile platform with the largest number of devices. D. Users pay for an app before starting to use it.


E. Business model where customers pay the same amount on a regular basis. F. Type of business that shields your personal assets. G. Mobile platform with potential for highest per-user revenue. H. Free apps financed by third-party companies. I. Users can buy upgrades to an app. J. A description of a group of similar type of devices. Answer: A, B, C, D, E, F, G, H, I, J


Chapter 16 Publishing Apps 16.1 True/False Questions 1. Both Apple and Google require you to pay for each app you publish in the Play and App stores. Answer: False 2. Apple has strict requirements for apps published in the App Store, but Google does not have any for the Play Store. Answer: False 3. Both Apple and Google require you to provide at least one screen shot for every app you publish in the Play and App stores. Answer: True 4. An Android app requires extra programming by developers if they want it copy protected. An iOS app does not. Answer: True 5. Neither Google nor Apple require developers to sign their apps prior to publication. Answer: False 6. Apple reviews all apps prior to publishing them in the App Store. Google does not review apps prior to publication in the Play Store. Answer: True 7. Publishing iOS apps in an organization requires a different license than the one needed to publish an app in the App Store. Answer: True 8. Publishing Android apps in the Play Store is free for any developer, but publishing in an organization requires an Enterprise License. Answer: False 9. Testing an Android on a real device is required prior to publication. However, the Xcode simulator is enough testing for an iOS app. Answer: False 10. Published apps are automatically updated for the latest iOS by Apple. However, Android apps must be updated by the developer. Answer: False

16.2 Multiple Choice Questions


1. What is the name of the iOS app market? A. iTunes B. Play Store C. App Store D. Apple Market (iMarket)

Answer: C 2. What is the smallest number of screenshots required to publish an Android app? A. 1 B. 2 C. 5 D. 10 Answer: A 3. How do you tell the App Store how much you want to charge for an app? A. You enter the exact price. B. You complete a short questionnaire about the app characteristics and purpose, and a price is selected for you. C. You select a pricing tier from the options offered by Apple. D. You are not allowed to charge for iOS apps.

Answer: C 4. How are apps protected from illegal copying in Android? A. There is no copy protection on Android. B. The app is encrypted. C. An encrypted key is generated and passed to the device when the app is purchased. The operating system uses this key to unlock the app. D. The app is coded to check if the app has been legally purchased from the Play Store. Answer: D 5. Which best describes how iOS apps are distributed in an organization? A. The company purchases the iTunes Distribution System from Apple. B. A distribution profile and provisioning profile is packaged with the app, and then the user can get it any way the organization specifies. C. There are many third-party solutions that an organization can purchase to do this from its own servers. D. It is emailed to the users.

Answer: B 6. Which best describes how Android apps are distributed in an organization?


A. From the Google developer console. B. From a website purchased from Google. C. However the organization wants the distribution. D. It is emailed to the users. Answer: C 7. Which of the following is the best description of fragmentation? A. Multiple device configurations including OS versions, screen sizes, and resolutions. B. Frequent OS releases. C. Multiple versions of the same app available on the Play and App stores. D. Testing Minimum and Target SDKs.

Answer: A 8. If an input asks the user for the day of the month, and the developer tests it by entering 31 and 32, what type of testing is the developer doing? A. Equivalence partitioning B. Boundary value analysis C. Cause-effect graphing D. Usability Answer: B 9. Who performs Alpha testing? A. The Play and App Stores B. Potential users C. The organization that produced the app D. Management

Answer: C 10. What is the minimum number of real devices that an iOS developer should test his/her app on? A. 0 B. 1 C. 2 (iPad and iPhone) D. Each device type and iOS version the app targets Answer: D 11. How are apps protected from illegal copying in iOS? A. There is no copy protection on iOS. B. The app can be acquired only through the App Store. C. An encrypted key is generated and passed to the device when the app is purchased. The operating system uses this key to unlock the app. D. The app is coded to check if the app has been legally purchased from the App Store.


Answer: C 12. When are Android apps rejected because of policy violations? A. Prior to publication if they fail a review by Google employees B. Prior to publication if they fail an automated review that is executed on the uploaded binary C. Post publication if they fail a review by Google employees D. Post publication if there are complaints and they fail a review initiated because of complaints Answer: D 13. Which of the following best describes unit testing? A. Testing to ensure that the app meets all specifications B. Testing to ensure that individual components of an app meet all functional specifications C. Testing to make sure every button works D. Testing to make sure the user can use the app effectively

Answer: B 14. What is the minimum number of real devices that Android developers should test their apps on? A. 1 B. 2 (phone and pad) C. 4 (minimum and target SDK on each phone and pad) D. Each device type and OS version the app targets Answer: D 15. What are the required app icon sizes for Android and iOS? A. 1024 px for both B. 512 and 1024 px, respectively C. 72 and 144 px, respectively D. 512 px for both

Answer: B

16.3 Matching Questions 1. Select the best description of each term or phrase. Play Store Fragmentation Beta testing Keystore Publishing


Unknown sources Unit testing APK Archive Boundary value analysis A. The term used to describe the act of making an app available on a market. B. Testing of an app by actual potential users of the app. C. Testing individual bits of app function. D. The marketplace for apps provided and managed by Google. E. What Android apps that don’t come from the Play Store are designated as coming from. F. A file used to sign an Android app. G. The term used to describe compiling an iOS application for release. H. Apps that do not come from the Play Store. I. The term used to describe an environment where there are many devices with different characteristics and operating system versions. J. A type of unit testing. Answer: D, I, B, F, A, E, H, C, G, J


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.