INSTANT DOWNLOAD AFTER PURCHASED
  • Track order
  • Contact Us
  • DMCA/Disclaimer
eBookon
Login / Register
Sign inCreate an Account

Lost your password?
0 items / $0.00
Menu
eBookon
0 items / $0.00
  • Home
  • Shop
  • FAQs
  • Track order
  • REFUND / EXCHANGE POLICY
  • Contact Us
  • DMCA/Disclaimer
  • How To Pay in Bitcoin?
Sale
Click to enlarge
HomeTest Bank Test Bank for Android How To Program 3rd Edition By Deitel & Deitel – Digital Download File
Previous product
Test Bank for A Guide to Crisis Intervention 5th Kanel - Digital Download File $30.00 $20.00
Back to products
Next product
Test bank for Biology Concepts And Investigations 2 nd Edition By Hoefnagels - Digital Download File $30.00 $20.00

Test Bank for Android How To Program 3rd Edition By Deitel & Deitel – Digital Download File

$30.00 $20.00

SKU: 0b02fe786f13 Category: Test Bank
  • Sample Chapter
Sample Chapter

Chapter 6 Cannon Game App

  • Introduction

No questions.

  • Test-Driving the Cannon Game App

No questions.

  • Technologies Overview

No questions.

  • Using the Resource Folder res/raw

Q1. Media files (such as the sounds we used in the Cannon Game app), are placed in the app’s resource folder ________.

  1. res/media
  2. res/sounds
  3. res/raw
  4. res/multimedia

Answer: c. res/raw

  • Activity and Fragment Lifecycle Methods

Q1. Which of the following statements is false?

  1. When an Activity is shut down, its onDestroy method is called, which in turn calls the onDestroy methods of all the Fragments hosted by the Activity.
  2. We used the onDestroy method in the MainActivityFragment to release the CannonView’s sound resources.
  3. Method onDestroy is guaranteed to be called, so it can be used to release resources and to save critical data.
  4. The Android documentation recommends that you save data in methods onPause or onSaveInstanceState.

Answer: c. Method onDestroy is guaranteed to be called, so it can be used to release resources and to save critical data. Actually, method onDestroy is not guaranteed to be called, so it should be used only to release resources, not to save critical data.

  • Overriding View Method onTouchEvent

Q1. To process simple touch events in an app, override View method onTouchEvent, then use constants from class ________ (package android.view) to test which type of event occurred and process it accordingly.

  1. Event
  2. MotionEvent
  3. Motion
  4. View

Answer: b. MotionEvent

  • Adding Sound with SoundPool and AudioManager

Q1. An app’s sound effects are managed with a(n) ________ (package android.media), which can be used to load, play and unload sounds.

  1. Effects
  2. SoundPool
  3. EffectsPool
  4. SoundManager

Answer: SoundPool

 

Q2. Sounds are played using one of Android’s audio- ________ for alarms, music, notifications, phone rings, system sounds, phone calls and more.

  1. streams
  2. players
  3. tools
  4. None of the above

Answer: a. streams

 

Q3. The Android documentation recommends that games use the ________ to play sounds, because that stream’s volume can be controlled via the device’s volume buttons.

  1. phone audio stream
  2. alarm audio stream
  3. notifications audio stream
  4. music audio stream

Answer: d. music audio stream

 

Q4. Which of the following statements is false?

  1. You configure and create a SoundPool object using a SoundPool.Builder object.
  2. You use an AudioAttributes.Builder object to create an AudioAttributes object that will be associated with the SoundPool.
  3. AudioAttributes’s setGameAudio method is used to designate the audio as game audio.
  4. Activity’s setVolumeControlStream method allows the game’s volume to be controlled with the device’s volume buttons.

Answer: c. AudioAttributes’s setGameAudio method is used to designate the audio as game audio. Actually, AudioAttributes’s setUsage method is used to designate the audio as game audio.

  • Frame-by-Frame Animation with Threads, SurfaceView and SurfaceHolder

Q1. All updates to an app’s user interface must be performed in the GUI thread of execution, because GUI components are not ________.

  1. thread ready
  2. thread safe
  3. thread capable
  4. None of the above

Answer: b. thread safe

 

Q2. Games, often require complex logic that should be performed in separate threads of execution, and those threads often need to draw to the screen. For such cases, Android provides class ________—a subclass of View that provides a dedicated drawing area in which other threads can display graphics on the screen in a thread-safe manner.

  1. GameView
  2. ThreadView
  3. ThreadSafeView
  4. SurfaceView

Answer: d. SurfaceView

 

Q3. Each SurfaceView subclass should implement the interface ________, which contains methods that are called when the SurfaceView is created, changed (e.g., its size or orientation changes) or destroyed.

  1. SurfaceHolder.Callback
  2. SurfaceHolderCallback
  3. Surface.Callback
  4. SurfaceCallback

Answer: a. SurfaceHolder.Callback

  • Simple Collision Detection

Q1. Game-development frameworks typically provide sophisticated ________ collision-detection capabilities.

  1. pixel-based
  2. perfect
  3. pixel-perfect
  4. None of the above

Answer: c. pixel-perfect

  • Immersive Mode

Q1. Which of the next three statements is false?

  1. Full-screen immersive mode enables an app to take advantage of the entire screen.
  2. When an app is in immersive mode, the user can swipe down from the top of the screen to display the system bars temporarily.
  3. If the user does not interact with the system bars, they disappear after a few seconds.
  4. All of the above are true.

Answer: d. All of the above are true.

  • Building the GUI and Resource Files

No questions.

  • Creating the Project

Q1. Which of the next three statements is false?

  1. You can add a Fragment and its layout manually.
  2. You can design an app for only landscape orientation.
  3. To set the screen orientation to landscape, set android:-orientation to landscape.
  4. Each of the above is true.

Answer: c. To set the screen orientation to landscape, set android:-orientation to landscape. Actually, to set the screen orientation to landscape, set android:screen-Orientation to landscape.

  • Adjusting the Theme to Remove the App Title and App Bar

Q1. Game developers often use full-screen themes, such as

Theme.Material.Light.NoActionBar.Fullscreen

that display only the bottom system bar, which in landscape orientation appears at the screen’s ________.

  1. top
  2. bottom
  3. left edge
  4. right edge.

Answer: d. right edge

  • xml

No questions.

  • Colors

No questions.

  • Adding the Sounds to the App

No questions.

  • Adding Class MainActivityFragment

Q1. A Frame-Layout is designed to display one View, but can also be used to ________ views.

  1. stack
  2. nest
  3. position
  4. layer

Answers: d. layer.

  • Editing xml

No questions.

  • Adding the CannonView to xml

No questions.

  • Overview of This App’s Classes

No questions.

  • MainActivity Subclass of Activity

No questions.

  • MainActivityFragment Subclass of Fragment

Q1. There are seven sound streams identified by AudioManager constants. The music stream ________ is recommended for sound in games, because this stream’s volume can be controlled via the device’s buttons.

  1. AudioManager.STREAM
  2. AudioManager.MUSIC
  3. AudioManager.STREAM_MUSIC
  4. AudioManager.SYMPHONY

Answer: c. AudioManager.STREAM_MUSIC

  • Class GameElement

No questions.

  • Instance Variables and Constructor

No questions.

  • Methods update, draw, and playSound

No questions.

  • Blocker Subclass of GameElement

No questions.

  • Target Subclass of GameElement

No questions.

  • Cannon Class

No questions.

  • Instance Variables and Constructor

No questions.

  • Method align

No questions.

  • Method fireCannonball

No questions.

  • Method draw

No questions.

  • Methods getCannonball and removeCannonball

No questions.

  • Cannonball Subclass of GameElement

No questions.

  • Instance Variables and Constructor

No questions.

  • Methods getRadius, collidesWith, isOnScreen, and reverseVelocityX

No questions.

  • Method u                                                                                                                                                      pdate

No questions.

  • Method draw

Q1. Canvas’s ________ method draws a circle.

  1. drawOval
  2. drawEllipse
  3. drawCircle
  4. None of the above

Answer: c. drawCircle

  • CannonView Subclass of SurfaceView

No questions.

  • package and import Statements

No questions.

  • Instance Variables and Constants

No questions.

  • Constructor

Q1. When a View is inflated, its constructor is called with a Context and a(n) ________ as arguments.

  1. SetOfAttributes
  2. Attributes
  3. OptionsSet
  4. AttributeSet

Answer: d. AttributeSet

 

