Deck 8: Graphics, Animations, Sounds and Gaming
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/27
Play
Full screen (f)
Deck 8: Graphics, Animations, Sounds and Gaming
1
The ____________ package contains classes to draw and paint.
android.graphics
2
The Color class defines constants and methods used to define colors represented by ____________.
integers
3
Following is the API for the drawArc method of the Canvas class:
public void drawArc( RectF oval, float startAngle, float sweepAngle,
boolean useCenter, Paint paint )
If useCenter is false, we draw a wedge.
public void drawArc( RectF oval, float startAngle, float sweepAngle,
boolean useCenter, Paint paint )
If useCenter is false, we draw a wedge.
False
4
Following is the API for the drawArc method of the Canvas class:
public void drawArc( RectF oval, float startAngle, float sweepAngle,
boolean useCenter, Paint paint )
If sweepAngle is positive, we draw the arc clockwise; otherwise, we draw the arc counterclockwise.
public void drawArc( RectF oval, float startAngle, float sweepAngle,
boolean useCenter, Paint paint )
If sweepAngle is positive, we draw the arc clockwise; otherwise, we draw the arc counterclockwise.
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck
5
Following is the API for one of the schedule methods of the Timer class:
Void schedule( TimerTask task, long d, long p )
What do d and p represent?
A) They represent two resources.
B) The task will start after d milliseconds; the task will run every p milliseconds.
C) The task will start after p milliseconds; the task will run every d milliseconds.
D) The task will last d milliseconds and will stop after p milliseconds.
Void schedule( TimerTask task, long d, long p )
What do d and p represent?
A) They represent two resources.
B) The task will start after d milliseconds; the task will run every p milliseconds.
C) The task will start after p milliseconds; the task will run every d milliseconds.
D) The task will last d milliseconds and will stop after p milliseconds.
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck
6
Once a Timer has started a task, it is not possible to cancel it.
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck
7
Both the invalidate and the postInvalidate methods of the View class have a version that accepts four parameters. These four parameters represent a rectangle within the View.
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck
8
It is possible to play several sounds simultaneously.
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck
9
c is a Canvas object reference, and p is a Paint object reference. What is the only valid statement?
A) p.drawCircle( 45, 50, 10, c);
B) c.drawCircle ( 10, p);
C) c.drawCircle( 45, 50, p);
D) c.drawCircle( 45, 50, 10, p);
A) p.drawCircle( 45, 50, 10, c);
B) c.drawCircle ( 10, p);
C) c.drawCircle( 45, 50, p);
D) c.drawCircle( 45, 50, 10, p);
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck
10
To create a SoundPool object, we first instantiate a SoundPool.Builder object and call the ____________ method of the SoundPool.Builder class.
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck
11
A Point is defined by ____________ integer coordinates.
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck
12
The Rect class encapsulates a(n) ____________.
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck
13
What method of the Paint class can we use to change the color of a Paint object?
A) setPaint
B) setColor
C) changeColor
D) color
A) setPaint
B) setColor
C) changeColor
D) color
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck
14
The Paint class supports anti-alias drawing.
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck
15
What class defines drawing styles and colors?
A) Paint
B) Style
C) Color
D) Graphics
A) Paint
B) Style
C) Color
D) Graphics
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck
16
Which of the following is not a value of Paint.Style?
A) FILL
B) STROKE
C) FILL_AND_STROKE
D) NONE
A) FILL
B) STROKE
C) FILL_AND_STROKE
D) NONE
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck
17
What method of the TimerTask class do we need to override and is also called automatically?
A) thread
B) go
C) task
D) run
A) thread
B) go
C) task
D) run
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck
18
Following is the API for one of the load methods of the SoundPool class:
Int load( Context context, int i, int priority )
What does i represent?
A) A resource
B) The volume of the sound
C) The length of the sound
D) The number of times we will play the sound
Int load( Context context, int i, int priority )
What does i represent?
A) A resource
B) The volume of the sound
C) The length of the sound
D) The number of times we will play the sound
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck
19
How do we access the width of a Bitmap object reference named b?
A) int w = Bitmap.width;
B) int w = b.getWidth( );
C) int b = w.getWidth( );
D) int Bitmap.b = getWidth( )
A) int w = Bitmap.width;
B) int w = b.getWidth( );
C) int b = w.getWidth( );
D) int Bitmap.b = getWidth( )
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck
20
The setColor method of the Paint class takes an int parameter; when calling this method, it is possible to pass a hexadecimal number as its argument.
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck
21
In the following statement, c is a Canvas reference, b is a Bitmap reference, r is a Rect reference, and p is a Paint reference.
c.drawBitmap( b, null, r, p );
The bitmap will be drawn in its entirety.
c.drawBitmap( b, null, r, p );
The bitmap will be drawn in its entirety.
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck
22
It is possible to move a line drawn on the screen by moving your finger on the screen.
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck
23
The drawLine method of the Canvas class has this API:
void drawLine( float a, float b, float c, float d, Paint paint )
In this API, ( a, b ) represents the coordinate of the starting point of the line and ( c, d ) represents the coordinate of the ending point of the line.
void drawLine( float a, float b, float c, float d, Paint paint )
In this API, ( a, b ) represents the coordinate of the starting point of the line and ( c, d ) represents the coordinate of the ending point of the line.
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck
24
The BitmapFactory is a factory class to create __________________ objects.
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck
25
The postInvalidate method of the View class that has no parameter triggers a call to the __________________ method and refreshes the whole View.
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck
26
The SoundPool class, part of the __________________ package, enables us to load a sound and play it.
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck
27
The decodeResource method of the BitmapFactory class has this API:
static Bitmap decodeResource( Resources res, int i )
The parameter named i represents the __________________ of a resource.
static Bitmap decodeResource( Resources res, int i )
The parameter named i represents the __________________ of a resource.
Unlock Deck
Unlock for access to all 27 flashcards in this deck.
Unlock Deck
k this deck