Frequent Questions      

  Home > Java > SCJP > Practice Question 10

  Java™ Certification: SCJP™ 6- Sun Certified Java Programmer Exam 


Operators And Assignments


           Up               Previous

Q10. What is the optput of this code fragment.

1. int X=3; int Y =10;

2. System.out.println(y%x);

A. 0

B. 1 

C. 2

D. 3

  Correct Answer: B



B is a correct answer. Dividing 10 by 3 gives 3 reminder 1, and this 1 forms the result of the modulo expression. Same rule applies for the negative numbers, you should ignore the signs during calculation part, and simply attach the sign of the Left-hand operand to the result.

   Up           Previous

Copyright © 2000-2018 All rights reserved

Website design by

Disclaimer: All Simulation Exams practice tests, study guides and/or material are neither sponsored by, nor endorsed by, nor affiliated with Oracle® or any other company. All trademarks are trademarks of their respective owners and duly  acknowledged. OCA™, OCPJP™ are registered trade marks of Oracle® . The practice tests material is a copyright of and the same is not approved or endorsed by respective certifying bodies. Thank-you for your interest in Simulation Exams. Please see read me file before you download, install, and/or use any software from  For any information or questions regarding this Website, please e-mail webmaster at