Question

Question 1 Given the following composite condition (a>=0 && b==3) || c>b Generate a...

Question 1

Given the following composite condition (a>=0 && b==3) || c>b

Generate a set of test cases (just the input values for a, b, and c) that you need to have 100% MC/DC coverage.

Question 2

Given the following fragment of code:

int tent=0, x=92, num; cout<<"Guess the number :"; cin>>num; while ((tent<5)&&(num!=x)) {

tent++; if (num>x)

cout<<"Smaller\n"; else

if (num

cout<<"Bigger\n"; else

cout<<”You won!\n” cout<<"Guess the number :"; cin>>num; }

(1) Build the corresponding control flow graph.

(2) Generate the test cases for reaching (if possible) 100% coverage with the statement

coverage criterion.

(3) Does the test suite created in (2) guarantee also 100% branch coverage? If not,

modify/augment your test suite in order to reach (if possible) 100% coverage with the branch coverage criterion.

(4) Which is the cyclomatic number?

(5) How many boundary paths you would need to cover to guarantee 100% coverage with the boundary/interior path coverage criterion? Are those paths coverable?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1.) Here we need 5 tests to fulfill 100% MC/DC coverage. Below are those cases.

a>=0 b==3 c>b Decision
TRUE FALSE TRUE TRUE
TRUE FALSE FALSE FALSE
TRUE TRUE TRUE
FALSE TRUE TRUE
FALSE FALSE FALSE
Add a comment
Know the answer?
Add Answer to:
Question 1 Given the following composite condition (a>=0 && b==3) || c>b Generate a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 3) What are the final values of a, b, c in the following code fragment (1.5...

    3) What are the final values of a, b, c in the following code fragment (1.5 point): int a = 6 , b = 127 , c; c = ( ++a ) + ( b -- ); Answer: 4) What are the final values of a, b, c in the following code fragment (1.5 point): int a = 6 , b = 127 , c; c = (a++) + ( -- b); Answer: 5) What is displayed by this poorly...

  • Consider the following code: 1. float foo (int a, int b, int c, int d, float...

    Consider the following code: 1. float foo (int a, int b, int c, int d, float e) { 2. float e; 3. if (a == 0) { 4. return 0; 5. } 6. int x = 0; 7. if ((a==b) || ((c == d) && bug(a) )) { 8. x=1; 9. } 10. e = 1/x; 11. return e; 12. } Function bug(a) should return a value of true when passed a value of a=1. Build: • a test suite...

  • For the following program P3 written in pseudo-code, given the test set T: T = {t1...

    For the following program P3 written in pseudo-code, given the test set T: T = {t1 = <‐5, 2>, t2 = <3, 1>, t3 = <9, 3>} a) What is the domain for statement coverage of P3? Note: do not include syntactical markers such as comments, {, }, else, begin, end. b) What is the statement coverage for T? c) What test cases should you add to T to provide 100% statement coverage? d) What is the domain for decision...

  • Project 1 - Wallet Following the class diagram shown below, create the class Wallet. A Wallet...

    Project 1 - Wallet Following the class diagram shown below, create the class Wallet. A Wallet represents a carrier of bills and coins. You use your wallet to pay for things, which reduces the balance held inside. When you visit an ATM, you can fill it back up with cash again. A sample driver for this class is shown below. You should probably make a more thorough driver to test your class better. I will have my own driver which...

  • 1. Please provide a C++ program which faithfully reads a list of non-negative integer scores, ultimately...

    1. Please provide a C++ program which faithfully reads a list of non-negative integer scores, ultimately terminating the list reading when the sentinel value (lets use -9999) is entered. The program should then correctly report the number of non-negative scores entered and the arithmetic mean (average) of those scores 2. Demonstrate your programs behavior in response to errors on input (that is, show that it faithfully rejects improper input such as alphabetic characters, decimal points, and commas). Here are some...

  • I've posted 3 classes after the instruction that were given at start You will implement and...

    I've posted 3 classes after the instruction that were given at start You will implement and test a PriorityQueue class, where the items of the priority queue are stored on a linked list. The material from Ch1 ~ 8 of the textbook can help you tremendously. You can get a lot of good information about implementing this assignment from chapter 8. There are couple notes about this assignment. 1. Using structure Node with a pointer point to Node structure to...

  • C++ CODE /* This is program project 2 on page 695. * Before you begin the...

    C++ CODE /* This is program project 2 on page 695. * Before you begin the project, please read the project description * on page 695 first. * * Author: Your Name * Version: Dates */ #include <iostream> #include <cmath> #include <cassert> using namespace std; class Fraction { public: // constructor Fraction(int a, int b); // generate a fraction which is a/b Fraction(int a); // generate a fraction which is a/1 Fraction(); // generate a fraction which is 0/1. i.e...

  • Write a C/C++ program that simulate a menu based binary number calculator. This calculate shall have the following three...

    Write a C/C++ program that simulate a menu based binary number calculator. This calculate shall have the following three functionalities: Covert a binary string to corresponding positive integers Convert a positive integer to its binary representation Add two binary numbers, both numbers are represented as a string of 0s and 1s To reduce student work load, a start file CSCIProjOneHandout.cpp is given. In this file, the structure of the program has been established. The students only need to implement the...

  • C++ CODE /* This is program project 2 on page 695. * Before you begin the...

    C++ CODE /* This is program project 2 on page 695. * Before you begin the project, please read the project description * on page 695 first. * * Author: Your Name * Version: Dates */ #include <iostream> #include <cmath> #include <cassert> using namespace std; class Fraction { public: // constructor Fraction(int a, int b); // generate a fraction which is a/b Fraction(int a); // generate a fraction which is a/1 Fraction(); // generate a fraction which is 0/1. i.e...

  • Module B: A state rand0%4; if (A state1) global time 6 Module C: private int C state parametersi,よ1;//acall with...

    Module B: A state rand0%4; if (A state1) global time 6 Module C: private int C state parametersi,よ1;//acall without defining parameterjis fine if (i9%2) C state 7: else C state- 100 return C state +randOA if((module) Crand0M) > 10) Module D: < "good"くくendl; cout 5. Coding with quality reqwst Provide brief analyses justifications of the time complexities for all questions (a) (8 pts) For a sorted array A of n different elements ranging from I to n. Suppose one element...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT