Short Answer 1. Explain what is meant by the term “conditionally executed”. Conditionally executed is called a single alternative decision structure because it provides only one alternative path of execution. The action is conditionally executed because it is performed only when a certain condition is true. 2. You need to test a condition and then execute one set of statements if the condition is true. If the condition is false, you need to execute a different set of statements. What structure will you use? I will use the “If” statement because it is a dual alternative decision structure. 3. If you need to a test the value of a variable and use that value to determine which statement or set of statements to execute, which …show more content…
If x > 100 y = 20 z = 40 End If 2. Design an If-Then statement (or a flowchart with a single alternative decision structure) that assigns 0 to the variable b and assigns 1 to the variable c if the variable is a less than 10. If a < 10 Then b = 0 c = 1 End If 3. Design an If-Then-Else statement (or a flowchart with a dual alternative decision structure) that assigns 0 to the variable b if the variable a is less than 10. Otherwise, it should assign 99 to the variable b. If a < 10 b = 0 Else If b = 99 End If 4. The following pseudo code contains several nested If-Then-Else statements. Unfortunately, it was written without proper alignment and indentation. Rewrite the code and use the proper conventions of alignment and indentation. If score < 60 Then Display “Your grade is F.” Else If score < 70 Then Display “Your grade is D.” Else If score < 80 Then Display “Your grade is C.” Else If score < 90 Then Display “Your grade is B.” Else Display ‘Your grade is A.” End If End If End If End If 5. Design nested decision structures that perform the following: If
TCO 4—Given a simple problem that requires one or more decisions, create a working solution that uses decisions with logical and relational expressions.
you will find that in any computer language you use. Here is how the “if” statement
Processing Logic – The logic used in this program is based on Iif- Tthen statements. From the begging in of the program the season input will enact a series of Iif-T then statements that the one that happens to be true for that input will then move the program to the appropriate module. Within the modules each question has iIf t-Then and eElse statements stating that if the home owner makes a certain input the program will calculate the out put.
Provide printf statements for each of the following. You should choose appropriate variable names given the requirements:
(a) attends to the decision task at hand, (b) delays a decision response until the decision-making process is completed, (c) weigh treatment alternatives, (d) considers risks associated with different treatment alternatives, and (e) estimate costs and consequences of choosing or not choosing various treatment alternatives (p. 65).
Programming testing is the methodology of executing a program or framework with the purpose of finding faults. Testing is a procedure of affirming that item is working as per the requirments, fulfilling the client needs. Programming testing gives a way to decrease errors, cut maintenance and general programming costs. Various programming testing strategies, techniques, and systems have developed in the course of the most recent couple of decades promising to improve programming quality. Programming testing is vital part in the product development life cycle. Two regular methodologies are white box testing and discovery testing. There are diverse scope measure for testability to the source code, for example, statement coverage, branch coverage and condition coverage. In the branch coverage we ensure that we execute each branch in any event once For conditional branches, this implies, we execute the TRUE branch in any event once and the FALSE branch in any event once conditions for conditional branches can be compound boolean expressions a compound boolean
1) Choose a variable (hint: notice the level of measurement!) and make a pie chart and a bar chart. For full credit, make sure you have a title and a source. Pie Chart Bar Chart 1) Now, choose another variable( hint: notice the level of measurement) a) Make a histogram. Histogram b) Make a frequency table. Frequency table A9.
subject to : 3x1 + 5 x2 ≤ 30 x1 + x2 ≥ 18 x1 , x2 ≥ 0
: Whenever the if-statements are used they should be written in a well formatted order. In the case of deep nesting of if-statements there are higher chances of not understanding of the code. The reason for this might be the statements are not
if(*stringNav != '1 ' && *stringNav != '2 ' && *stringNav != '3 ' &&
The single difference is Perl, in which all the statement “then” and “else” clauses should be compound statements, though they include only one statement. Several languages are used braces to form compound statements, that serve as the forms of “then” and “else” clauses. In FORTRAN 95, Ada, Python, and Ruby languages, the “then” and “else” clauses are in statement order, before the compound statements. The entire selection statement is completed in these languages with a reserved word.
The case with if usually goes together with three types of If-clause, which express the condition of the action in the past, at the present and in the future.
Therefore the boundary value analysis test cases are obtained by holding the values of all but one variable at their nominal values, and letting that variable assume its extreme values. The basic boundary value analysis technique can be generalized in two ways: by the number of variables and by the kinds of ranges. Boundary value analysis does not make much sense for Boolean variables. The extreme values are True and False. Logical variables also present a problem for boundary value analysis. Boundary value analysis works well when the program to be tested is a function of several independent variables that represent bounded physical quantities.
if ((xintersec>seg1[0][0] and xintersec>seg1[1][0]) or (xintersec>seg2[0][0] and xintersec>seg2[1][0])) or ((xintersecseg1[0][1] and yintersec>seg1[1][1]) or (yintersec>seg2[0][1] and yintersec>seg2[1][1])):
else if ((Pr1 == 1) & (Pr2 == 2) & (Pr3 == 3) & (Pr4 == 5) & (Pr5 == 4))