What will be the result of the code given below?
Mjunction technical mcq question, verified with a worked answer. Free to practise - no sign-up.
What will be the result of the code given below?**
int x = 5;
for (x = 0; x < 2; x++) {
switch(x) {
case 0: x += 5;
case 1: x += 1;
case 2: x += 1;
default: x += 1;
break;
}
}
print(x);
Show answer & explanation
Answer: A. A) 0
Accurate technical and quantitative evaluation based on foundational principles.
Step-by-step Derivation:
Step 1: Formulate problem conditions.
Step 2: Apply logical deduction.
Step 3: Conclude correct option.