what is the maximum number of paths through the graph and

Post New Homework

Question 1
The following program will display an integral solution to the quadratic equation ax2+bx+c for integral values of a,b, and c, where a,c fall between 0 and 10, while b falls between 1 and 1000.
        read(a,b,c);
        if (a != 0) {
            d = b * b - 4*a*c;
            if (d <0)
                x = 0;
            else
                x=(-b+(int)sqrt(d))/(2*a);
        }
        else {
            x = -c/b;
        }
        if (a*x*x+b*x+c == 0)
            printf("%d is an integral solution",x);
        else
            printf("There is no integral solution");

1. Identify all parameters and environment variables. (5 marks)

2. One major characteristic relates to the discriminant(variable d). Write down a category and an accompanying partition for the discriminant.

3. Another major characteristic relates to how many roots are real. Write down a category and an accompanying partition for number of real roots.

4. Another major characteristic relates to how many roots are integer. Write down a category and an accompanying partition for number of integer roots.

2. Given the following fragment of code, how many tests are required for 100% decision coverage?

if width > length

   thenbiggest_dimension = width

     if height > width

             thenbiggest_dimension = height

     end_if

elsebiggest_dimension = length  

            if height > length 

                thenbiggest_dimension = height

          end_if

end_if

3.  Given the following code, which statement is true about the minimum number of test cases required for full statement and branch coverage? (10 marks)

 

     Read p

 

     Read q

 

     IF p+q> 100

 

          THEN Print "Large"

 

ENDIF

 

    IF p > 50

 

          THEN Print "p Large"

 

    ENDIF

4.  You have designed test cases to provide 100% statement and 100% decision coverage for the following fragment of code. (10 marks)

if width > length then biggest_dimension = width

else biggest_dimension = length

end_if

The following has been added to the bottom of the code fragment above. print "Biggest dimension is " &biggest_dimensionprint "Width: " & width print "Length: " & length How many more test cases are required?

Title: Path & Path Production, Syntax testing

Path & Path productions

1. Take the following flow graph and use the procedure in chapter 8 to derive an equivalent regular expression. Show all intermediate graphs (to ensure that you follow the procedure, rather than just guessing the regular expression). (20)

1147_Maximum number of paths through the graph.png

2. What is the maximum number of paths through the graph?

3. What is the approximate minimum number of paths through the graph?

4. If in the above graph, a, b, c and g contain construct operations, and d, h and l contain destruct operations. All others do not contain any construct or destruct operations.

  • Can there be more Ds than Cs?
  • Can there be more Cs than Ds?
  • What's the problem with the design?
Post New Homework
Captcha

Looking tutor’s service for getting help in UK studies or college assignments? Order Now