Verityprep
Question Bank

AP® Computer Science A Multiple Choice Questions

Work through AP Computer Science A multiple-choice questions unit by unit, then check each answer against a worked solution.

Free · no sign-up Open questions need no account. Sign up or log in to open the rest.

Questions 1,691–1,700 of 2,811
  1. 1691
  2. 1692
  3. 1693
  4. 1694
  5. 1695
  6. 1696
  7. 1697
  8. 1698
  9. 1699
  10. 1700

Question 1691

Multiple choice Unit 3: Class Creation
Consider the following class. public class Account { private int balance; public Account(int b) { balance = b; } public int withdraw(int amount) { if (amount >…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1692

Multiple choice Unit 3: Class Creation
Consider the following method. public static void addAll(ArrayList<Integer> list) { list.add(99); list = new ArrayList<Integer>(); list.add(7); } Consider the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1693

Multiple choice Unit 3: Class Creation
Consider the following class. public class Counter { private static int total = 0; private int value; public Counter() { value = 1; total = total + value; }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1694

Multiple choice Unit 3: Class Creation
Consider the following class. public class Box { private int value; public Box(int v) { value = v; } public int get() { return value; } public void set(int v) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1695

Multiple choice Unit 3: Class Creation
Consider the following class. public class Counter { private int n; public Counter() { n = 0; } public int bump() { n = n + 1; return n; } public int get() {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1696

Multiple choice Unit 3: Class Creation
Consider the following class. public class Point { private int x; private int y; public Point(int x, int y) { this.x = y; this.y = x + this.x; } public int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1697

Multiple choice Unit 3: Class Creation
Consider the following class.
public class Account
{
    private int id;
    private double balance;
    private boolean active;
    private String owner;

    public Account(int theId)
    {
        id = theId;
    }

    public String describe()
    {
        return id + " " + balance + " " + active + " " + owner;
    }
}
Consider the following code segment.
Account a = new Account(42);
System.out.println(a.describe());
What is printed when the code segment executes?
Pick an answer, then check it. The solution opens in a window.

Question 1698

Multiple choice Unit 3: Class Creation
Consider the following class. public class Token { private static int issued = 0; private int id; public Token() { issued = issued + 1; id = issued; } public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1699

Multiple choice Unit 3: Class Creation
Consider the following class. public class Pet { private String name; private int age; public Pet(String name, int age) { name = name; this.age = age; } public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1700

Multiple choice Unit 3: Class Creation
A programmer is designing a class Score intended to represent a numeric grade with both an int form and a double form. Consider the four method declarations…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1,691 of 2,811
Page 170 of 282