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. XPath locator
B. Text locator
C. Class name locator
D. ID 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. Accessibility ID
B. Package name
C. Resource class
D. Screen size

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 app version
B. The screen brightness
C. The device battery
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. closeElements
B. findElements
C. findWindow
D. getDevice

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. Accept or dismiss it
B. Restart the computer
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. clear
B. getText
C. click
D. sendKeys

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. isDisplayed
B. getAttribute
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. Check app behavior
B. Design a new logo
C. Increase screen size
D. Install a keyboard

9 Which app feature is suitable for an Appium test?

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

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

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

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

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

12 What is a toast message in an Android application?

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

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. A new application
C. A larger text field
D. The expected error toast

14 Why is scrolling used in a product list test?

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

15 Which gesture moves the product list toward lower items?

Testcase: Scrolling in product list example with Appium Android scroll Easy
A. Rotate the device
B. Tap twice
C. Press back
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. Clear the application
B. Change device language
C. Use a fixed delay
D. Compare product text

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. Restart the emulator
C. Remove all products
D. Close the test runner

18 What does a total amount validation usually compare?

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

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

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

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

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

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.className("com.shop.app:id/cartButton")
B. AppiumBy.id("com.shop.app:id/cartButton")
C. AppiumBy.xpath("//*[@text='cartButton']")
D. AppiumBy.accessibilityId("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.id("Checkout")
B. AppiumBy.xpath("//*[@id='Checkout']")
C. AppiumBy.className("Checkout")
D. AppiumBy.accessibilityId("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 locating every element by screen coordinates
B. When a unique accessibility ID is available
C. When matching requires hierarchy or multiple attributes
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 navigate().back() before checking the popup
C. Call getPageSource and tap fixed coordinates
D. Call findElements and check whether the list is empty

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. The first invisible text element
B. An empty list of elements
C. A NoSuchElementException immediately
D. A list containing one null value

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 click() and then getText()
B. Call getText() and then clear()
C. Call clear() and then sendKeys("Alex")
D. Call submit() and then sendKeys("Alex")

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.getText()
C. priceElement.getSize()
D. priceElement.sendKeys()

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 status bar clock is visible
C. Verify the app icon color
D. Verify the device wallpaper remains unchanged

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. Measure the size of the application package
B. Submit valid details and verify order confirmation
C. Compile a utility class without warnings
D. Inspect a database table without opening the app

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 only the first visible field
B. Leave required fields empty intentionally
C. Populate every required field with valid data
D. Restart the app after each field

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. Open the dropdown, scroll to Argentina, and select it
B. Select the first country and rename it afterward
C. Type Argentina into the customer name field
D. Tap the dropdown repeatedly without locating an option

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.EditText
D. //android.widget.Toast

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

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

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 UiScrollable(new UiSelector().scrollable(true)).scrollIntoView(new UiSelector().text("Jordan 6 Rings"))
B. new UiScrollable().text("Jordan 6 Rings").sendKeys(true)
C. new UiSelector().scrollable(false).clickable("Jordan 6 Rings")
D. new UiSelector().resourceId("Jordan 6 Rings").scroll(false)

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. Find the matching title and tap the button within its card
B. Tap the first button returned from the entire page
C. Tap a fixed coordinate used by the previous product
D. Count all cards and always select the last 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.getSize().equals(targetName)
B. productName.isSelected() == false
C. productName.getText().isEmpty()
D. productName.getText().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. $200.00
B. $190.00
C. $210.00
D. $201.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. Parse only the digits before each decimal point
B. Remove formatting, parse decimal values, sum them, and compare
C. Join the price strings and compare their character count
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. addProductToCart(String productName)
B. addFirstProductToCart()
C. restartAppBeforeProduct()
D. storeProductScreenSize()

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. By.xpath("//android.widget.Button[1]")
B. By.xpath("//android.widget.Button[@text='Login']")
C. By.id("com.example:id/generated_42")
D. AppiumBy.accessibilityId("submit-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.TextView[@text='Air Jordan 4']/following::android.widget.Button[1]
B. //android.view.ViewGroup[.//android.widget.TextView[@text='Air Jordan 4']]//android.widget.Button[@text='ADD TO CART']
C. (//android.widget.Button[@text='ADD TO CART'])[1]
D. //android.widget.Button[@text='ADD TO CART' and @index='4']

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.id("cart") and let UiAutomator2 resolve the current application package
B. Use By.xpath("//*[@resource-id='cart']") because XPath ignores package names
C. Use By.className("cart") because class names are independent of application packages
D. Use AppiumBy.accessibilityId("cart") because every ID is also a content description

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. Call findElements, iterate over the returned list, and click displayed matches
C. Call findElement, catch NoSuchElementException, and reuse the returned element
D. Wait for exactly one close button and fail if the popup is absent

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. Locate the permission controller's allow button using version-aware IDs and wait for a clickable match
B. Tap fixed screen coordinates where the allow button usually appears
C. Press the Android Back key and assume the requested permission was granted
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. Call sendKeys("2"), wait one second, and expect the control to replace 10 automatically
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. Tap the field, press Android Back, and assign 2 through the element's class name

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. Restart the Appium server because focus-based validation cannot be automated on Android
B. Call getText() repeatedly on the email field until the label is automatically created
C. Move focus by tapping the next control or invoke the keyboard action, then wait for validation
D. Re-enter the same email with sendKeys() so the field emits a second focus event

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. Add a long implicit wait because the cart may be populated after the test starts
D. Prefix test names numerically so the framework always executes them in the intended order

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. Swipe the entire screen a fixed number of times and tap the last visible row
B. Enter United into the name field and assume the selector infers the country
C. Scroll within the modal to an exact-text selector and click the resulting displayed element
D. Search globally for elements containing United and click the first returned match

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. Dismiss the keyboard, wait until Proceed is clickable, and then click it
C. Increase the implicit wait because the keyboard always disappears eventually
D. Tap fixed coordinates near the bottom edge without checking the visible element

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. Start an explicit wait immediately and locate //android.widget.Toast[@text='Please enter your name']
B. Switch to a WebView context, execute JavaScript against the DOM, and wait for an HTML element whose CSS class represents an Android toast notification
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. Match only the android.widget.Toast class and ignore the returned message
D. Assert that the page source contains the word error after the toast disappears

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 UiSelector().className("Jordan 6 Rings").swipeIntoView(true)
B. new UiScrollable(new UiSelector().text("Jordan 6 Rings")).scrollForward(0)
C. new UiSelector().scrollable(false).click(new UiSelector().text("Jordan 6 Rings"))
D. new UiScrollable(new UiSelector().scrollable(true)).scrollIntoView(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. Stop after a bounded number of swipes or when the visible item signature no longer changes
B. Restart the application after each swipe to refresh the accessibility hierarchy
C. Continue swiping until findElement eventually returns the requested product
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. Stored elements automatically change their locator to the next visible product after scrolling
B. Appium permits only one WebElement reference per Android class at a time
C. The references remain valid but force the application to disable list virtualization permanently
D. Recycled cards may invalidate stored references, so elements should be reacquired after each scroll

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. Click the first add button after finding any card whose text contains Running Shoe
B. Collect every add button globally and click the one whose list index equals 204
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 with decimal-safe arithmetic such as BigDecimal
B. $30.99, computed by comparing only raw formatted strings without parsing
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. Replace commas with periods while leaving thousands separators unchanged
B. Concatenate the two price strings and compare the result with the displayed total
C. Remove every punctuation mark, parse integers, and divide the final result by one hundred
D. Parse both values with the UI locale, sum decimal values, and compare normalized amounts

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. Sleep for a fixed interval and assert only that the total field remains visible
B. Compute the expected total, wait until the displayed amount equals it, and then assert
C. Wait for any text change and accept the first value that differs from the old total
D. Read the total immediately after tapping + and compare it with the previous total

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. Accept the product name, search with bounded scrolling, click within the matched card, and fail clearly if absent
C. Hard-code the desired product and return true regardless of whether the click succeeds
D. Cache the first page's product elements in a static field and reuse them after every scroll