Android App Development Test - 2
Android App Development Test-2
Questions
Android 2.3 introduced a new developer tool called __________. This tool detects disk or network operations occurring on the main thread and takes action to warn the developer.
- SMode
- StrictMode
- DetectMode
- DetectAll()
What is the purpose of Handler class in android?
- This allows us to send message to be processed immediately only.
- This allows us to send messages can be processed at some time in the future only.
- This allows us to send messages which can be processed immediately or scheduled for processing at some time in the future.
- None of the above
The _________ class creates and manages a MessageQueue object that holds all messages for a thread.
- loader
- looper
- handler
- load
The looper class creates and manages a______________ object that holds all messages for a thread.
- QueueMessage
- Handler
- MessageThread
- MessageQueue
Which of the following is not a valid screen pixel density?
- ldpi
- mdpi
- hdpi
- xdpi
Which of the following is the correct way to declare StrictMode that detects all types of networks and disk I/O?
- ```java
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.penaltyDialog()
.build()); - ```java
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.penaltyDeath()
.build()); - ```java
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.penaltyDialog()
); - ```java
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyDialog()
.build());
How can we create a method that checks for messages in the message queue?
- ```java
Public Boolean isTimerRunn(){
Return mHandler.hasMessages(0);
} - ```java
Private Boolean isTimerRunn(){
Return mHandler.hasMessages(0);
} - ```java
Private Boolean is TimerRunn(){
Return mHandler.hasMessages(0);
} - ```java
Private Boolean isTimerRunn(){
Return mHandler.queueMessages(0);
}
In contrast to ________, android doesn’t know the size, screen resolution or aspect ratio of the devices they run on.
- Android devices
- IOS devices
- Blackberry devices
- Microsoft
How many types of screen sizes are there in the configuration option of android?
- Small, normal, and large
- Small, normal, large, and xlarge
- Small, medium,and large
- Small, medium, large, and xlarge
Which of the following is not a Android dimension units?
- mm
- pt
- dip
- cp
Which of the following statement is/are correct?
A. dip is an abstract unit representing a single pixel on a device with a resolution of 160 dpi.
B. pt unit are the 1/75 of the physical screen size.
- Only A
- Only B
- Both A and B
- Neither A nor B
Which of the following classes can be extended to create a simple thread to perform background tasks and publish the results on the UI thread?
- Async
- AsyncBackgroundTask
- AsyncTask
- SyncTask
Which of the following codes will record the current system time and send a message to the handler starting the timer and remove any existing message before sending the next one?
- ```java
Private void startTimer(){
mSt=System.currentTimeMillis();
mHandler.removeMessages(0);
mHandler.sendEmptyMessage(0);
} - ```java
Private void startTimer(){
mSt=System.currentTime();
mHandler.removeMessages(0);
mHandler.sendEmptyMessage(0);
} - ```java
Private void startTimer(){
mSt=System.currentTimeMillis();
mHandler.removeMessage(0);
mHandler.sendEmptyMessage(0);
} - ```java
Private void startTimer(){
mSt=System.currentTimeMillis();
mHandler.removeMessages(0);
mHandler.sendEmptyMessages(0);
}
Which of the following classes is useful in a situation like downloading new posts from Twitter and then loading those posts into a timeline?
- AsyncTask
- Loader
- Handler
- MessageQueue
List the point which makes your app compatible with majority of the devices:
A. Always use dip unit in your layout.
B. Use wrap_content and match_parent whenever possible.
C. Provide alternative image resources for each density .
D. Use 9-patch graphics for any resources.
E. Always use sp unit in your layout.
- B, C, D, E
- A, B, C, E
- A, B, C, D
- A, C, D, E