Unit 3: Android Native Apps Automation with Appium - Practice Quiz

CSE379 — Mobile Automated Testing 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 Which locator uses the resource-id of an Android element?

Introduction to Id, Xpath and Accessibility ID locators in App with an example Easy
A. Text locator
B. XPath locator
C. ID locator
D. Class name locator

2 Which locator is commonly used to find an element by its accessibility label?

Introduction to Id, Xpath and Accessibility ID locators in App with an example Easy
A. Screen size
B. Resource class
C. Accessibility ID
D. Package name

3 What does XPath describe when locating an element in an Android app?

Introduction to Id, Xpath and Accessibility ID locators in App with an example Easy
A. The device battery
B. The screen brightness
C. The app version
D. The element path

4 Which Appium method is commonly used to return all matching elements?

How to handle Mobile popups and return list of matching elements on Android app Easy
A. findWindow
B. findElements
C. getDevice
D. closeElements

5 What is a common way to handle an Android alert popup?

How to handle Mobile popups and return list of matching elements on Android app Easy
A. Restart the computer
B. Accept or dismiss it
C. Delete the test script
D. Change the app name

6 Which Appium method extracts the visible text from an element?

How to extract the text and enter the information on Mobile Apps with Appium Easy
A. getText
B. click
C. sendKeys
D. clear

7 Which method is used to enter text into an input field?

How to extract the text and enter the information on Mobile Apps with Appium Easy
A. getAttribute
B. isDisplayed
C. getText
D. sendKeys

8 What is the main purpose of an automated test case?

Introduction to App features and test cases to automate Easy
A. Design a new logo
B. Check app behavior
C. Install a keyboard
D. Increase screen size

9 Which app feature is suitable for an Appium test?

Introduction to App features and test cases to automate Easy
A. Login functionality
B. Developer salary
C. Computer wallpaper
D. Office location

10 What should a shopping form test verify after entering valid details?

Test Case in Filling the form details for shopping Easy
A. The phone turns off
B. Form submission succeeds
C. The app icon changes
D. The test file is renamed

11 Which action enters a customer's name into a shopping form field?

Test Case in Filling the form details for shopping Easy
A. Press back
B. Close session
C. Swipe screen
D. Send text

12 What is a toast message in an Android application?

Verifying toast messages for error validations Easy
A. A database table
B. A navigation menu
C. A brief notification
D. A permanent screen

13 What should a test verify when a required form field is empty?

Verifying toast messages for error validations Easy
A. A device restart
B. The expected error toast
C. A new application
D. A larger text field

14 Why is scrolling used in a product list test?

Testcase: Scrolling in product list example with Appium Android scroll Easy
A. To change the password
B. To reach hidden products
C. To uninstall the app
D. To close the driver

15 Which gesture moves the product list toward lower items?

Testcase: Scrolling in product list example with Appium Android scroll Easy
A. Press back
B. Tap twice
C. Rotate the device
D. Swipe upward

16 How can a test dynamically select a product from a list?

Testcase: Dynamically selecting Product by scanning list based on text Easy
A. Use a fixed delay
B. Compare product text
C. Change device language
D. Clear the application

17 What should happen when the required product text is found?

Testcase: Dynamically selecting Product by scanning list based on text Easy
A. Click the matching product
B. Close the test runner
C. Remove all products
D. Restart the emulator

18 What does a total amount validation usually compare?

Testcase: Validating Total amount generated functionality Easy
A. App names and versions
B. Expected and displayed totals
C. Colors and font sizes
D. Usernames and passwords

19 Which values may be used to calculate a shopping total?

Testcase: Validating Total amount generated functionality Easy
A. Price and quantity
B. Name and address
C. Version and package
D. Screen and battery

20 Why are user-defined functions useful in Appium test code?

Code optimization with user defined functions Easy
A. They disable assertions
B. They reduce repeated code
C. They remove all locators
D. They replace the mobile app

21 An Android element has the resource ID com.shop.app:id/cartButton. Which Appium locator is the most direct choice?