Q2. Pass ________ to an  AudioAttributes.Builder object’s setUsage method to indicate that the audio is being used as game audio.

  1. AudioAttribute.USAGE_GAME
  2. AudioAttribute.GAME
  3. AudioAttribute.GAME_USAGE
  4. None of the above

Answer: a. AudioAttribute.USAGE_GAME

 

Q3. Which of the following statements is false?

  1. More complex games might play many sounds at the same time. SoundPool.Builder’s setMaxStreams method takes an argument that represents the maximum number of simultaneous sound streams that can play at once.
  2. A SparseIntArray maps integer keys to integer values. HashMap<Integer, Integer> is similar to—but more efficient than—a SparseIntArray for small numbers of key–value pairs.
  3. Each sound ID can be used to play a sound (and later to return its resources to the system).
  4. SoundPool method load receives three arguments—the application’s Context, a resource ID representing the sound file to load and the sound’s priority.

Ans: b. A SparseIntArray maps integer keys to integer values. HashMap<Integer, Integer> is similar to—but more efficient than—a SparseIntArray for small numbers of key–value pairs. Actually, a SparseIntArray is similar to—but more efficient than—a HashMap<Integer, Integer> for small numbers of key–value pairs.

  • Overriding View Method onSizeChanged

Q1. Class View’s onSizeChanged method is called whenever the View’s size changes, including when the View is first added to the View hierarchy as the layout is inflated. The method receives the View’s new width and height and its old width and height. The first time this method is called, the old width and height are ________ and ________.

  1. 0, 0
  2. 0, 1
  3. 1, 0
  4. 1, 1

Answer: a. 0, 0

  • Methods getScreenWidth, getScreenHeight, and playSound

Q1. Methods getScreenWidth and getScreenHeight return the width and height of the screen, which are updated in the ________ method.

  1. onOrientationChanged
  2. onSizeChanged
  3. onConfigurationChanged
  4. None of the above

Answer: b. onSizeChanged

  • Method newGame

No questions.

  • Method updatePositions

Q1. You can terminate a Thread by calling its setRunning method with the argument ________.

  1. terminate
  2. true
  3. kill
  4. false

Answer: d. false

  • Method alignAndFireCannonball

No questions.

  • Method showGameOverDialog

Q1. A dialog must be displayed from the GUI thread. You call Activity method ________ to specify a Runnable that should execute in the GUI thread.

  1. runOnUiThread
  2. executeOnUIThread
  3. uiThread
  4. None of the above

Answer: a. runOnUiThread

  • Method drawGameElements

Q1. You can call Canvas’s drawRect method to clear the Canvas. The method receives the rectangle’s upper-left x-y coordinates, width and height, and the ________ object that specifies the drawing characteristics.

  1. Draw
  2. PaintSettings
  3. Paint
  4. DrawSettings

Answer: c. Paint

  • Method testForCollisions

No questions.

  • Methods stopGame and releaseResources

Q1. Class SoundPool’s ________ method gives the resources associated with a SoundPool back to the system.

  1. reset
  2. release
  3. reinitialize
  4. restore

Answer: b. release

  • Implementing the Callback Methods

Q1. Method ________ of interface SurfaceHolder.Callback is called when the SurfaceView’s size or orientation changes, and would typically be used to redisplay graphics based on those changes.

  1. surfaceSizeChanged
  2. surfaceOrientationChanged
  3. onSizeChanged
  4. surfaceChanged

Answer: d. surfaceChanged

 

Q2. Method surfaceCreated is called when the SurfaceView is created—e.g., ________.

  1. when the app first loads
  2. when the app resumes from the background
  3. Both of the above
  4. Neither of the above

Answer: c. Both of the above

  • Overriding View Method onTouchEvent

Q1. View method onTouchEvent determines when the user touches the screen. The MotionEvent parameter contains information about the event that occurred. If the user touched the screen, the parameter’s value is ________.

  1. MotionEvent.ACTION_DOWN
  2. MotionEvent.ACTION_TOUCH
  3. MotionEvent.ACTION_TAP
  4. MotionEvent.ACTION_DRAG

Answer: a. MotionEvent.ACTION_DOWN

  • CannonThread: Using a Thread to Create a Game Loop

Q1. To obtain the Canvas for drawing on the SurfaceView, call SurfaceHolder method ________.

  1. getCanvas
  2. createCanvas
  3. newCanvas
  4. lockCanvas

Answer: d. lockCanvas

 

