R4RIN
Articles
Java 8
MCQS
Android MCQ Quiz Hub
Android Programming MCQ Set 5
Choose a topic to test your knowledge and improve your Android skills
1. Which statement converts the Object into String?
String.valueOf(Object)
String.value(Object)
string.valueOf(Object)
None of the above
2. Which of the following is not an activity lifecycle method?
onCreate()
onStart()
onStop()
onDetach()
3. ____ are like reusable components or subactivities and can be reused between screens.
Views
Activities
Fragments
Layouts
4. To pass extra information with intent we can use which Intent object method?
putExtra()
putMessage()
putText()
putValue()
5. Which of the following is correct in order to get a reference to the TextView having an id of "water"
findViewById(R.id.water)
findViewId(R.id.water)
findViewById('water')
findByViewId(R.id.water)
6. To run your app on a REAL device which of the following are required? Check all that apply.
Enable USB debugging on Android device
Install USB driver for Windows or create udev rules file for Linux. No USB drivers needed for Mac
Create AVD in Android Studio
None of These
7. Which of the following is true for R.java? (choose all that apply)
R.java is a special Java file that gets generated by the Android tools whenever you create or build your app
Android uses R.java to keep track of the resources used within the app
It enables you to get references to GUI components from within your activity code
All of the above
8. Which of the following is/are correct about Intent filter?
An intent filter specifies what types of intent each component can receive
Intent filters are defined inside AndroidManifest.xm
An intent filter also specifies a category
All of the above
9. Which of the following are true for intent?
It’s a type message that allows you to bind separate objects (such as activation) together at runtime.
If one activity wants to start a second activity, it does it by sending an intnet to Android.
startActivity(intent); This tells Android to start the activity specified by the intent.
All of the above
10. Which of the following is the correct location of the menu resource file?
res/menu/filename.xml✔
res/menus/filename.xml
res/resource/filename.xml
res/layout/filename.xml
11. Which object can be used to display a pop-up message?
Dialogue
Toast
Popup
All of the above
12. Which method sets the layout for the activity?
setLayoutView()
setActivityView()
setView()
setContentView()
13. To connect list view to array we can use:
Arrayadapter
Listview
Activity
Handle
14. A menu resource file in Java can be referenced as (...)?
R.appmenu.filename
R.appbar.filename
R.menu.filename
R.id.filename
15. Which of the following folder locations can be used for layouts to accomodate different screen sizes? (choose all that apply.)
res/layout
res/layout-large/
res/layout-xlarge
All of the above
16. Which of the following tools is used for stress-testing an Android application and reporting back the errors that come up?
JUnit
Ul/Application Exerciser Monkey
Neither J Unit nor Ul/Application Exerciser Monkey is used
Both, JUnit and Ul/Application Exerciser Monkey, are used together
17. Which of the following log messages should you select for displaying the expected log messages for regular usage and the message levels lower in the list?
Assert
Warn
Info
Debug
18. Which of the following is the default log level of selendroid?
DEBUG
VERBOSE
INFO
ERROR
19. While working on Android Studio, which of the following features are supported by the monkeyrunner tool in order to perform Android testing? i) It supports functional testing. ii) It supports regression testing. iii) It supports only single device control. iv) It supports extensible automation.
Only options i and ii
Only options. i. ii. and iii
Only options, i, ii, and iv
All options i, ii, iii and iv
20. Which of the following Selenium commands is used for returning the text from a specified cell in a table?
storeTable
assertTable
storeEditable
assertEditable
21. In Addroid Studio, which of the following is the correct syntax of the bmgr restore command used for immediately invoking the restore operation for an application whose testing is being done?
adb shell bmgr restore enable
adb Shell bmgr restore
adb shell bmgr.restore --
adb shell 逓bmgr.restore
22. Which of the following methods can be used to Check whether or not an element supports multi—selection?
3 assertEqual(check.isMultiple());
3 assertFalse(make.isMultiple());
D assertEqual(isMultiple());
D assertFalse.isMultiple();
23. Which of the following is the correct syntax of the command that you will be running if you want to see how your app's memory is divided between different types of RAM allocation?
adb shell dumpsys meminfo [-d]
adb shell dumpsys - d meminfo
adb shell dumpsys —meminfo -d
adb shell dumpsys [-d] -meminfo
24. In Android Studio, which of the following commands is passed to the dumpsys tool so that it provides an output in logcat with performance information that is related to the frames of animation, which occur during the recording phase?
meminfo
screencap
gfxinfo
Is
25. Which of the following Android classes provides JUnit framework, Android-specific setup, teardown, and helper methods?
AndroidJUnitRunner
AndroidTestCase
MonitoringInstrumentation
AndroidJUnit4
26. Which of the following is the general syntax of the "am instrument" command used in Android Studio?
am instrument [flags]
am instrument l [flags]
am instrument [flags]
am instrument [flags] l
27. Which of the following is the correct syntax of monkeyrunnner command used in Android Studio?
monkeyrunner -plugin
monkeyrunner new plugin - __
monkeyrunner. plugin
monkeyrunner -plugin. ~s
28. Which of the following is the correct syntax of zipalign command for confirming the alignment of existing.apk?
zipalign [-c] [-f] [-v] existing.apk
zipalign -f -v existing.apk
zipalign -c -v existing.apk
zipalign -v existing.apk -c
29. Which of the following statements is correct about GPU tracing in Android Studio?
The user can take a GPU trace while debugging the app.
GPU tracing always starts at the beginning of an app; users cannot launch it directly into a later Portion.
In Android Studio, users can never delete the trace libraries.
GPU tracing does not modify the user's APK.
30. While using Appium tool, what is the function of the following command? > appium --nodeconfig /path/to/nodeconfig.json
It is used to custom path to the instruments command line tool
It is used to set the log output file
It is used to reset the app state
it is used to register Appium server with a local selenium grid
31. Which of the following is the correct format of logcat messages?
date time PlD-TlD/package priority/tag: message
time date TID/PlD/package priority/tag: message
date/time/PlD-TlD/package priority/tag: message
time/Date —T|D —P|D /package priority/tag: message
32. In Android Studio, which of the following is the correct syntax for using jobb in order to dump the contents of an existing 088 file?
$ jobb -pn ltemp/obb-output/ -d -o my-app-assets.jobb —k.secret-key
$ jobb -d ltemp/obb-output/ -o my-app-assets.obb -k secret-key
$ jobb -pn ltemp/jobb-output/ -o my-app-asset5.obb —k.secret-key
$ jobb -d ltemp/obb-output/ -o —pn my—app-assets.jobb —k secret-key
33. In Android Studio, which of the following options of the Monkey command stops the Monkey from executing until a debugger is attached to it?
-s
«dbg-no-events
-c
—wait-dbg
34. Which of the following debug types can you use if you wish to use only LLDB for debugging your code where Java debugger session view is NOT available?
Auto
Java
Hybrid
Native
35. While using uiautomator tool, what is the correct syntax of the command that needs to be executed for creating the required build configuration files for building the output JAR?
/tooIs/android «create uitest-project -n -r1 -p
/tooIs/android create new uitestroject -n -t -p -1
/tooIs/android create uitest-project -n -t1 -p
/tools/android create new -u uitest project -n -t -p -1
36. In Android Studio, which Of the following monkeyrunner API class provides methods for installing and uninstalling packages and is also used for running test packages?
MonkeyRunner
MonkeyDevice
Monkeylmage
Both options a and c
37. Which of the following is an argument of the sleep method of MonkeyRunner class that pauses the current program for a specified amount of time?
Minutes
Microseconds
Milliseconds
Seconds
38. Which of the following is the correct Java syntax for retrieving the innerText value contained within an element?
WebElement element = drivenfindElementpartia|LinkText(
element = drivenfindElement.id(
element = driver.element|D.findElement(
WebElement element = driverftndElement(By.id())
39. With which of the following tools is the Ul/Application Exerciser Monkey tool run in order to send pseudo-random streams of keystrokes, touches, and gestures to an Android device?
bmgr tool
etc1 tool
adb tool
logcat tool
40. ln Android Studio, what is the function of the Thread.dumpStack0 method?
It is used for analyzing stack traces that are shared in the bug reports from external sources
It is used for monitoring the clipboard for new stack traces
It is used for printing a stack trace at any point in an app code
None of the above
41. While running some tests against an Android device using Selenium, which of the following commands can be used to forward the HTTP traffic to the device?
adb -s redirect tcp:8080 tcp:8080
Abd -a redirect tcp:8080 tcp:8080
adb -s forward tcp:8080 tcp:8080
Abd -a forward tcp:8080 tcp:8080
42. ln Android Studio, which of the following keys would you press to add a line breakpoint after you have located the code line where you wish to pause the execution and placed the caret on that line? (Consider the operating system to be Windows.)
Control+F8
Control+F9
Control+F6
None of these
43. In Android Studio, which of the following is the correct syntax of the method used for waking the screen of Mon keyDevice?
void wake (integer x, integer y) (Here x and y are horizontal and vertical positions of the touch in an actual pixel device)
void wake ()
Monkeylmage wake ()
Monkeylmage wake (integer x. integer y)
44. While working on Android Studio, which of the following commands is used for importing the Python modules?
Python from com.android.monkeyrunner import
run from com.android.monkeyrunner import
Python from com.android.monkeyrunner set-import
from com.android.monkeyrunner import
45. In Android Studio. which of the following is the correct return type of MonkeyDevice waitForConnection (float timeout, string deviceld) method that tries to establish a connection between the monkeyrunner backend and the specified device or emulator?
void
string
MonkeyRunner instance for the device or emulator.
MonkeyDevice instance for the device or emulator.
46. Which of the following tools provides an API for writing programs that are used for controlling an Android device or emulator from outside of Android code?
JUnit
UllApplication Exerciser Monkey
DDMS
monkeyrunner
47. Extending your class with TestCase class and implementing which of the following methods allows you to use a JUnit TestCase?
run()
testAdd()
show()
setUp()
48. Which of the following methods in Selendroid starts a mobile web testing session?
new SelendroidCapabilities( ..)
SelendroidCapabilities.android( )
SelendroidCapabilities.device( ...)
Both options a and c
49. In Android Studio, which of the following tools is used for shrinking, optimizing, and obfuscating the user
ProGuard
etc1tool
Draw 9-patch
zipalign
50. While using Selendroid, which of the following properties specifies the app id of a native or hybrid app under test?
aut
locale
model
apiTargetType
51. Suppose. you want to analyse the UI components of an application that is to be tested. You have already connected your Android device to your deployment machine, Opened the terminal window, and navigated to ltoolsl. The next step is to run the uiautomatorviewer tool. Which of the following commands will you use to run this tool?
set uiautomatorviewer
uiautomatorviewer
uiautomatorviewer.run
uiautomatorviewer
52. Which of the following is the correct syntax of a command for launching the Monkey in a quiet. non-verbose mode in Android Studio?
$ adb shell [options] monkey
S anb shell [options] monkey
S adb shell monkey [Options]
S anb Shell [options] monkey
53. Which Of the following is the correct syntax of the activity manager command used for starting profile on and writing results to ?
profile start
start profile write to
start profile write
profile start write
54. ln Android Studio, which Of the following logs is compiled in but stripped at runtime?
error log
debug log
info log
warning log
55. In Android Studio, which of the following debugging tools provides the user a graphical viewer for execution logs saved by the user
Device Monitor
Android Monitor
systrace
traceview
56. Which of the following selendroid-standalone command line parameters Specifies the port for selendroid-standalone to run on?
-emulatorPort
-selendroidServerPort
-port
57. Which of the following is the correct syntax of the ui automator tool command that is used for deploying the user generated test JAR file to the test device? Which of the following is the correct syntax of the ui automator tool command that is used for deploying the user generated test JAR file to the test device?
adb.push /data/local/tmp/
adb push ldata/Iocal/tmp/
adb push to Idata/IocaI/tmp/
adb push to -t Idata/Iocal/tmp/
58. While using Android studio, which of the following commands would you run in order to run your instrumented unit tests with Cradle?
lgradlew test
lgradlew test CAT
lgradlew CAT
lgradlew CAT test
59. Which of the following tools, in Android Studio, allows the user to analyze his/her application's execution in the context of system processes, to help in the diagnosis of display and performance issues?
Tracer for OpenGL
ES ProGuard
Systrace
Android Monitor
60. As a test engineer of an IT organization if you are required to check whether or not the target app returns the correct UI output in response to user interactions in the activities of the app, then which of the following types of testing would you use?
Instrument unit test
Components within your app only (Integration Test)
Local Units Test
Cross-app Components (Integration Test)
61. Which of the following arguments is NOT used by the alert method, of MonkeyRunner class, that displays an alert dialog to the process running the current program?
format
message
title
okTitle
62. In Android Studio, which of the following tools allows the users to debug and optimize their user interface?
mksdcard
ddms
systrace
Hierarchy Viewer
63. Which of the following commands is used by Selenium grid for checking the ports used by all running programs on your machine?
netstat -at
netstat -a
netstat -u
netstat-l
64. In your JUnit 4 test class, which of the following annotations would you use for specifying static methods for each test class to invoke only once?
@Rule
@Test
@BeforeClass
@Before
65. Which of the following is the correct syntax of the command that is executed for using Monkey tool on the default Android Ul application, given that the user has already navigated to the required directory and connected the Android device with the PC?
adb shell monkey -p your.package.name -v 500
adb shell command— monkey -p —v your.package.name -500
logcat shell monkey -v your.package.name -p «500
shell logcat —v monkey o-p your.package.name -500
66. In Android Studio, which of the following is the correct syntax of the shell command used for listing all the available shell programs?
adb shell lists lsystem/bin
adb Is shell /system.bin
adb shell ls lsystem/bin
adb list shell/system/bin
67. In Android Studio, which of the following features are provided by the Ul/Application Exerciser Monkey? i) It provides Options for Operational constraints, for example, restricting the test to a single package. ii) It provides options for event types and frequencies. iii) It provides basic configuration Options. iv) It provides debugging options.
Only options i) and iii)
Only options i) and ii
All options 0, ii), iii), and iv)
None of these
68. Which of the following tools help(s) a user in analyzing their application's Ul in different orientations?
uiautomatorviewer
uiautomator
JUnit
Both a and b
69. While running tests against Safari on a real iOS device, what is the use of "iOS-webkit-debug-proxy"?
It is used to debug Safari on iOS device.
It is used to access web views on iOS device.
It is used to launch Safari on iOS device.
None of the above
70. Which of the following is the correct syntax of CSS partial match that will use the "checkName" part in the middle of the ID of an element "abc_checkName_xyz" to match and find the element in Selenium?
Input["id='checkName']
lnput[id'='checkName']
lnputf[id$=‘checkName’]
lnput[id="checkName"]
Submit