Certification tests Certification training Certification tests mcse ccna a+
Practice Tests CCNA MCSE A+ Network+           
  IT Certification Practice Exams   HOME  | Cisco  | CompTIA  | CheckPoint | CIW | Microsoft | Books | Bootcamp |  Buy Now!

Java Certification: SCJP - Sun Certified Java Programmer Exam 

Practice Questions: Exam SCJP 1.6
Declaration and Access Control

 

Home                                                                              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

 

Explanation:

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.

 


Home                                                                                                          Up       Previous