Solved

Assume You Have Two Integer Variables, Num1 and Num2

Question 30

Multiple Choice

Assume you have two integer variables, num1 and num2. Which of the following is the correct way to swap the values in these two variables?


A) int temp = num1;
Num2 = num1;
Num1 = num2;
B) int temp = num2;
Num2 = num1;
Num1 = temp;
C) num1 = num2;
Num2 = num1;
D) int temp = num1;
Num2 = temp;
Temp = num2;
Num1 = temp;
E) None of these

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents