Ask Question

A. A programmer wrote a software delay loop that counts the variable (unsigned int counter) from 0 up to 40,000 to create a small delay. If the user wishes to double the delay, can they simply increase the upperbound to 80,000?

b. If the code contains a delay loop and we noticed that no delay is being created at run-time. What should we suspect during debugging?

+3
Answers (1)
  1. 24 March, 08:44
    0
    The objective here is to determine if the programmer can simply increase the upperbound to 80,000.

    Of course Yes, The programmer can simply increase the delay by doubling the upperbound by 80000. The representation can be illustrated as:

    (int : i = 0; i < 40,000; i + +)

    {

    / / delay code

    }

    Which can be modified as:

    (int : i = 0; i < 80,000; i + +)

    {

    / / delay code

    }

    b) If the code contains a delay loop and we noticed that no delay is being created at run-time. What should we suspect during debugging?

    Assuming there is no delay being created at the run-time,

    The code is illustrated as:

    For (int : i = 0; i < 0; i + +)

    {

    / / delay code which wont

    //execute since code delay is zero

    }

    we ought to check whether the loop is being satisfied or not. At the Initial value of loop variable, is there any break or exit statement is being executed in between loop. Thus, the aforementioned delay loop wont be executed since the loop wont be executed for any value of i.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “A. A programmer wrote a software delay loop that counts the variable (unsigned int counter) from 0 up to 40,000 to create a small delay. If ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers