Question:

What is the answer of this question?

by Guest33318  |  earlier

0 LIKES UnLike



The algorithm for a loop is generally written as:

1. initialize the loop control variable

2. while the condition is satisfied,

2.1. do the steps to be repeated

2.2. update the value of loop control variable

1. What will be the result of the program if step1 below is not implemented?

A. An endless loop will occur C. The program will execute unpredictably

B. There will be no effect to the program D. The program will not enter the loop

p.s This not a homework.

 Tags:

   Report

9 ANSWERS


  1. C because you have no idea if the loop variable is in or out of range.  So it may work right, may give you a memory fault error, who knows....


  2. yes it does sound like hw, intro to programming, read your book it helps  

  3. Depending on the language you are working on, specifically, whether it allows for variables to be uninstantiated. In Java, there would be a compilation error, so no code would be executed. But the question is vague, so it may be asking what exactly the compiler "executes" when step 1 is not implemented - so the right answer might be D.

  4. Its not going to work unless it has a baseline set of instructions.

    Now if you were to say try and get the NIC to use the loop back address and then to test it try the ping command. Now say the ping command didn't have the variable of "send 32bytes of data" at "x*x intervals" then nothing is going to send causing the function to fail.

    Whether or not it would just ignore the request or completely fall over is hard to say. My feeling is that it would ignore given that most apps have some level of error correction.

    Depending on what you are doing the answer maybe different. For example if you are setting up an application to have a loop test in order to check how hard it can be hammered before falling over, then its again hard to say. My instinct tells me the app is going to hang while it attempts to complete the request, but not receiving the variables it needs to start. However if somehow it managers to get the request under way it most certainly will be erratic in nature.

    Now if the program has been setup with sufficient error correction it is going to ignore the request and move on to the next one.

    I guess what i am getting at is that alot of this is dependent on the rest of the app.

    I can say for certain that it will not work. It will either ignore or fall over when trying this.

    **************************************...

    Update

    So the point of the question was just to shoot down the responces. Good work.

    So now I can mark this as misuse as you didnt actually have a question. Just wanted to try and prove how smart you were.

    Well ya not. loopbacks require variables in order to run

    http://www.ibm.com/developerworks/websph...

    !!!

  5. I graduated kindergarten

    so the answer is C. The program will execute unpredictably

  6. blah blah blah whatever I have no clue...don't even feel like reading all that or trying to make my brain work enough to figure it out...don't EVEN know what you're talking about. Sorry, I know this answer isn't helpful at all :/

  7. X = I don't know!

    Good luck on all that!

  8. Idk

  9. The answer would be C because depending on the choices of the program it will either work because a condition was met or not met or it will try to enter the loop and will error because the control was not initialized or known by the program.

Question Stats

Latest activity: earlier.
This question has 9 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.