Android Game Development MCQs

Android Game Development MCQs

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!

1:

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");

2: Which of the following log(s) is/are supported by Android.Util.Log class?

A.   Error

B.   Warning

C.   Verbose

D.   Debug

E.   All of the above

3: In an Android game, if you want to set the color of a particular screen as yellow, which of the following is the correct method to do so?

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);

4: In order to retrieve a vibrator for interacting with the vibration hardware, which of the following code is used in Android .java file (in eclipse)?

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

5:

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;


6:

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>  

7: OpenGL is a/an ________ .

A.   type of computer-aided design (CAD)

B.   Application programming Interface

C.   Graphical Processing Unit

D.   None of the above

8: While creating an Android Virtual Device (AVD) which of the following hardware options is fixed and cannot be changed by the user?

A.   RAM size

B.   Battery Support

C.   Cache partition size

D.   DPad Support

E.   None of the above

9: Which of the following is the correct way to retrieve a string instance named "hello" from the application resource of Android by using its resource id?

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);

10: Which of the following code lines describes a map to associate a bitmap to each character?

A.   private Map glyphs = new HashMap(62);

B.   private Map glyphs = new BitMap(62);

C.   private Map glyphs = new HashMap(62);

D.   private Map glyphs = new BitMap(62);

E.   private Map glyphs = new glyphs(62);

11: Suppose you are creating an Android application. If you want to print out a message that says "Game Begins" and use this for debugging purpose, then which of following statements should you use?

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");

12:

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.

13:

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); } } }


14: For Android games, which of the following font types should we use so that the font size remains consistent on different types of devices with different screen sizes?

A.   3D font

B.   Dotted Font

C.   Bitmap Font

D.   Modern Font

15:

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

16:

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

17: Suppose you have developed a game named "Warrior" using Eclipse. In order to run this game on an Android phone what is needed to be done?

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.

18:

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

19: Which of the following classes handles sound media in an Android game?

A.   Soundpool

B.   MediaPlayer

C.   Both a and b

D.   None of the above

20: In Eclipse, the layout folder of an Android application are located in which of the following folders by default?

A.   bin

B.   assets

C.   values

D.   res

21:

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

22: In an Android project which of the files should not be modified?

A.   BuildConfig.java

B.   R.java

C.   AndroidManifest.xml

D.   MainActivity.java

23: Suppose you are developing an Android game for mobiles. If you want to set the volume button of your phone to handle sounds of the game, which of the following is the correct syntax to do so?

A.   context.setVolumeControlStream(AudioManager.STREAM_MUSIC);

B.   setVolumeControlStream(context.AudioManager.STREAM_MUSIC);

C.   context.setVolumeControlStream(SoundManager.STREAM_MUSIC);

D.   setVolumeControlStream(context.SoundManager.STREAM_MUSIC);

24: While we are developing an application on eclipse, an .apk file is automatically generated. In which of the folders is this file generated?

A.   src

B.   bin

C.   res

D.   libs

25: Which of the following adapters exposes data from a Cursor to a ListView widget?

A.   BaseAdapter

B.   AdapterView

C.   BaseExpandableListAdapter

D.   CursorAdapter

26: Which of the following data type(s) is/are used by Android?

A.   Primitive objects

B.   Non persistent objects

C.   Both a and b

D.   None of the above

27: If you want to print or log everything that happens in your application, which of the following tags should you use?

A.   Log.d

B.   Log.v

C.   Logcat

D.   Tag.Log

E.   Log.e

28: The Integrated Development Environment for Android game development is/are ___________.

A.   Emacs

B.   Eclipse

C.   Notepad++

D.   IntelliJ IDEA

E.   None of the above

29: Which of the following layouts is not there in Android SDK?

A.   Circle Layout

B.   Linear Layout

C.   Relative Layout

D.   List view

30:

Examine the code given below:

public boolean onCreateOptionsMenu(Menu menu) {

// Inflate the menu; this adds items to the action bar if it is present.

getMenuInflater().inflate(R.menu.activity_main, menu);

return true;

}

Which of the following classes need(s) to be imported in order for this function to work properly?


A.  

Android.app.Activity

B.  

Android.app.admin

C.  

Android.view.Menu

D.  

Android.os.Bundle

31:

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

32: In Android, a tool called DX is used to convert java .class files into _________format.

A.   .dx

B.   .dex

C.   .exd

D.   .exe

E.   None of the above

33: __________ file in the Android project is an auto generated file and is stored in the package gen.

A.   R.java

B.   Runmain.java

C.   MainActivity.java

D.   AndroidManifest.xml

34: How can you view the LogCat in your Eclipse editor?

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

35: If a developer wants to modify the fundamental characteristics and components of an Android application developed using Eclipse, then which file he should edit to do so?

A.   MainActivity.java

B.   AndroidManifest.xml

C.   BuildConfig.java

D.   both b and c

36: In Android, which of the following header files is needed to be imported in the class that implements OpenGL Renderer given that the game is being developed using Eclipse?

A.   import Android.microedition.khronos.egl.EGLConfig;

B.   import javax.microedition.khronos.egl.EGLConfig;

C.   import Android.microedition.EGLConfig;

D.   import javax.microedition.EGLConfig;

37:

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

38: In mobile games, what is the ideal frame rate in frame per second (fps) for no noticeable glitches in the motion of objects?

A.   ~20fps

B.   ~30fps

C.   ~40fps

D.   ~50fps

E.   ~60fps

39: The Android operating system is based upon which of the following Kernel/s?

A.   Mac

B.   Linux

C.   Solaris

D.   All of the above

40: What are application assets in Android?

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.

41:

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

42: The base class for Android Activity class is_______________.

A.   Android.app.Activity

B.   java.lang.Object

C.   Android.app.admin

D.   None of the above

43:

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 

44: In order to create pop-up windows inside an Android game, a/an ________ class is used.

A.   Dialog

B.   ActivityWindow

C.   PopupActivity

D.   PopupWindow

45: Suppose you want to retrieve a system resource string called "Yes" from within an Activity class. Which of the following queries should you use to do so?

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);

46:

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

47:

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 

48: State whether the given statement is true or false.

OpenGL is used only for writing 3D Graphics that are rendered on GPU (Graphics Processing Unit).


A.  

True 

B.  

False 

49: Which of the following debugging tools is used in Android game development?

A.   Dalvik Debug Monitor Server (DDMS)

B.   Android Debug Bridge(ADB)

C.   Java Debugger

D.   None of the above

50: The application context for the current process can be retrieved using which of the following methods in Android?

A.   Context context=New Context(this);

B.   Context context=getApplicationContext();

C.   Context context=getContext(this);

D.   Context context=New Applicationcontext();