Q2. Only one thread at a time can draw to a SurfaceView. To ensure this, you must first lock the SurfaceHolder by ________.

  1. calling lockSurfaceHolder
  2. specifying it as the expression in the parentheses of a synchronized block.
  3. calling getSurfaceHolderLock
  4. None of the above

Answer: b. specifying it as the expression in the parentheses of a synchronized block

  • Methods hideSystemBars and showSystemBars

Q1. Immersive mode is available in Android 4.4 (API level 19) and higher. You can check at runtime whether the device’s version is at least  Android 4.4 (API level 19) by checking whether ________ is at least Build.VERSION_CODES_KITKAT.

  1. Build.VERSION_SDK
  2. Build.VERSION_SDK_INT
  3. Build.VERSION_INT
  4. Build.SDK_INT

Answer. b. Build.VERSION_SDK_INT

 

Chapter 7

Doodlz App

  • Introduction
  1. With Android’s ________ you can draw on the entire screen—the device’s system bars and action bar toggle between displayed and hidden when you tap the screen.

Ans: immersive mode

 

  1. An ARGB color contains ________ (transparency), ________, ________ and ________ componnts.

Ans: alpha, red, green, blue

  • Technologies Overview
  • Using SensorManager to Listen for Accelerometer Events
  1. Most Android devices have a(n) ________ that allows apps to detect movement.

Ans: accelerometer

  • Custom DialogFragments
  1. (True/False) AlertDialogs are often created using anonymous inner classes that extend DialogFragment and display only text and buttons. AlertDialogs may also contain custom Views.

Ans: True

 

  1. The first Fragment lifecycle method called when a Fragment is attached to a parent Activity is ________.

Ans: onAttach

 

  1. The last Fragment lifecycle method called when a Fragment is about to be detached from a parent Activity is ________.

Ans: onDetach

  • Drawing with Canvas and Bitmap
  1. (True/False) You can associate a Canvas with a Bitmap, then use the Canvas to draw on the Bitmap, which can then be displayed on the screen. A Bitmap can also be saved into a file.

Ans: True.

  • Processing Multiple Touch Events and Storing Lines in Paths
  1. (True/False) You process touch events by overriding the View method onTouchEvent.

Ans: False. Actually, you override the View method onTouchEvent.

Related products

Sale
Quick view
Close

Test Bank For Moral Issues in Business 12th Edition by William H. Shaw – Digital Download File

$25.00 $15.00
Buy Now (Instant Download)
Sale
Quick view
Close

Test Bank For Introduction To Geography People Places & Environment 6th Edition By Dahlman, Renwick – Digital Download File

$25.00 $15.00
Buy Now (Instant Download)
Sale
Quick view
Close

Test Bank for Biochemistry 6th Edition Reginald Garrett – Digital Download File

$25.00 $15.00
Buy Now (Instant Download)
Sale
Quick view
Close

Test Bank For Psychology In Modules with Updates On DSM5 10th Edition by David G. Myers – Digital Download File

$25.00 $15.00
Buy Now (Instant Download)
Sale
Quick view
Close

Test Bank for Success in Practical Vocational Nursing 7th Ed by Signe S. Hill, Howlett – Digital Download File

$25.00 $15.00
Buy Now (Instant Download)
Sale
Quick view
Close

TEST BANK FOR DENTAL RADIOGRAPHY PRINCIPLES AND TECHNIQUES 5TH EDITION BY JOEN IANNUCCI, Howerton – Digital Download File

$25.00 $15.00
Buy Now (Instant Download)
Sale
Quick view
Close

Test Bank for Financial Accounting Tools for Business Decision Making 6th Canadian Edition by Paul D. Kimmel – Weygandt – Kesio – Irvine – Digital Download File

$25.00 $15.00
Buy Now (Instant Download)
Sale
Quick view
Close

Test Bank for Life The Science of Biology 10th Edition by David E. Sadava, David M. Hillis , H. C. Heller – Digital Download File

$25.00 $15.00
Buy Now (Instant Download)
eBookas 2023 . PREMIUM TEST BANKS & SOLUTION MANUALS.
payments
  • Home
  • Shop
  • Track order
  • DMCA/Disclaimer
  • REFUND / EXCHANGE POLICY
  • How To Pay in Bitcoin?
  • FAQs
  • Contact Us
  • Login / Register
Shopping cart
close