Advanced Topics MCQ

Code Tracing: Computing and Society

Practice mode shows one question at a time and lets students check each answer before moving on.

All AT CS Tests

For practice use only.

Code Tracing: Computing and Society

Code Tracing: Computing and Society with immediate answer checks and explanations for Advanced Topics in Computer Science.

Question 1 of 25

Answered 0 of 25

Choose one answer.

Trace the consent filter. What is printed?

public class ConsentFilter
{
    public static void main(String[] args)
    {
        boolean[] consent = {true, false, true, true, false, true};
        int[] minutes = {15, 40, 22, 35, 18, 27};
        int used = 0, total = 0;
        for (int i = 0; i < minutes.length; i++)
        {
            if (consent[i] && minutes[i] >= 20)
            {
                used++;
                total += minutes[i];
            }
        }
        System.out.println(used + ":" + total);
    }
}