194k views
0 votes
When ____ occur during preliminary debugging, dummy print statements—statements that are temporarily inserted into the code to display status information on the screen—can be used to help locate the error.

User Jaquez
by
4.6k points

1 Answer

4 votes

Answer:

Logic error.

Step-by-step explanation:

When a logic error occurs sometimes it becomes difficult to locate the error in the code.So to locate the error dummy print used to see which loop,if,else,switch case etc. is executing or not.

for example:-

for(int i=0;i<45;i++)

{

if(i!=1)

{

continue;

}

cout<<i<<endl;

}

we wanted the loop to print all value of i except 1 but it is printing only 1.We can use dummy print statement for this code in if condition.for(int i=0;i<45;i++)

{cout<<"Loop"<<endl;

if(i!=1)

{

cout<<"Printing"<<endl;

continue;

}

cout<<i<<endl;

}

We see that the loop is printed 45 times and printing 44 times.We found that the condition in if statement is wrong.It hould be '==' instead of '!='.

User Pradeep Kr Kaushal
by
5.0k points