1

How to implement a snake game in android? What kind of view has to be used for this implementation?

  • You can use ImageView
  • Use ImageSwitcher
  • Use Custome View and draw directly on Canvas
  • Use existing predefined views and draw directly on canvas

Answer: C Use Custome View and draw directly on Canvas
Description: If you want to draw some images which will not have particular x,y co-ordinates and which moves randomly in the screen, then you can't do it with android predefined views. Better directly draw on canvas by creating custom views. Once canvas is under your control, then you can move your images randomly (as snake moves randomly) on the screen.

2

What is tween animation in android?

  • animating an image which is at a fixed location, like scaling, rotating, and alpha is called as tween animation.
  • switch between two images using image switcher is called as tween animation
  • playing frame after frame using animation-list xml property is called as tween animation.
  • all of the above are examples of tween animation.

Answer: A animating an image which is at a fixed location, like scaling, rotating, and alpha is called as tween animation.
Description: animating an image which is at a fixed location. Animating a single image with a series of transformations is tween animation.
There are 3 tween animation techniques.

1. scaling : Zooming in and Zooming out effect
2. rotating : Rotating a view clock wise or anti clock wise
3. alpha : making a view transparent or visible.

3

what is frame animation in android?

  • animating an image which is at a fixed location, like scaling, rotating, and alpha is called as frame animation.
  • switch between two images using image switcher is called as frame animation
  • playing frame after frame using animation-list xml property is called as frame animation.
  • all of the above are examples of frame animation.

Answer: C playing frame after frame using animation-list xml property is called as frame animation.
Description: playing image frame after image frame using animation-list xml property is called as frame animation.
Note : If you play 24 frames in a second, it will become a movie.

Tween animation will be animated only by using one image frame, where as frame animation requires multiple image frames to animate. That is the main difference.

4

Tween animation is part of which package?

  • it is part of android.graphics.drawable package
  • it is part of view package.
  • it is part of 3D graphics library (open GLES).
  • it is part of kernel.

Answer: B it is part of view package.
Description: tween animation is applicable to all views, so it is part of view package.

5

To achieve frame animation we use AnimationDrawable class. In which package it is located?

  • it is part of android.graphics.drawable package
  • it is part of view package.
  • it is part of 3D graphics library (open GLES).
  • it is part of kernel.

Answer: A it is part of android.graphics.drawable package
Description: FrameAnimation is part of android.graphics.drawable package.

6

How to draw directly on canvas of android UI?

  • Implement your own custom View by extending View class, and then implement onDraw method in it.
  • Take any UI control like ImageView, and draw image using canvas.
  • it is not possible to directly touch Canvas.
  • both option 1 and 2 are right.

Answer: A Implement your own custom View by extending View class, and then implement onDraw method in it.
Description: Directly drawing on Canvas can be done by creating custom views by extending view class. Where we can draw directly on canvas.

7

I am creating a game where a snake will be moving dynamically based on the user key directions, then how should I implement this snake image in my activity?

  • Use image view and put a snake image in that view, and move the view based on user key movements.
  • Use frame animation with multiple snake images on the same image view.
  • Use custom view, where you can draw your own shapes dynamically on canvas.
  • we can use any of the above 3 options for this requirement.

Answer: C Use custom view, where you can draw your own shapes dynamically on canvas.
Description: developing a snake game needs to redraw snake image very randomly and dynamically. also snake size may keeps increasing, so its better to take complete control over canvas and draw on it using a custom view.

8

What is the most feasible image format that I have to use with android devices. (Keep compatibility issues in mind)?

  • .jpg, or .jpeg.
  • .png
  • .gif
  • .9.png

Answer: D .9.png
Description: 9 patch image is the suggestible image to use, because it has the capability of scaling and padding automatically based on the screen size.

9

What is the tool to convert images to 9 patch image? where it will be located?

  • draw9patch is the tool name, it is located in android-sdk/platform-tools.
  • draw9patch is the tool name, it is located in android-sdk/tools.
  • 9patch is the tool name, it is located in android-sdk/platform-tools.
  • 9patch is the tool name, it is located in android-sdk/tools.

Answer: B draw9patch is the tool name, it is located in android-sdk/tools.
Description: draw9patch.bat is the tool name used to convert images to 9 patch images.
It is located in android-sdk/tools folder.

10

What is the use of 9 patch image compared to other images?

  • It will scale the images automatically based on the device screen sizes on which app is loaded.
  • it will make the images smaller in size compared to other png images.
  • it is used for security purpose for the images used in the project.
  • all of the above options are true.

Answer: A It will scale the images automatically based on the device screen sizes on which app is loaded.
Description:

11

what are the tags used in tween animation?

  • <scale>
  • <alpha>
  • <rotate>
  • all of the above.

Answer: D all of the above.
Description: tween animation has scale, alpha, and rotate tags.

12

If programmer don't know c/c++ and still wants to perform 3D graphics in android application, then how to do it?

  • use openGLES.
  • use AndEngine.
  • Use android.graphics.library.
  • Programmer can use any of the above mentioned options.

Answer: B use AndEngine.
Description: openGLES is used to perform best 3D graphics in android application. How ever to use openGLES programmer should have good knowledge of C & C++.
Alternative for openGLES is AndEgnine to do 3D graphics in android. To Use AndEngine one should know only Java.