Mobile Application Development** 2. Which of the following components does the W
ID: 3911436 • Letter: M
Question
Mobile Application Development**
2. Which of the following components does the Where’s My Phone? app use while waiting for a text message in the background?
Activities
Services
Broadcast Receivers
Content Providers
3. Which is the correct argument sent to the onOptionsItemSelected method to make menu items useful?
Activity act
Class clss
Menu menu
MenuItem item
4. Which of the following is NOT part of the Java class declaration?
Name the class.
Import external resources
Declare any inherited classes
Declare any implemented interfaces
5. What is the text displayed on the canvas after the execution of the following code?
0 super.onDraw(canvas);
1 Paint dotPaint = new Paint();
2 dotPaint.setColor(Color.RED);
3 canvas.drawRect(dotX, dotY, dotX + 20, dotY + 20, dotPaint);
4 a = 1;
5 b = 2;
6 a = b;
7 b = a;
8 canvas.drawText(“a: “+a+“| b: “+b, 20, 20, dotPaint);
a: 1|b: 1
a: 2|b: 1
a: 1|b: 2
a: 2|b: 2
7. Provided you know the namespace and attribute information, it is easier to manually code the menu’s XML code than it is to use the IDE to generate the menu’s XML code.
True
False
Explanation / Answer
2. Broadcast Receivers
Explanation: Broadcast Receivers wait for a specific event to occur, and when happended, perform certain operations. In this case, the Broadcast Receivers wait for the incoming SMS.
3. MenuItem item
Explanation:
This hook is called whenever an item in your options menu is selected. The default implementation simply returns false to have the normal processing happen (calling the item's Runnable or sending a message to its Handler as appropriate). You can use this method for any items for which you would like to do processing without those other facilities.
4. Import external resources
Explanation: Self explanatory.
5. a: 2|b: 2
Explanation: When we do a = b, the value of a becomes 2. After that we do b = a, which in turns copies 2 to b. Hence, a = 2, b = 2
7. True
Explanation: Self explanatory.