Reference no: EM13722055
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)
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?
The cleavage site is between the c and atgg
: BtsCI is a restriction enzyme that recognizes and cuts at the following site CCATCCC?ATGG Would this digest produce a blunt or sticky end? The cleavage site is between the C and ATGG as shown about with an insert symbol indicating where it ..
|
After-tax cost of debt problem
: The Heuser Company's currently outstanding bonds have a 9% coupon and a 14% yield to maturity. Heuser believes it could issue new bonds at par that would provide a similar yield to maturity. If its marginal tax rate is 40%, what is Heuser's after-tax..
|
What is the capital gains yield
: The Toy Chest pays an annual dividend of $4.80 per share and sells for $93.20 a share based on a market rate of return of 15 percent. What is the capital gains yield?
|
What is the weighted average cost of capital
: Debreu Beverages has an optimal capital structure that is 70% common equity, 20% debt, and 10% preferred stock. Debreu's pre-tax cost of equity is 9%. Its pre-tax cost of preferred equity is 7%, and its pre-tax cost of debt is also 5%. If the corpora..
|
What is the maximum number of paths through the graph
: What is the maximum number of paths through the graph and what is the approximate minimum number of paths through the graph?
|
Examples of ethical and unethical employment practices
: What are some real world examples of ethical and unethical employment practices dealing with compensation (wage or benefits) you have read about, seen in the news, or encountered at your place of employment? What were the outcomes of those practic..
|
What are the monthly payments home mortgage
: What are the monthly payments (principal and interest) on a 15-year home mortgage for an $180,000 loan when interest rates are fixed at 8 percent?
|
Upfront total after-tax cash cost for this proposed project
: Reality Automotive Corp. (“RAC”) manufactures after-market parts for automobiles and trucks (seat belts, windshield wiper blades, floor mats, and truckbed mats). The company is evaluating the expansion of its manufacturing plant to enable it to take ..
|
Find what would be its velocity
: If light from a star of a wavelength of 520.3 nm at rest were shifted to 511.2 nm observed, what would be its velocity
|