Relationship between integration testing and unit testing

Assignment Help Basic Computer Science
Reference no: EM132174583

PART 1: Short Answers

1. Briefly discuss the relationship between integration testing, unit testing and system test.

2. Code Analysis: int Calculate (int x, int y) {
int total=0; if (x>30) {
total=(x*40+y*50)*.95;
}
else
total=x+y;

for (int i=0;i<Y;i++) { total+=y*5;
}
return total;
}

a. Draw the control flow graph for this code.

b. What are the test cases to achieve statement coverage for this code?

c. What additional test cases (if any) are required for branch coverage?

d. Is it possible to test all paths through this module?

3. A car insurance company "Simplicity" provides insurance cover for motor vehicles. When a customer applies for a quote on insurance, the agent requests the following information:
1. Vehicle year of registration and make (e.g. Toyota, 2001)
2. Age of the driver
The system outputs a quote for insurance.

Use EP to do testing analysis and find the necessary test cases

PART 2: Long answers

1. Testing a Stack class

Here is Java code for a simple Stack class provided:

class Stack
{
int number; // number of items in the stack
int limit; // limit on number of items in the stack int increment; // incremental number to be added int array[ ]; // stack contents

Stack(int limit)
{
this.limit = limit; // set instance variable to argument value increment = limit; // use increment for limit
array = new int[limit]; // create array
number = 0; // stack contains no items initially
}

void ensure() // make sure push is possible
{
if( number >= limit )
{
int newArray[] = new int[limit+increment]; // create new array for( int i = 0; i < limit; i++ )
{
newArray[i] = array[i]; // copy elements in stack
}
array = newArray; // replace array with new one limit += increment; // augment the limit
}
}

void push(int x)
{
ensure();
array[number++] = x; // put element at position number and increment
}

int pop()
{
return array[--number]; // decrement number and take element
}

boolean empty()
{
return number == 0; // see if number is 0
}

public static void main(String arg[])
{
int limit = new Integer(arg[0]).intValue(); Stack s = new stack(limit);
for( int i = 0; i < limit; i++ )
{
s.push(i);
}
while( !s.empty() )
{
System.out.println(s.pop());
}
}
}

How would you test this class?
Hint: I am looking for as complete and detailed an answer as you can give in the time available. I am looking for both a discussion of overall strategies (how will you approach the task) as well as a small number of specific test cases.

3. OO programming might provide an easy way for testing. Please explain it with examples.

PART 3: Multiple Choice

1. Black-box Testing attempts to find errors in which of the following categories
a. Incorrect or missing functions
b. Interface errors
c. Performance errors
d. All of the above

2. Condition coverage that executes possible combinations of condition outcomes of each decision is called as .
a. Black box Testing
b. White box Testing
c. Integration Testing
d. Acceptance Testing

3. Testing all possible paths through a module is:
a. The strongest whitebox coverage criteria
b. The strongest blackbox coverage criteria
c. Not possible to achieve if the module has loops
d. Both a and c are correct

4. Which is NOT true - The black box tester:
a. should be able to understand a functional specification or requirements document
b. should be able to understand the source code
c. is highly motivated to find faults
d. is creative to find the system's weaknesses

5. Unreachable code would best be found using: code inspections
code review
a coverage tool
a static analysis tool

6. Statement Coverage will not check for the following:
a) Missing Statements
b) Unused Branches
c) Dead Cod
d) Unused Statement

7. Verification is:
a) Checking that we are building the right system
b) Checking that we are building the system right
c) Making sure that it is what the user really wants
d) Performed by an independent test team

8. Which testing phase tests individual software modules combined together as a group?
a) Module testing
b) Integration testing
c) White Box testing
d) Software testing

9. A shopping website gives discount based on prices of total purchased items. Suppose customer purchases are below 2000 rs. then no discount,for purchases till 20000, it gives 10% discount and above 20000 it gives 15% discount. Which of the following sets of values lie in 3 different equivalence classes?

a) 1800,2000,8000
b) 2001,10000,20002
c) 1800, 2003,58,000
d) 100,1800,20001

10. A theme park charges entry fee based on age group. For children below 3 it charges nothing, for 3-10 it charges 500/-, for 10-18 it charges 800/-,then for 18-60 it charges 1000 and above 60 it charges 500 again. Using boundary value analysis, what will be the values to test if person pays 500 rs entry fee?

a) 0,2,3
b) 2,3,10,11,59,60,100,101
c) 2,3,10,11,59,60,100,101
d) 59,60,100,101

Reference no: EM132174583

Questions Cloud

Defining how credit markets can be inefficient : Take the example of a poor individual who does not have any collateral, and therefore cannot obtain a loan from a standard commercial bank.
Conflict handling styles represents different combinations : The model of interpersonal conflict handling styles represents different combinations of.
Propose some ways to limit or remove treat : Discuss why MARSA presents a major public health issue. Propose some ways to limit or remove this treat.
In which of the two countries should she invest : An entrepreneur has an idea for a profitable project, but she is unsure about where to carry it out. She could implement it in Russia
Relationship between integration testing and unit testing : Briefly discuss the relationship between integration testing, unit testing and system test - What test cases (if any) are required for branch coverage
Initiating structure is not likely to be effective : Initiating structure is not likely to be effective under which of the following circumstances? All of the following are propositions of Theory X except:
What does the simple numerical exercise reveal : Suppose you live in a low-income community, and that the government wants to help you by granting you the right to borrow $120 at a subsidized annual interest.
Which of the two projects is more socially efficient : A bank is subsidized by the government. For each $1,000 loan it extends, it receives a subsidy of $200. The bank's manager is considering extending a $1,000.
Characteristic of transactional leaders : Which of the following behaviors tend to be characteristic of transactional leaders?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd