July 27, 2024

Software Testing

Software Testing
Share :

Software Testing Question and Answers


( Suggestion :  keep refreshing the page for updated content & Search Questions Using Find )


Q1. The program given below is a C Program to find the Largest Number among Three Numbers

#include <stdio.h>
int main() {
double n1, n2, n3;
printf(“Enter three different numbers: “);
scanf(“%lf %lf %lf”, &n1, &n2, &n3);
// if n1 is greater than both n2 ard n3, n1 is the largest
if (n1 >= n2 && n1 >= n3)
printf(“%.2f is the largest number.”, n1);
// if n2 is greater than both n1 and n3, n2 is the largest
if (n2 >= n1 && n2 >= n3)
printf(“%.2f is the largest number.”, n2);
// if n3 is greater than both n1 Land n2, n3 is the largest
if (n3 >= n1 && n3 >= n2)
printf(“%.2f is the largest number.”, n3);
return 0;
}
For the above program
(a) Convert the C Code to Program Graph
(b). For the Program Graph obtained in (a), generate the DD table
(c). For the DD Table generated from
(b), obtain DD Path Graph
(d). For the DD Path Graph obtained from (c), compute V(G)
(e). For the V(G) computed from (d), identify and list the Basis Paths

Answer.
Creating a program graph, DD table, DD path graph, and computing cyclomatic complexity (V(G)) manually can be a lengthy process, especially in a text-based format. However, I can guide you through the steps and provide a simplified example for the given C program.

(a) Convert the C Code to Program Graph

A program graph represents the flow of control in a program. It typically consists of nodes (representing statements or blocks) and edges (representing the flow of control). Below is a simplified program graph for the given C code:

START
|
V
Input (Read n1, n2, n3)
|
V
if (n1 >= n2 && n1 >= n3)
| \
V V
Print n1 is largest if (n2 >= n1 && n2 >= n3)
| \
V V
END Print n2 is largest
|
V
END

(b) Generate the DD Table

The Decision Table (DD Table) is created by identifying decision points in the program. In this case, the decision points are the conditions inside the if statements.

| Condition            | Decision 1 | Decision 2 | Decision 3 |
|----------------------|------------|------------|------------|
| n1 >= n2 && n1 >= n3 | T          |            |            |
| n2 >= n1 && n2 >= n3 |            | T          |            |
| n3 >= n1 && n3 >= n2 |            |            | T          |

(c) Obtain DD Path Graph

The DD Path Graph shows the possible paths through the decision table. For each combination of true/false values, you trace the path through the program graph.

Path 1: T, F, F

Path 2: F, T, F

Path 3: F, F, T

(d) Compute V(G)

The Cyclomatic Complexity (V(G)) is calculated using the formula: , where

  • E is the number of edges in the program graph,
  • N is the number of nodes in the program graph, and
  • P is the number of connected components.

For our example:

  • E = 8
  • N = 7
  • P = 1

Therefore,

(e) Identify and List Basis Paths

Basis paths are independent paths through the program graph that ensure full statement coverage. For the given example, the basis paths are the three paths identified in (c):

  1. T, F, F
  2. F, T, F
  3. F, F, T

These paths represent the basis set for testing.

Please note that this is a simplified example, and in a real-world scenario, the program might have more complex structures and conditions.


Q2. Health Department program has given guidelines for maintaining Blood count to create awareness among people in the public interest trey hirve published these border line vanous test values for the three different types of blood count as follows
Hemoglobin 11-16
RBC 3-6
WBC 4-11
a. Derive the total numbers of test cases that will be needed for BVA, Robust BVA, Worst Case BVA and Robust Worst case BVA.
b. Write Normal BVA test cases. 

Answer.

Boundary Value Analysis (BVA) is a software testing technique in which test cases are designed based on the boundary values of the input domain. The goal is to check if the system handles values at the boundaries properly. Here, the given guidelines for blood count levels are as follows:

Hemoglobin: 11-16
RBC: 3-6
WBC: 4-11

