Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi, can someone help me with some C++ questions: 1. You want to write a program

ID: 3598505 • Letter: H

Question

Hi, can someone help me with some C++ questions:

1.

You want to write a program that simulates the roll of a die. Assume that any include directives are already present and show the statement needed to generate a random value that is between 1 and 6. You will not receive credit if your statement includes -1 +1 as part of any arithmetic.

_____________

2.Why would you use the current time to seed the random number generator?

A.to make sure you get truly random values

B.to generate the same sequence of values each time the program runs

C.to generate different sequences of values each time the program runs

D.to make sure that the program time is up to date

3.Calling srand() multiple times will ensure that the random values generated for your program will be as random as possible.

True or False?

4.Trying to solve a problem by breaking it down into smaller problems is what kind of approach?

A.top down

B.bottom up

C.pseudo code

D.constant design

5.

After this code executes, number will have the same value as that produced by what built-in operator?

while (number >= test)
{
number -= test;
}

______________

6.

After this code executes, count will have the same value as that produced by what built-in operator?

int count = 0;
while (number >= test)
{
number -= test;
count++;
}

______________

Explanation / Answer

1.

You want to write a program that simulates the roll of a die. Assume that any include directives are already present and show the statement needed to generate a random value that is between 1 and 6. You will not receive credit if your statement includes -1 +1 as part of any arithmetic.

Answer: rand() % 6 + 1;

2.Why would you use the current time to seed the random number generator?

Answer: C.to generate different sequences of values each time the program runs

3.Calling srand() multiple times will ensure that the random values generated for your program will be as random as possible.

Answer: False

4.Trying to solve a problem by breaking it down into smaller problems is what kind of approach?

Answer: A.top down

5.

After this code executes, number will have the same value as that produced by what built-in operator?

Answer:  number = number - test;

6.

After this code executes, count will have the same value as that produced by what built-in operator?

Answer: count = count + 1

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote