Answer:
e) Code segment II produces correct output for all values of str, but code segment I produces correct output only for values of str that contain "pea" but not "pear".
Explanation:
<em>if - elseif - else statements work in sequence in which they are written. </em>
- <em> </em>In case <em>if() statement is true, </em>else if() and else statements will not get executed.
- In case <em>else if() statement is true</em>, conditions in if() and else if() will be checked and else statement will not be executed.
- In case <em>if() and else if() both are false</em>, else statement will be executed<em>.</em>
First, let us consider code segment I.
In this, first of all "pea" is checked in if() statement which will look for "pea" only in the String str. So, even if "pearl" or "pear" or "pea" is present in 'str' the result will be true and "pea" will get printed always.
After that there are else if() and else statements which will not get executed because if() statement was already true. As a result else if() and else statements will be skipped.
Now, let us consider code segment II.
In this, "pearl" is checked in if() condition, so it will result in desired output.
Executable code is attached hereby.
Correct option is (e).
<span class="sg-text sg-text--link sg-text--bold sg-text--link-disabled sg-text--blue-dark">
java
</span>
<span class="sg-text sg-text--link sg-text--bold sg-text--link-disabled sg-text--blue-dark">
java
</span>
Answer:
import random
decisions = int(input("How many decisions: "))
for i in range(decisions):
number = random.randint(0, 1)
if number == 0:
print("heads")
else:
print("tails")
Explanation:
*The code is in Python.
import the random to be able to generate random numbers
Ask the user to enter the number of decisions
Create a for loop that iterates number of decisions times. For each round; generate a number between 0 and 1 using the randint() method. Check the number. If it is equal to 0, print "heads". Otherwise, print "tails"
A burn-in test is a test which is usually performed on a system or component by running it for a long time in order to bring out any errors or system failures etc.
While doing it on CPU the data must be backed up as any kind of error or failure may result in the loss of data, at time systems can be repaired to retrieve data but still there is no guarantee, backing up is the best option.
Answer:
for (char outerChar='a'; outerChar<='e'; outerChar++){
for (char innerChar='a'; innerChar<='e'; innerChar++){
cout << outerChar << innerChar << "\n";
}
}
Additional resource needed for the projects
Additional time needed for the project
<u>Explanation:</u>
In any project handing their will expected diversion and add on requirement, so to complete a project additional time and additional resource is required to finish a project.
As advice due the project details, end user has keep enough buffer for deviations on resource of man power and additional times taken to finish the project.
While design the project each scope of work is measure with additional time to complete the task
Each scope of work is considered as task in project management.