a. Derive the total numbers of test cases for BVA, Robust BVA, Worst Case BVA, and Robust Worst Case BVA:

1. Boundary Value Analysis (BVA):
– For each parameter, select values on the boundaries and just inside the boundaries.
– Test cases:
– Hemoglobin: 10, 11, 16, 17
– RBC: 2, 3, 6, 7
– WBC: 3, 4, 11, 12
– Total: 4 + 4 + 4 = 12 test cases

2. Robust Boundary Value Analysis (Robust BVA):
– Similar to BVA, but also test just outside the boundaries.
– Test cases:
– Hemoglobin: 9, 10, 11, 16, 17, 18
– RBC: 2, 3, 6, 7, 8
– WBC: 3, 4, 11, 12, 13
– Total: 6 + 5 + 6 = 17 test cases

3. Worst Case Boundary Value Analysis (Worst Case BVA):
– Test cases:
– Hemoglobin: 10, 16
– RBC: 3, 6
– WBC: 4, 11
– Total: 2 + 2 + 2 = 6 test cases

4. Robust Worst Case Boundary Value Analysis (Robust Worst Case BVA):
– Test cases:
– Hemoglobin: 9, 10, 16, 17, 18
– RBC: 2, 3, 6, 7, 8
– WBC: 3, 4, 11, 12, 13
– Total: 6 + 5 + 6 = 17 test cases

b. Write Normal BVA test cases:

1. Hemoglobin:
– Test just below the lower limit: 10
– Test on the lower limit: 11
– Test within the range: 13
– Test on the upper limit: 16
– Test just above the upper limit: 17

2. RBC:
– Test just below the lower limit: 2
– Test on the lower limit: 3
– Test within the range: 4
– Test on the upper limit: 6
– Test just above the upper limit: 7

3. WBC:
– Test just below the lower limit: 3
– Test on the lower limit: 4
– Test within the range: 7
– Test on the upper limit: 11
– Test just above the upper limit: 12


Q3. A software company was developing a shopping website for a client. The Software company prepared a software specification document and allocated developers to develop the following modules. User login, product catalog, shopping cart, billing and shipping. Developers coded as per the design document and wrote extensive unit tests to test their modules. Coding was followed by integration testing the various modules. Everything looked great. Then system testing was performed, which resulted in the following bugs:

1. The product search results did not include sponsored products.
2. The shopping cart was cleared every time a user logged in
3. Billing amount did not apply the latest discount offers. .
4. Shipping charges were calculated for the user’s primary address and not the delivery address of that specific order.
5. The application did not work as expected in landscape mode in mobile devices.

Even though the software components worked individually, they did not work as expected when tested from an end user’s perspective. System testing exposed these defects.
a. What are the types of software testing that are needed for this type of product?
b. Mention the differences between use cases and test cases? 

Answer.

a. Types of software testing needed for this type of product:

1. Unit Testing:
– Purpose: To test each module (User login, product catalog, shopping cart, billing, and shipping) individually to ensure that they function as intended.
– In this case, unit testing was done by developers, and extensive unit tests were written for each module.

2. Integration Testing:
– Purpose: To test the interaction between different modules and ensure that they work together as a cohesive system.
– In this case, integration testing was performed after coding to identify any issues in the interaction between modules.

3. System Testing:
– Purpose: To test the entire system as a whole to ensure that it meets the specified requirements and behaves correctly from an end user’s perspective.
– In this case, system testing revealed several defects that were not apparent during unit or integration testing.

4. User Acceptance Testing (UAT):
– Purpose: To ensure that the software meets the user’s expectations and is ready for deployment.
– UAT could have identified issues such as the product search not including sponsored products or the shopping cart being cleared upon user login.

5. Compatibility Testing:
– Purpose: To ensure that the application works correctly on different devices and browsers.
– The issue with the application not working as expected in landscape mode on mobile devices could have been identified through compatibility testing.

b. Differences between use cases and test cases:

– Use Cases:
– Definition: Use cases describe interactions between an external actor (user or system) and the system to achieve a specific goal.
– Focus: They focus on the functional aspects of the system, describing the steps a user or system takes to accomplish a task.
– Detail: Use cases are typically more high-level and provide a broader understanding of system behavior.

– Test Cases:
– Definition: Test cases are specific conditions or inputs, along with the expected results, used to determine whether a system or component is working correctly.
– Focus: They focus on verifying that the system behaves as expected under various conditions and scenarios.
– Detail: Test cases are detailed and provide step-by-step instructions for executing a particular test scenario, including inputs, expected outcomes, and the order of execution.

In summary, use cases provide a broader view of system functionality from a user’s perspective, while test cases are detailed instructions used to validate specific aspects of the system’s behavior.


Q4. Software testing as a phase only cannot assure qualitative product Right balance of quality phases interacting with testing plane ce se quality product
a. Comment and explain your views with proper justification
b. Software quality is a multidimensional term
c. List and explain its static dimensions.
d. Why regression testing is important in agile projects?

Answer.

a. Comment and Explanation:
It’s true that relying solely on software testing as a phase may not guarantee a qualitative product. While testing is a crucial part of ensuring software quality, a holistic approach to quality involves various phases throughout the software development life cycle. These phases include requirements gathering, design, coding, testing, deployment, and maintenance.

Each phase contributes to the overall quality of the product. For example, if there are issues with the requirements or design phase, even the most comprehensive testing may not catch all the defects. Therefore, a balanced and integrated approach that involves quality considerations in every phase is necessary.

Justification: A defect found during testing is often more costly to fix than if it were identified in the earlier phases of development. By integrating quality into all stages, the development team can prevent defects from occurring in the first place, leading to a more robust and reliable product.

b. Software Quality is a Multidimensional Term:
Software quality is indeed a multidimensional term, encompassing various aspects that collectively contribute to the overall excellence of a software product. These dimensions include:

– Functional Suitability: The extent to which the software meets the specified functional requirements.
– Reliability: The ability of the software to perform consistently under different conditions.
– Usability: The ease with which users can interact with the software.
– Efficiency: The performance of the software in terms of resource utilization.
– Maintainability: The ease with which the software can be modified or enhanced.
– Portability: The ability of the software to operate in different environments.

Justification: Considering these dimensions ensures that the software not only works correctly but also meets user expectations, performs well, is easy to use, and can adapt to changing requirements.

c. Static Dimensions of Software Quality:
Static dimensions of software quality refer to aspects that can be assessed without executing the software. These include:

– Requirements: The clarity, completeness, and consistency of the specified requirements.
– Design: The quality and effectiveness of the software design in meeting requirements.
– Code: The readability, maintainability, and adherence to coding standards.
– Documentation: The completeness and accuracy of documentation accompanying the software.

Justification: Addressing these static dimensions ensures that the foundation of the software is strong, making it easier to identify and rectify issues in subsequent phases.

d. Importance of Regression Testing in Agile Projects:
In agile projects, where development is iterative and changes are frequent, regression testing is crucial for several reasons:

– Detecting Regressions: Agile development involves frequent code changes. Regression testing ensures that new changes do not introduce unintended side effects or regressions in existing functionality.

– Maintaining Quality: Continuous integration and continuous deployment in agile require constant testing to maintain the overall quality of the product as it evolves.

– Quick Feedback: Agile projects emphasize quick feedback loops. Regression testing allows the team to quickly identify issues and address them before they escalate.

– Facilitating Change: Agile development embraces changes in requirements. Regression testing provides confidence that existing features still work as expected after incorporating changes.

Justification: Without regression testing, the risk of introducing defects during the rapid development and changes inherent in agile projects increases, potentially compromising the quality of the software.


