| Easy Commands | 2 mins Shell Scripting | Solve |
Which of the following unix commands change the case of first three lines of file “classified” from lowercase to uppercase
|
| Easy Expressions | 2 mins Shell Scripting | Solve |
What does this shell script output?
|
| Easy Loops | 2 mins Shell Scripting | Solve |
What are fourth and sixth lines output by this script:
|
| Medium Algorithm and Testcase | 3 mins Program Testing | Solve |
Review the following algorithm to calculate the final bill in a store:
Algorithm:
1. Each purchase has three amounts - base, special and extra
2. On the base amount - If there is a discount offer going on in the store, the discount is applied
3. There are no discounts on the special amount
4. On the extra amount - customer is offered 19% discount if accrued credits are equal to or more than 25 or 10% if the accrued credits are equal to or more than 13. If the accrued credits are lesser than 13, no discount on the extra amount is offered. In case there is a discount offer going on in the store, the discount on extra amount calculated based on credits cannot be lesser than the discount offer.
Here is the code written by the developers for this algorithm:
Here is the code the developers wrote to test the program when a customer has 13 credits and store offer is 0:
Pick the correct statements:
A: The code works correctly as expected without any defect
B: The program has unreachable code and generates faulty output when credits are ≥ 25
C: The testcase is written correctly and tests the test case as expected
D: The testcase need to be modified to account for imprecise rounding of floating numbers. Ex: (price == 12900.00) can be replaced with ((price - 12900.00) < 0.01)
E: The testcase need to be modified to account for imprecise rounding of floating numbers. Ex: (price == 12900.00) can be replaced with (abs(price - 12900.00) < 0.01)
|
| Medium Variables of interest | 2 mins Program Testing | Solve |
Adaface testing team does data flow analysis on the programs written by the development team. The testing team follows the following marking schema for the variables in a program:
Variables of interest in a code (possible states):
- d: variable is assigned a value
- r: value of variable is read
- u: variable has no defined value
Variables of interest in a code (marking schema):
- ur: undefined value of a variable is read on a program path r
- du: variable is assigned a value that becomes undefined/ invalid without having been used in the meantime
- dd: variable receives a value for the second time and the first value had not been used
Review the following program and pick the correct marking of the variables:
|
| Medium AJAX Request Completion Handling | 3 mins Selenium | Solve |
Suppose you are testing a web application with Selenium, where a button click (id="sendRequest") sends an AJAX request to fetch user data. The data, once retrieved, is displayed in a div with id="userData". This div is already present in the HTML with empty text. You need to ensure that the AJAX request is completed and the data is loaded before proceeding. (You can assume that the AJAX request will always succeed.
Consider the following pseudo JavaScript code which is used in the web application:
Given the above code, which of the following Python Selenium code snippets should be used to correctly wait for the AJAX request to complete and the userData to be loaded?
|
| Medium Handling Dynamic Elements | 2 mins Selenium | Solve |
You are automating a test for a webpage that contains multiple iframes. One of these iframes contains a button with a dynamic ID that always contains the substring "btn". Upon clicking this button, a text box appears within the same iframe, having a dynamic ID containing the substring "txtBox". You have to input text into this text box. The correct iframe does not have any unique identifiable attribute.
Below is the simplified pseudo code to illustrate your initial setup:
How should you modify your code to perform these operations efficiently, ensuring reliable element location and interaction among multiple iframes?
|
| Medium Handling Mouse Actions | 3 mins Selenium | Solve |
You are automating a test case where a user has to hover over an image, causing a tooltip to appear. After the tooltip appears, the user has to right-click on the tooltip to see a context menu. You have to validate that the context menu appears correctly. The tooltip has an ID of tooltip and the context menu has an ID of contextMenu.
Given the below pseudo code for the page:
Which of the following Selenium Python code snippets should be used to perform the above-described actions and validations?
|
| Easy Handling Multiple Windows | 3 mins Selenium | Solve |
You are working with Selenium to automate a test case where clicking a button on a webpage (http://example.com) opens a new window. You have to perform operations in the new window and then return to the original window. Below is a simplified version of your initial code:
After clicking the button, a new window opens, and you need to input text into a text box in the new window with id="textBox". Afterwards, you need to close this new window and click another button in the original window with id="originalWindowButton".
How should you modify your code to handle the multiple windows and perform the necessary operations?
|
| Medium Page Object Class | 3 mins Selenium | Solve |
Our frontend developer for bananas.com created this HTML login form. Which function should they use to implement a method of a Page Object Class for the login form?
|
| Medium Database testcase | 2 mins Testing | Solve |
Adaface is developing a new database system called “Helen”. The tester at Adaface developed the following testcase for regression testing:
1. Open Helen
2. Open “Students” database
3. Enter data for “Sid”
4. Set checkpoint
5. Store “Sid” data in “Students”
6. Restart Helen
7. Read “Sid” data from “Students”
8. Compare checkpoint with the contents
When the tester ran the testcase the first time, it worked as expected. Pick the correct statements:
A: When the test case is ran the second time, the data entry for “Sid” already exists in the database.
B: When the test case is ran the second time, it performs exactly as it did the first time
C: The testcase is a good example for regression testing “Helen”
D: The testcase is not a good example for regression testing “Helen” since the system behaves differently when the testcase is ran the second time
|
| Medium Decision Table | 3 mins Testing | Solve |
Check the following decision table:
What are the expected actions for following testcases?
I: Joey's age is 22. He is a smoker residing in India
II: Jennifer's age is 62. She is a non-smoker not residing in India
A) I - Insure, 10% discount. II - Insure, no discount
B) I - Don't insure. II - Don't insure
C) I - Insure, no discount. II - Don't insure
D) I - Insure, no discount. II - Insure, 10% discount
|
| Easy Cart Checkout | 2 mins Testing | Solve |
Review the following incident report written QA team of LWB, Little White Book (an e-commerce app):
1. Place any items in the cart (Say “Nike FST Men”).
2. Place any other (different) item in the shopping cart (Say “Nike Air Max”).
3. Remove “Nike FST Men” from the shopping cart, but leave “Nike Air Max” in the cart.
4. Click on “Check out” button.
5. Expect the app to display the check out screen, instead ‘No items in the shopping cart. Click continue to go back to shopping.’ error message is shown as a popup.
6. Click “Continue”.
7. Expect the app to go to shopping screen to add/remove items from the cart. Instead the app crashes.
8. The error in steps 5 and 7 occurred in every attempt of 5 attempts (1 2 3 4 and 6).
Which of the following information is missing from the incident report?
|
| Easy Registration Queue | 30 mins Coding | Solve |
We want to register students for the next semester. All students have a receipt which shows the amount pending for the previous semester. A positive amount (or zero) represents that the student has paid extra fees, and a negative amount represents that they have pending fees to be paid. The students are in a queue for the registration. We want to arrange the students in a way such that the students who have a positive amount on the receipt get registered first as compared to the students who have a negative amount. We are given a queue in the form of an array containing the pending amount.
For example, if the initial queue is [20, 70, -40, 30, -10], then the final queue will be [20, 70, 30, -40, -10]. Note that the sequence of students should not be changed while arranging them unless required to meet the condition.
⚠️⚠️⚠️ Note:
- The first line of the input is the length of the array. The second line contains all the elements of the array.
- The input is already parsed into an array of "strings" and passed to a function. You will need to convert string to integer/number type inside the function.
- You need to "print" the final result (not return it) to pass the test cases.
For the example discussed above, the input will be:
5
20 70 -40 30 -10
Your code needs to print the following to the standard output:
20 70 30 -40 -10
|
| Medium Visitors Count | 30 mins Coding | Solve |
A manager hires a staff member to keep a record of the number of men, women, and children visiting the museum daily. The staff will note W if any women visit, M for men, and C for children. You need to write code that takes the string that represents the visits and prints the count of men, woman and children. The sequencing should be in decreasing order.
Example:
Input:
WWMMWWCCC
Expected Output:
4W3C2M
Explanation:
‘W’ has the highest count, then ‘C’, then ‘M’.
⚠️⚠️⚠️ Note:
- The input is already parsed and passed to a function.
- You need to "print" the final result (not return it) to pass the test cases.
- If the input is- “MMW”, then the expected output is "2M1W" since there is no ‘C’.
- If any of them have the same count, the output should follow this order - M, W, C.
|