Verityprep
Question Bank · Unit 1

AP® Computer Science A Using Objects and Methods Practice Questions

Work through AP Computer Science A practice questions on Using Objects and Methods, 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: Using Objects Clear filter

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

Question 11

Multiple choice Using Objects
A pair of number cubes is used in a game of chance. Each number cube has six sides, numbered from 1 to 6, inclusive, and there is an equal probability for each…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 12

Multiple choice Using Objects
Consider the following method. public static boolean mystery(String str) { String temp = ""; for (int k = str.length();k >…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 13

Multiple choice Using Objects
Consider the following method, biggest, which is intended to return the greatest of three integers. It does not always work as intended. public static int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 14

Multiple choice Using Objects
Consider the following method. /* Precondition: num > 0 */ public static int doWhat(int num) { int var = 0; for (int loop = 1;loop…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 15

Multiple choice Using Objects
Consider the following code segment. int x = 1; while ( /* condition */ ) { if (x % 2 == 0) { System.out.print(x + " "); } x = x + 2; } The following…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 16

Multiple choice Using Objects
The price per box of ink pens advertised in an office supply catalog is based on the number of boxes ordered. The following table shows the pricing. Number of…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 17

Multiple choice Using Objects
Consider the following code segment. String str = "abcdef"; for (int rep = 0;rep < str.length() - 1;rep++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 18

Multiple choice Using Objects
Consider the following method. public void numberCheck(int maxNum) { int typeA = 0; int typeB = 0; int typeC = 0; for (int k = 1;k <= maxNum;k++) { if (k % 2 ==…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 19

Multiple choice Using Objects
Consider the following incomplete method. public int someProcess(int n) { /* body of someProcess */ } The following table shows several examples of input values…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 20

Multiple choice Using Objects
Consider the following method. public String inRangeMessage(int value) { if (value < 0 || value > 100) return "Not in range"; else return "In range"; } Consider…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 11 of 546
Page 2 of 55