Introduction to Id, Xpath and Accessibility ID locators in App with an example Medium
A. AppiumBy.xpath("//*[@text='cartButton']")
B. AppiumBy.className("com.shop.app:id/cartButton")
C. AppiumBy.accessibilityId("com.shop.app:id/cartButton")
D. AppiumBy.id("com.shop.app:id/cartButton")

22 A button has no resource ID but exposes the content description Checkout. Which locator should be preferred?

Introduction to Id, Xpath and Accessibility ID locators in App with an example Medium
A. AppiumBy.className("Checkout")
B. AppiumBy.accessibilityId("Checkout")
C. AppiumBy.id("Checkout")
D. AppiumBy.xpath("//*[@id='Checkout']")

23 When is XPath most appropriate for locating an Android element?

Introduction to Id, Xpath and Accessibility ID locators in App with an example Medium
A. When matching requires hierarchy or multiple attributes
B. When locating every element by screen coordinates
C. When a unique accessibility ID is available
D. When a stable resource ID is available

24 A test must tap Allow on an Android permission popup only when the button appears. Which approach best avoids an exception when the popup is absent?

How to handle Mobile popups and return list of matching elements on Android app Medium
A. Call findElement and assume the popup exists
B. Call findElements and check whether the list is empty
C. Call navigate().back() before checking the popup
D. Call getPageSource and tap fixed coordinates

25 What does driver.findElements(AppiumBy.className("android.widget.TextView")) return when no matching elements are present?

How to handle Mobile popups and return list of matching elements on Android app Medium
A. A NoSuchElementException immediately
B. A list containing one null value
C. The first invisible text element
D. An empty list of elements

26 A test needs to replace an existing value in a mobile text field with Alex. Which sequence is most reliable?

How to extract the text and enter the information on Mobile Apps with Appium Medium
A. Call clear() and then sendKeys("Alex")
B. Call click() and then getText()
C. Call submit() and then sendKeys("Alex")
D. Call getText() and then clear()

27 A price label displays $45.50. Which method should first be used to retrieve the displayed value for validation?

How to extract the text and enter the information on Mobile Apps with Appium Medium
A. priceElement.isSelected()
B. priceElement.sendKeys()
C. priceElement.getSize()
D. priceElement.getText()

28 Which test case provides the strongest functional coverage for a shopping app's cart feature?

Introduction to App features and test cases to automate Medium
A. Verify adding a product updates the cart
B. Verify the device wallpaper remains unchanged
C. Verify the status bar clock is visible
D. Verify the app icon color

29 A checkout feature accepts customer details and creates an order. Which scenario is the best candidate for an end-to-end Appium test?

Introduction to App features and test cases to automate Medium
A. Compile a utility class without warnings
B. Inspect a database table without opening the app
C. Measure the size of the application package
D. Submit valid details and verify order confirmation

30 A shopping form contains country, name, gender, and a Shop button. What should the test do before tapping Shop in a valid submission scenario?

Test Case in Filling the form details for shopping Medium
A. Populate every required field with valid data
B. Populate only the first visible field
C. Restart the app after each field
D. Leave required fields empty intentionally

31 A country dropdown contains many values and Argentina is initially off-screen. Which test sequence is most appropriate?

Test Case in Filling the form details for shopping Medium
A. Select the first country and rename it afterward
B. Tap the dropdown repeatedly without locating an option
C. Open the dropdown, scroll to Argentina, and select it
D. Type Argentina into the customer name field

32 A form displays a short Android toast after submission with an empty name. Which XPath can locate any visible toast element?

Verifying toast messages for error validations Medium
A. //android.widget.Button
B. //android.widget.Spinner
C. //android.widget.Toast
D. //android.widget.EditText

33 Why should an explicit wait be used when validating a toast message?

Verifying toast messages for error validations Medium
A. Toast messages remain visible until the app closes
B. Toast messages disable every element locator
C. Toast messages always require a screen rotation
D. Toast messages appear briefly and may be missed

34 Which Android UIAutomator expression scrolls a scrollable container until the product text Jordan 6 Rings is visible?

Testcase: Scrolling in product list example with Appium Android scroll Medium
A. new UiSelector().scrollable(false).clickable("Jordan 6 Rings")
B. new UiSelector().resourceId("Jordan 6 Rings").scroll(false)
C. new UiScrollable(new UiSelector().scrollable(true)).scrollIntoView(new UiSelector().text("Jordan 6 Rings"))
D. new UiScrollable().text("Jordan 6 Rings").sendKeys(true)

35 After scrolling to an off-screen product, what should the test verify before tapping its Add to Cart control?

Testcase: Scrolling in product list example with Appium Android scroll Medium
A. The target product row is displayed
B. The keyboard is permanently hidden
C. The device battery is fully charged
D. The app package name has changed

36 A page contains several product cards, each with a title and an Add to Cart button. How should a test select the card titled Converse All Star?

Testcase: Dynamically selecting Product by scanning list based on text Medium
A. Tap a fixed coordinate used by the previous product
B. Tap the first button returned from the entire page
C. Count all cards and always select the last card
D. Find the matching title and tap the button within its card

37 While scanning visible product elements, which condition correctly identifies a requested product stored in targetName?

Testcase: Dynamically selecting Product by scanning list based on text Medium
A. productName.getText().equals(targetName)
B. productName.isSelected() == false
C. productName.getText().isEmpty()
D. productName.getSize().equals(targetName)

38 A cart displays item prices $120.50 and $79.50, with no tax or discount. What total should the test expect?

Testcase: Validating Total amount generated functionality Medium
A. $210.00
B. $201.00
C. $200.00
D. $190.00

39 Which approach is most reliable for validating a cart total from labels such as $1,250.75 and $249.25?

Testcase: Validating Total amount generated functionality Medium
A. Remove formatting, parse decimal values, sum them, and compare
B. Join the price strings and compare their character count
C. Parse only the digits before each decimal point
D. Compare the total label with the final item price

40 Several tests repeatedly scroll to a product name and add that product to the cart. Which helper design best reduces duplication?

Code optimization with user defined functions Medium
A. addFirstProductToCart()
B. addProductToCart(String productName)
C. storeProductScreenSize()
D. restartAppBeforeProduct()

41 An Android login button has a build-dependent resource ID, a stable content-desc of submit-login, and visible text that changes with localization. Which locator is most resilient across builds and languages?

Introduction to Id, Xpath and Accessibility ID locators in App with an example Hard
A. AppiumBy.accessibilityId("submit-login")
B. By.id("com.example:id/generated_42")
C. By.xpath("//android.widget.Button[1]")
D. By.xpath("//android.widget.Button[@text='Login']")

42 A screen contains several product cards, each with a product name and an ADD TO CART button. Which XPath selects the button belonging specifically to the card containing Air Jordan 4?

