Our team has conducted extensive research to compile a set of Android Game Development MCQs. We encourage you to test your Android Game Development knowledge by answering these 60+ multiple-choice questions provided below.
Simply scroll down to begin!
In Android game development, which of the following is the correct method to load the images using Eclipse?
A.
private void loadResources()
{this.glyphs = new Glyphs(BitmapFactory.decodeResource(R.drawable.glyphs_white));
Log.d(TAG, "Glyphs loaded")
B.
private void loadResources() {
this.glyphs = new Glyphs(BitmapFactory.decodeResource(getResources().glyphs));
Log.d(TAG, "Glyphs loaded");
C.
private void loadResources() {
this.glyphs = new Glyphs(BitmapFactory.decodeResource(getResources(), R.glyphs));
Log.d(TAG, "Glyphs loaded");
D.
private void loadResources() {
this.glyphs = new Glyphs(BitmapFactory.decodeResource(getResources(),R.drawable.glyphs_white));
Log.d(TAG, "Glyphs loaded");
E.
private void loadResources() {
this.glyphs = new Glyphs(BitFontFactory.decodeResource(getGlphsImages(),R.drawable.glyphs_color));
Log.d(TAG, "Glyphs loaded");
A. Error
B. Warning
C. Verbose
D. Debug
E. All of the above
A. setARGB(0, 255, 255, 0);
B. setRGB(0, 255, 255, 0);
C. setColor(0, 255, 255, 0);
D. setRGB(0, 255);
E. setARGB(0, 255, 255);
A. Vibrator vibrator = getSystemService(Activity.VIBRATOR_SERVICE); model.setVibrator(vibrator);
B. Vibrator vibrator = (Vibrator) getService(Activity.VIBRATOR_SERVICE); setVibrator(vibrator);
C. Vibrator vibrator = (Vibrator)getSystemService(Activity.VIBRATOR_SERVICE); model.setVibrator(vibrator);
D. None of the above
Suppose you are developing a game for an Android mobile phone using Eclipse. In the game, you want to set the height and width of the game frame as 1000 and 600 respectively if held normally and vice versa, that is height 600 and width 1000 if the orientation of screen is changed.
Which of the following is the correct syntax to do so?
A.
boolean CheckOrientation = getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
int frameBufferHeight = CheckOrientation ? 1000: 600;
int frameBufferWidth = CheckOrientation ? 600: 1000;
B.
getOrientation().getConfiguration().ORIENTATION_PORTRAIT;
if(true)
{
int frameBufferHeight = 1000px ;
int frameBufferWidth = 600px ;
}
else
{
int frameBufferHeight = 1000px ;
int frameBufferWidth = 600px ;
}
C.
boolean CheckOrientation(). getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
if(true)
{
int frameBufferHeight = 1000px ;
int frameBufferWidth = 600px ;
}
else
{
int frameBufferHeight = 1000px ;
int frameBufferWidth = 600px ;
}
D.
getOrientation().getConfiguration().ORIENTATION_PORTRAIT;
int frameBufferHeight = CheckOrientation ? 600: 1000;
int frameBufferWidth = CheckOrientation ? 1000: 600;
If you want to set the size of your textView control to 250 pixel, then which of the following xml queries can be used?
A.
<dimension name="abcDim">250px</dimension>
B.
<size name="abcDim">250</size>
C.
<dimension abcDim= 250px></Dimension>
D.
<dimen name="abcDim">250px</dimen>
A. type of computer-aided design (CAD)
B. Application programming Interface
C. Graphical Processing Unit
D. None of the above
A. RAM size
B. Battery Support
C. Cache partition size
D. DPad Support
E. None of the above
A. String rID= getString(R.string.hello);
B. String rID= getResources(R.string.hello);
C. String rID= getString().getResources(R.string.hello);
D. String rID= getResources().getString(R.string.hello);
A. private Map
B. private Map
C. private Map
D. private Map
E. private Map
A. Log.d(TAG, "Game Begins");
B.
LogCat(TAG, "Game Begins");
C.
TAG.Log("Game Begins");
D.
Log.Tag("Game Begins");
E.
Log.debug(TAG, "Game Begins");
View the section of Android code given below:
public void draw(Canvas canvas) {
Rect destRect = new Rect(getX(), getY(), getX() + spriteWidth, getY() + spriteHeight);
canvas.drawBitmap(bitmap, sourceRect, destRect, null);
canvas.drawBitmap(bitmap, 20, 150, null);
Paint Paint = new Paint();
paint.setARGB(50, 0, 255, 0);
canvas.drawRect(20 + (currentFrame * destRect.width()), 150, 20 + (currentFrame *destRect.width()) +destRect.width(), 150 + destRect.height(), paint);
The code is executed using eclipse. What does the above code do?
A.
It draws an image at two positions. One image is drawn at the coordinates (20, 150) and second at the coordinates (50, 255).
B.
It displays a frame at the coordinates (20, 150) and creates a new paint object so we can paint over the current frame on the original image.
C.
It displays a frame at the coordinates (50, 255) and creates a new paint object so we can paint over the current frame on the original image.
D.
It displays an image at the coordinates (50, 255) using the Paint method.
E.
It draws a rectangle at the coordinates (50, 255) using the Paint method.
Which of the following methods is used to display text on screen in eclipse?
A.
public void displayString(String text, int x, int y){
Canvas canvas;
for (int i = 0; i < text.length(); i++) {
Character Ch = text.CharAt(i);
if (glyphs.get(ch) != null) {
canvas.drawBitmap(glyphs.get(ch), x + i, (y* width), null); } } }
B.
displayString(Canvas canvas, String text) {
int x;
int y;
for (intx= 0; x < text.length(); x++) {
Character ch
if (glyphs.get(ch) != null) {
canvas.drawBitmap(glyphs.x+ (i* width.y, null); } } }
C.
public void displayString(Canvas canvas, String text, int x, int y){
for (int i = 0; i < text.length(); i++) {
Character Ch = text.CharAt(i);
if (glyphs.get(ch) != null) {
canvas.drawBitmap(glyphs.get(ch), x + (i * width), y, null); } } }
D.
public void displayString(Canvas canvas, String text, int x){
for (int y = 0; y < text.length(); y++) {
Character ch
if (glyphs.get(ch) != null) {
canvas.drawBitmap(glyphs.get(ch), x * width), null); } } }
A. 3D font
B. Dotted Font
C. Bitmap Font
D. Modern Font
State whether the following statement is true or false.
In Eclipse, on saving the .java files, the code is automatically compiled each time.
A.
True
B.
False
Which of the following are the features of the AndroidManifest.xml file?
I) Intent Filters
II) Permission
III) Project text
IV) Instrumentation
V) AppTheme
A.
I, III
B.
II, III, V
C.
I, II, IV
D.
III, V
E.
II, III, IV, V
A. Copy and paste the Warrior.ap.exe file onto the device and install the application.
B. Copy and paste the buildConfig.java file onto the device and install the application.
C. Copy and paste the Warrior.java file onto the device and install the application.
D. Copy and paste the Warrior.apk file onto the device and install the application.
E. Copy and paste the Warrior.exe file onto the device and install the application.
Suppose you want to draw an image, roboimage.png to coordinates (20, 20). The image is already present in the respective folder. Which of the following is the correct syntax to do so?
A.
protected void Draw(Canvas canvas) {
canvas.drawimage(BitmapFactory.Resource(getResources(),
R.drawable.roboimage), 20, 20);
B.
protected void Canvas() {
canvas.drawimage(BitmapFactory.decodeResource(getResources(),
R.drawable.roboimage), 20, 20, null);
C.
protected void onDraw(Canvas canvas) {
canvas.drawBitmap(BitmapFactory.decodeResource(getResources(),
R.drawable.roboimage), 20, 20, null);
D.
protected void Canvas() {
drawimage(BitmapFactory.decodeResource(getResources(),
R.drawable.roboimage), 20, 20);
E.
None of the above
A. Soundpool
B. MediaPlayer
C. Both a and b
D. None of the above
A. bin
B. assets
C. values
D. res
Which of the following devices can be used to run an Android application developed using Eclipse?
I) Android Refractor
II) Android Emulator
III) ProGuard
IV) Android device
A.
I and IV
B.
I, II and III
C.
II and IV
D.
All of the above
E.
II, III and IV
A. BuildConfig.java
B. R.java
C. AndroidManifest.xml
D. MainActivity.java
A. context.setVolumeControlStream(AudioManager.STREAM_MUSIC);
B. setVolumeControlStream(context.AudioManager.STREAM_MUSIC);
C. context.setVolumeControlStream(SoundManager.STREAM_MUSIC);
D. setVolumeControlStream(context.SoundManager.STREAM_MUSIC);
A. src
B. bin
C. res
D. libs
A. BaseAdapter
B. AdapterView
C. BaseExpandableListAdapter
D. CursorAdapter
A. Primitive objects
B. Non persistent objects
C. Both a and b
D. None of the above
A. Log.d
B. Log.v
C. Logcat
D. Tag.Log
E. Log.e
A. Emacs
B. Eclipse
C. Notepad++
D. IntelliJ IDEA
E. None of the above
A. Circle Layout
B. Linear Layout
C. Relative Layout
D. List view
A.
Android.app.Activity
B.
Android.app.admin
C.
Android.view.Menu
D.
Android.os.Bundle
Which of the following objects is/are used for building user interface elements in Android?
I) View
II) ViewGroup
III) Layout
A.
I
B.
II
C.
III
D.
I & II Only
E.
II & III Only
F.
All of the above
A. .dx
B. .dex
C. .exd
D. .exe
E. None of the above
A. R.java
B. Runmain.java
C. MainActivity.java
D. AndroidManifest.xml
A. Window–>Open perspectives–>Android–>LogCat
B. Window–>Others–>General–>LogCat
C. Window–>Show View–>Java–>General–>LogCat
D. Window–>Show View–>Other–>Android–>LogCat
A. MainActivity.java
B. AndroidManifest.xml
C. BuildConfig.java
D. both b and c
A. import Android.microedition.khronos.egl.EGLConfig;
B. import javax.microedition.khronos.egl.EGLConfig;
C. import Android.microedition.EGLConfig;
D. import javax.microedition.EGLConfig;
Which of the following image formats is/are supported by Android?
I. .jpg
II. .gif
III. .png
IV. .webp
A.
I, II, III
B.
II, III, IV
C.
I, III, IV
D.
III, IV
E.
All of the above
A. ~20fps
B. ~30fps
C. ~40fps
D. ~50fps
E. ~60fps
A. Mac
B. Linux
C. Solaris
D. All of the above
A. They are used very infrequently to store uncompiled files within the application package file that is installed on the handset.
B. They are used very frequently to store uncompiled files within the application package file that is installed on the handset.
C. They are used very infrequently to store compiled files within the application package file that is installed on the handset.
D. They are used very frequently to store compiled files within the application package file that is installed on the handset.
In the method given below, which code line sets the class "MainGamePanel" as the handler of the events happening on the actual surface?
1. public class MainGamePanel extends SurfaceView implements
2. SurfaceHolder.Callback {
3. public MainGamePanel(Context context) {
4. super(context);
5. getHolder().addCallback(this);
6. setFocusable(true);
7. }
A.
4
B.
5
C.
6
D.
None of the above
A. Android.app.Activity
B. java.lang.Object
C. Android.app.admin
D. None of the above
State whether the following statement is true or false.
While creating a new Android application using eclipse, we need to set the Android version for "Minimum Required SDK" and "Compile With" fields. Android version greater than or equal to Android 4.1 should be selected for both the fields.
A.
True
B.
False
A. Dialog
B. ActivityWindow
C. PopupActivity
D. PopupWindow
A. String getYes= Resource.getString().getSystem().(Android.R.string.Yes);
B. String getYes= Resources.getSystem().getString(Yes);
C. String getYes= Resources.getSystem().getString(Android.R.string.Yes);
D. String getYes= Resources.getString.getSystem(Android.R.string.Yes);
Study the method given below and answer the following question:
public Triangle() {
1.ByteBuffer vertexByteBuffer = ByteBuffer.allocateDirect(vertices.length * 4);
2. vertexByteBuffer.order(ByteOrder.nativeOrder());
3. vertexBuffer = vertexByteBuffer.asFloatBuffer();
4. vertexBuffer.put(vertices);
5. vertexBuffer.position(0);
}
Which code line allocates memory from byte buffer?
A.
1
B.
2
C.
3
D.
4
E.
5
State whether the following statement is true or false.
For handsets (mobile phone) debugging of Android applications, you cannot use eclipse.
A.
True
B.
False
OpenGL is used only for writing 3D Graphics that are rendered on GPU (Graphics Processing Unit).
A.
True
B.
False
A. Dalvik Debug Monitor Server (DDMS)
B. Android Debug Bridge(ADB)
C. Java Debugger
D. None of the above
A. Context context=New Context(this);
B. Context context=getApplicationContext();
C. Context context=getContext(this);
D. Context context=New Applicationcontext();