GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

GradePack

What is printed by the following code?int battery = 15; if (…

What is printed by the following code?int battery = 15; if (battery > 50) { System.out.print(“full “); } else if (battery > 20) { System.out.print(“low “); } System.out.print(“checked”);

Read Details

This code prints a 4 by 4 square of # symbols. Which replace…

This code prints a 4 by 4 square of # symbols. Which replacement for the inner loop header makes it print a right triangle instead, with one # on the first line, two on the second, three on the third, and four on the fourth?for (int row = 1; row

Read Details

What is printed by the following code?ArrayList temps = new…

What is printed by the following code?ArrayList temps = new ArrayList(); temps.add(72); temps.add(85); temps.add(91); temps.add(68); int checked = 0; for (int i = 0; i < temps.size(); i++) { checked++; if (temps.get(i) > 80) { break; } } System.out.println(checked);

Read Details

words is an ArrayList that holds exactly 4 elements. Which c…

words is an ArrayList that holds exactly 4 elements. Which call throws an IndexOutOfBoundsException?

Read Details

What is printed by the following code?int timer = 4; int bee…

What is printed by the following code?int timer = 4; int beeps = 0; while (timer < 1) { beeps++; timer--; } System.out.println(beeps + " " + timer);

Read Details

What happens when this code runs?int[] pts = {3, 5, 7}; int…

What happens when this code runs?int[] pts = {3, 5, 7}; int total = 0; for (int i = 0; i

Read Details

A program needs to check whether the String variable word ho…

A program needs to check whether the String variable word holds exactly the text stop. Why should it use word.equals(“stop”) instead of word == “stop”?

Read Details

Which line of this code causes a compile error?String city =…

Which line of this code causes a compile error?String city = “Lima”; string country = “Peru”; int year = 2026; String label = city + year;

Read Details

What is printed by the following code?String answer = “Yes”;…

What is printed by the following code?String answer = “Yes”; answer.toLowerCase(); System.out.println(answer + ” ” + answer.equals(“yes”));

Read Details

This code is meant to print a single letter grade, but with…

This code is meant to print a single letter grade, but with a score of 95 it prints ABC. Which change makes it print just A?int score = 95; if (score >= 90) { System.out.print(“A”); } if (score >= 80) { System.out.print(“B”); } if (score >= 70) { System.out.print(“C”); }

Read Details

Posts pagination

Newer posts 1 … 9 10 11 12 13 … 100,400 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top