Introduction to Id, Xpath and Accessibility ID locators in App with an example Hard
A. //android.widget.Button[@text='ADD TO CART' and @index='4']
B. (//android.widget.Button[@text='ADD TO CART'])[1]
C. //android.view.ViewGroup[.//android.widget.TextView[@text='Air Jordan 4']]//android.widget.Button[@text='ADD TO CART']
D. //android.widget.TextView[@text='Air Jordan 4']/following::android.widget.Button[1]

43 The inspector reports the resource ID com.shop.qa:id/cart, while the same app is installed under different package names in QA and staging. Which strategy best avoids embedding the environment-specific package?

Introduction to Id, Xpath and Accessibility ID locators in App with an example Hard
A. Use By.xpath("//*[@resource-id='cart']") because XPath ignores package names
B. Use By.id("cart") and let UiAutomator2 resolve the current application package
C. Use AppiumBy.accessibilityId("cart") because every ID is also a content description
D. Use By.className("cart") because class names are independent of application packages

44 A promotional popup may or may not appear after login. The test must dismiss every currently matching close button without failing when none exists. Which approach has the correct absence semantics?

How to handle Mobile popups and return list of matching elements on Android app Hard
A. Search the hierarchy repeatedly with findElement until an exception confirms that every popup has disappeared from the current and all future screens
B. Wait for exactly one close button and fail if the popup is absent
C. Call findElement, catch NoSuchElementException, and reuse the returned element
D. Call findElements, iterate over the returned list, and click displayed matches

45 An Android runtime permission dialog can display either While using the app or Allow depending on the OS version. Which solution is most maintainable when the permission interaction itself must remain under test?

How to handle Mobile popups and return list of matching elements on Android app Hard
A. Press the Android Back key and assume the requested permission was granted
B. Tap fixed screen coordinates where the allow button usually appears
C. Locate the permission controller's allow button using version-aware IDs and wait for a clickable match
D. Set autoGrantPermissions=true so the dialog is never exercised during the test

46 A prefilled quantity field must be changed from 10 to 2, and the test must ensure that the old value is not retained. Which interaction sequence is most reliable?

How to extract the text and enter the information on Mobile Apps with Appium Hard
A. Tap the field, press Android Back, and assign 2 through the element's class name
B. Wait until editable, call clear(), call sendKeys("2"), and verify the resulting field value
C. Read getText(), append 2, and send the combined string back to the field
D. Call sendKeys("2"), wait one second, and expect the control to replace 10 automatically

47 A form validates an email only after the input loses focus. sendKeys() enters the email correctly, but the validation label never appears. What should the test do next?

How to extract the text and enter the information on Mobile Apps with Appium Hard
A. Move focus by tapping the next control or invoke the keyboard action, then wait for validation
B. Re-enter the same email with sendKeys() so the field emits a second focus event
C. Restart the Appium server because focus-based validation cannot be automated on Android
D. Call getText() repeatedly on the email field until the label is automatically created

48 A shopping test depends on a cart left populated by an earlier test and fails when executed alone. Which redesign best improves reliability while preserving meaningful coverage?

Introduction to App features and test cases to automate Hard
A. Seed the required state through a controlled setup and make each test independently executable
B. Combine login, browsing, checkout, payment, order history, logout, and account deletion into one mandatory end-to-end test so no intermediate state can be missing
C. Prefix test names numerically so the framework always executes them in the intended order
D. Add a long implicit wait because the cart may be populated after the test starts

49 A country selector is implemented as a scrollable modal. Several visible elements partially match United, but the test requires exactly United Kingdom. Which approach minimizes selecting the wrong country?

Test Case in Filling the form details for shopping Hard
A. Search globally for elements containing United and click the first returned match
B. Scroll within the modal to an exact-text selector and click the resulting displayed element
C. Swipe the entire screen a fixed number of times and tap the last visible row
D. Enter United into the name field and assume the selector infers the country

50 After completing a shopping form, the Proceed button remains covered by the soft keyboard and an attempted click is intercepted. Which remedy best represents the user's intended flow?

Test Case in Filling the form details for shopping Hard
A. Use JavaScript to invoke the application's private submit method directly
B. Increase the implicit wait because the keyboard always disappears eventually
C. Tap fixed coordinates near the bottom edge without checking the visible element
D. Dismiss the keyboard, wait until Proceed is clickable, and then click it

51 A toast saying Please enter your name appears for less than two seconds after submitting an empty form. Which validation is most suitable with UiAutomator2?

Verifying toast messages for error validations Hard
A. Switch to a WebView context, execute JavaScript against the DOM, and wait for an HTML element whose CSS class represents an Android toast notification
B. Start an explicit wait immediately and locate //android.widget.Toast[@text='Please enter your name']
C. Sleep for five seconds and then search for a persistent TextView containing the message
D. Use findElements before submission and retain the list until the toast is displayed

52 A test checks a toast using contains(@text,'error'), but it passes for both Payment error and No error detected. Which change makes the assertion unambiguous?

Verifying toast messages for error validations Hard
A. Increase the implicit wait so the desired toast replaces the undesired toast
B. Match the complete expected toast text and assert it within a short explicit wait
C. Assert that the page source contains the word error after the toast disappears
D. Match only the android.widget.Toast class and ignore the returned message

53 Which UiAutomator expression most directly scrolls a scrollable Android container until the product text Jordan 6 Rings is brought into view?

Testcase: Scrolling in product list example with Appium Android scroll Hard
A. new UiScrollable(new UiSelector().text("Jordan 6 Rings")).scrollForward(0)
B. new UiSelector().className("Jordan 6 Rings").swipeIntoView(true)
C. new UiScrollable(new UiSelector().scrollable(true)).scrollIntoView(new UiSelector().text("Jordan 6 Rings"))
D. new UiSelector().scrollable(false).click(new UiSelector().text("Jordan 6 Rings"))

54 A custom product list does not expose scrollable=true, so the test uses repeated swipe gestures. How should the search terminate safely when the product is absent?

Testcase: Scrolling in product list example with Appium Android scroll Hard
A. Restart the application after each swipe to refresh the accessibility hierarchy
B. Continue swiping until findElement eventually returns the requested product
C. Stop after a bounded number of swipes or when the visible item signature no longer changes
D. Stop immediately after one swipe because custom lists cannot be searched reliably

55 A virtualized list recycles product-card elements during scrolling. Why should the test avoid storing all card WebElement references before scanning later pages?

Testcase: Dynamically selecting Product by scanning list based on text Hard
A. Recycled cards may invalidate stored references, so elements should be reacquired after each scroll
B. The references remain valid but force the application to disable list virtualization permanently
C. Stored elements automatically change their locator to the next visible product after scrolling
D. Appium permits only one WebElement reference per Android class at a time

56 Two products share the visible name Running Shoe but have different SKU values in their card descriptions. The requested SKU is RS-204. Which selection strategy is correct?

Testcase: Dynamically selecting Product by scanning list based on text Hard
A. Collect every add button globally and click the one whose list index equals 204
B. Click the first add button after finding any card whose text contains Running Shoe
C. Select the second visible product because duplicate names are always sorted by SKU
D. Identify the card containing both the exact name and SKU, then click its nested add button

57 A cart contains one item priced at $19.99 and two items priced at $5.50 each. Ignoring tax and shipping, what total and numeric strategy should the automated test use?

Testcase: Validating Total amount generated functionality Hard
A. $30.99, computed by comparing only raw formatted strings without parsing
B. $30.99, computed with decimal-safe arithmetic such as BigDecimal
C. $30.98, computed by truncating each floating-point operation
D. $31.00, computed by rounding every item price to an integer first

58 The UI shows prices using the locale-specific strings €1.234,50 and €10,25. What is the most reliable way to validate their generated total?

Testcase: Validating Total amount generated functionality Hard
A. Concatenate the two price strings and compare the result with the displayed total
B. Parse both values with the UI locale, sum decimal values, and compare normalized amounts
C. Replace commas with periods while leaving thousands separators unchanged
D. Remove every punctuation mark, parse integers, and divide the final result by one hundred

59 A cart total updates asynchronously after quantity changes. Which assertion design best distinguishes a correct recalculation from a stale value?

Testcase: Validating Total amount generated functionality Hard
A. Read the total immediately after tapping + and compare it with the previous total
B. Sleep for a fixed interval and assert only that the total field remains visible
C. Wait for any text change and accept the first value that differs from the old total
D. Compute the expected total, wait until the displayed amount equals it, and then assert

60 Several tests need a helper selectProduct(name) that scrolls and clicks the matching product. Which design best supports reuse and reliable failure reporting?

Code optimization with user defined functions Hard
A. Use a global product name, swipe indefinitely, and catch every exception without reporting it
B. Hard-code the desired product and return true regardless of whether the click succeeds
C. Cache the first page's product elements in a static field and reuse them after every scroll
D. Accept the product name, search with bounded scrolling, click within the matched card, and fail clearly if absent