Search test library by skills or roles
⌘ K

Adaface Sample Program Testing Questions

Here are some sample Program Testing questions from our premium questions library (10273 non-googleable questions).

Skills

🧐 Question

Medium

Algorithm and Testcase
Unreachable Code
Designing Testcases
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:
 image
Here is the code the developers wrote to test the program when a customer has 13 credits and store offer is 0:
 image
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
Data flow analysis
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:
 image
🧐 Question🔧 Skill

Medium

Algorithm and Testcase
Unreachable Code
Designing Testcases
3 mins
Program Testing
Solve

Medium

Variables of interest
Data flow analysis
2 mins
Program Testing
Solve
🧐 Question🔧 Skill💪 Difficulty⌛ Time
Algorithm and Testcase
Unreachable Code
Designing Testcases
Program Testing
Medium3 mins
Solve
Variables of interest
Data flow analysis
Program Testing
Medium2 mins
Solve

Adaface questions are trusted by enterprises globally

Amazon Morgan Stanley Vodafone United Nations HCL PayPal Bosch WeWork Optimum Solutions Deloitte Microsoft NCS Doubtnut Sokrati J&T Express Capegemini

We evaluated several of their competitors and found Adaface to be the most compelling. Great default library of questions that are designed to test for fit rather than memorization of algorithms.


Swayam Narain, CTO, Affable

hashtag image heart icon Swayam
Join 1200+ companies in 75+ countries.
Try the most candidate friendly skills assessment tool today.
Ready to streamline your recruitment efforts with Adaface?
Ready to streamline your recruitment efforts with Adaface?
Chat with us
40 min tests.
No trick questions.
Accurate shortlisting.
Ada
Ada
● Online
Previous
Score: NA
Next
✖️