| preferred AP College board partner for AP classes
AP Computer Science A/Unit 4: Iteration
Start Practice Test
Share
medium Solved by 3 students
For Loop With Compound Conditional
< Prev
Next >

Consider the following method definition in a class Processing:

public static void evaluate(int limit, int divisor) {
  for (int j = 0; j < limit; j++) {
    if (j % divisor == 0 && j % 3 == 0) {
      System.out.print(j + " ");
    }
  }
}

Which of the following method calls will cause "0 6 12 " to be printed?

A

evaluate(5, 6)

B

evaluate(20, 6)

C

evaluate(15, 6)

D

evaluate(12, 6)

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1sgarv251311 0m 00s 100
#2hitrishabhatia11 0m 00s 100
#3mahmoudjibrin0812 0m 53s 37
#4y.seong202712 1m 33s -3
#5psak1201 2m 31s -161
#6suhanakochhar00601 2m 54s -184
#7gtsak3101 3m 40s -230
APFIVE © 2020.
Email: [email protected]|Privacy Policy