aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • C Programming: Loops and Control Structures
  • Which of the following statements is the correct one for ...
Multiple choice

Which of the following statements is the correct one for exchanging the values of two variables? If a, b & temp are three variables.

  1. a=b; b=a;

  2. temp=a;a=b;b=temp;

  3. a=b;b=temp;

  4. temp=a;a=b;

  5. None of these

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

This is the correct assignment.

Keep practicing — related questions

  • Swap the value of two variable in one statement without using any temporary variable
  • In which of the following options, C < A and D > B is definitely true?
  • String s1 = "Hello", s2 = "Hi"; //Which code exchanges their values?
  • Which of the following options represents the correct pair of statements? Statement 1 : 6x - 13 = 23 is a l...
  • Assume that we want to exchange values of two unsigned character type variable values. Only one operator is...
  • The minimum number of temporary variables needed to swap the contents of two variables, is
  • data temp; length y $5; x=4; if x=4 then y='four'; else if x=7 then y='seven'; x=7; run; What would be the ...
  • Which of the following statements is/are correct? a. Any elevated area that separates two drainage basins i...
Play the full quiz 🎤 Practise this topic out loud
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy