Verityprep
Question Bank · Unit 3

AP® Computer Science A Class Creation Practice Questions

Work through AP Computer Science A practice questions on Class Creation, 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.

Subtopic: Writing Classes Clear filter

Questions 11–20 of 402
  1. 11
  2. 12
  3. 13
  4. 14
  5. 15
  6. 16
  7. 17
  8. 18
  9. 19
  10. 20

Question 11

Multiple choice Writing Classes
Given the following method. public static int test(int[] a, int v) { for (int i = 0; i < a.length;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 12

Multiple choice Writing Classes
Questions refer to the following information. Consider the following partial class declaration. public class SomeClass { private int myA; private int myB;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 13

Multiple choice Writing Classes
Which of the following changes to SomeClass will allow…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 14

Multiple choice Writing Classes
Consider the following class declaration. public class Person { private String myName; private int myYearOfBirth; public Person(String name, int yearOfBirth) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 15

Multiple choice Writing Classes
Consider the following class declaration. public class Student { private String myName; private int myAge; public Student() { /* implementation not shown */ }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 16

Multiple choice Writing Classes
Consider the following class declarations. public class Point { private double x; // x-coordinate private double y; // y-coordinate public Point() { x = 0; y =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 17

Multiple choice Writing Classes
Given this code snippet, public class Person { public String name; public Person(String name) { this.name = name; } public void changeName(String name) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 18

Multiple choice Writing Classes
Given this code snippet, public class Athlete { public Athlete(String…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 19

Multiple choice Writing Classes
What is the output running Main.bar(); ? public class Main { private static int n = 0; public static void bar() { Main m1 = new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 20

Multiple choice Writing Classes
What is the output of the following program? public class Main { private String str = "bar"; public static void main(String[] args) { Main…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 11 of 402
Page 2 of 41