Predict the output obtained on executing the given code snippet. (Assume the code is present in a main() method and all the necessary imports are done)

int vehicleNumber = 2185;
int sum = 0;
while (vehicleNumber != 0) {
	sum += vehicleNumber % 10;
 	vehicleNumber /= 10;
}
if (sum % 3 == 0 || sum % 5 == 0 || sum % 7 == 0) {//Line1
	System.out.println("It is a lucky number");
} else {
	System.out.println("It is not a lucky number");
}

No Output

Compilation error as sum cannot be resolved to a variable at Line1

It is a lucky number

It is not a lucky number

Verified Answer
Correct Option - d

To get all Infosys Certified Java SE11 Developer Exam questions Join Group https://bit.ly/infy_premium_group

We're passionate about offering best placement materials and courses!! A one stop place for Placement Materials. We daily post Offcampus updates and Placement Materials.

Qtr No. 213, New Town Yehlanka Indore 454775

admin@prepflix.in