Skip to main content

Section 22.4 Practice: Bisection Search

Check Your Understanding Check Your Understanding

1.

Which of the following is the correct sequence of instructions to swap the values of two variables a and b (you may use an additional variable c if you wish)?
Feel free to use the window below to try out some code. Be sure to work the correct answer out "by hand" first before verifying your answer using the code window.

admin.....open in new window

  • c=a; a=b; b=c;
    
  • Correct
  • c=b; a=c; b=a;
    
  • Not quite. Try again!
  • a=b; b=c; c=a;
    
  • Not quite. Try again!
  • a=b; b=a;
    
  • Not quite. Try again!