adplus-dvertising
frame-decoration

Question

What will be the output for the following code?
k=0;i=0;
 while(k<1 && i<1)
k=k+1;
i=i+1;i=i-k;
end

a.

i=0,k=1

b.

i=0,k=0

c.

i=1,k=0

d.

i=1,k=1

Answer: (a).i=0,k=1

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What will be the output for the following code?

Similar Questions

Discover Related MCQs

Q. How do we break from an infinite loop without keeping a break statement within the loop?

Q. How would you plot multiple graphs in MATLAB?

Q. How do you show the program of an MAT file?

Q. The help command works only for a pre-defined function in MATLAB.

Q. What is the equivalent of subplot (1, 1, 1)?

Q. It is not possible to store graphs as MAT-file.

Q. The command used to reflect the files from a disk into the workspace is _______

Q. The format for 5 digit representation along with exponent is __________

Q. Which operator is used to prevent the printing of insignificant zeros?

Q. The function to plot a graph with both axes on logarithmic scales is __________

Q. We cannot plot a discrete and continuous relationship in the same graph.

Q. How will one escape from printing graphs of variables, whose value gets changed for the program?

Q. A loop is used to avoid repetitive writing of the same function in the code.

Q. How will you return to execution from debugging mode?

Q. The plotting of 3d plots and 2d plots requires separate windows. But the user has entered the hold on command. What is to be done?

Q. How would you expect to see exponential inter-relation in a logarithmic scale?

Q. There will be a problem in computing the logarithm of a negative number.

Q. Global variables must be mentioned _____ an M-file.

Q. To stop execution, press _____

Q. The function definition is shown when we use the look for the command.