Q5. To foster the nation’s development, the government plans various development initiatives, including road construction and bridge building Owing to economic constraints, some projects are outsourced to the private sector, with funding often sourced from international institutions like the World Bank. To repay loans from these financial backers, a predetermined fee is collected from vehicles using toll roads. The collected amounts contingent upon predefined tariffs
A charge of Rs 50 applies to heavy vehicles.
Buses incur a fee of Rs 40.
Cars are charged Rs 25.

a. Draw a limited entry decision table for the toll road where the vehicle has to pay once for crossing the toll 3 times.

In a democratic nation, every citizen possesses the fundamental right to vote in elections to select their leaders. The Election Commission sets the election date and invites nominations within a specified timeframe. These nominations must be submitted to the respective regional election officer, who is responsible for reviewing and either accepting or rejecting candidates’ nominations based on predefined rules Once the election officers announce the eligible candidates, the candidates embark on public canvassing efforts. On Election Day, multiple polling booths are set up with stringent security measures in place. Voters can cast their ballots for their preferred candidates by selecting the corresponding symbol on the voting machine Following the conclusion of voting, the election officer tallies the votes recorded in the region’s voting machines Subsequently, the winning candidates are awarded certificates in recognition of their victory.

b. Draw a state chart diagram for the above scenario

c. Is domain knowledge required to test a mobile application that involves legal terms? Please state “Yes” or “No” and provide your justification.

Answer.

a. Limited Entry Decision Table for Toll Road:

Conditions Actions
Vehicle Type Toll Amount
Heavy Vehicle Rs 50 x 3 = Rs 150
Bus Rs 40 x 3 = Rs 120
Car Rs 25 x 3 = Rs 75

b. State Chart Diagram for Election Process:

The state chart diagram for the election process could have various states and transitions. Here is a simplified representation:

Explanation:

– State 1: Nominations Open
– Transition to State 2: Nominations Closed

– State 2: Candidate Review
– Transition to State 3: Candidates Accepted
– Transition to State 4: Candidates Rejected

– State 3: Public Canvassing
– Transition to State 5: Election Date Set

– State 4: Election Date Set
– Transition to State 6: Voting Day

– State 5: Voting Day
– Transition to State 7: Voting Concluded

– State 6: Vote Tallying
– Transition to State 8: Results Announced

– State 7: Results Announced
– End State

c. Yes.

Justification: Testing a mobile application that involves legal terms requires domain knowledge because understanding legal terms is crucial for ensuring that the application complies with relevant laws and regulations. Testers need to verify that the application accurately interprets and implements legal terms, and that it provides information to users in a clear and legally sound manner. Without domain knowledge, testers may overlook critical legal considerations, potentially leading to non-compliance and legal issues for the application and its users.


Q6. Venkat and Vinod are proficient in Java and are responsible for developing Java programs. Viswa specializes in SQL and focuses on data-related tasks. Amudha is responsible for product testing and issue identification. Occasionally, Both Venkat and Vinod also reviews and rectifies issues in their programs. Suddenly, Shankar introduces an external expert, Mr Ganesh, to guide the team in optimizing the product. Naren checks the product, provides feedback, and monitors its progress. Suren, an end user, employs his own device to perform real-time checks and offer immediate feedback.
a. Identify the roles performed by each professional.
b. What is the activity performed by Vinod?
C. What is the activity performed by Ganesh? [1 mark] d. What is the activity performed by Suren?

Answer.

a. The roles performed by each professional

  • Venkat and Vinod: Java development, occasional issue reviews and rectification
  • Viswa: SQL and data-related tasks
  • Amudha: Product testing and issue identification
  • Shankar: Introduces external expert (Mr. Ganesh)
  • Mr. Ganesh: External expert guiding the team in optimizing the product
  • Naren: Checks the product, provides feedback, and monitors progress
  • Suren: Performs real-time checks and offers immediate feedback using his own device

b. Vinod performs Java development and occasionally reviews and rectifies issues in the programs.

c. Ganesh guides the team in optimizing the product.

d. Suren performs real-time checks and offers immediate feedback using his own device.


For More Updates Join Our Channels :