Answer:
See the sample algorithm below.
Explanation:
array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 22];
function last_even(arr) {
for( i = arr.length-1; i >= 0; i--) {
if (arr[i] % 2 == 0) {
console.log(arr[i]);
break;
}
else {
console.log("There is no even number!");
}
}
}
last_even(array);
Answer:
1. Option A: for loop is correct
2. Option B: while loop is correct
Explanation:
Two loops are used commonly. For and while
For is used when the number of iterations are already known and while is used when number of iterations is not known and the loop has to be terminated based on any condition.
<u>1. You are finding the batting average of 13 baseball players.
</u>
For loop will be used as the number of iterations is already known. The score of 13 players has to be used to calculate the average so there will be 13 iterations. Hence, for loop will be used.
<u>2. You are asking your users for the names of all the stores where they shopped to find their friend's birthday present. They will show they are done by entering the word "done."</u>
While loop will be used as the termination of loop depends on the input given by the user so the number of iterations are not already known.
Hence,
1. Option A: for loop is correct
2. Option B: while loop is correct
Answer:Discloses actual/potential dangers
Help create an environment supporting ethical conduct
Explanation: The clauses that are presented by the Code of Ethics for software engineering which are upheld by a whistle blower are termed as 1.03, 1.04 and 6.08.These describe about the below mentioned terms:-
- 1.03-it gives permission to software by receiving assurance that it meets the requirement, protected , good qualities and other such testable factors.
- 1.04- Disclosing to the correct and reliable person regarding any potential danger towards the user.
- 6.08- reporting errors and malicious activities, detecting it ,correcting those errors etc so that software conduct can work smoothly.
I'd say B) a house because interest rates can change and will affect you if you're paying for a mortgage, etc.. (Houses take a while to pay for; airline tickets, a sweater, and patio furniture is paid immediately)
Is there anything about this question?