Verityprep
Question Bank · Unit 1

AP® Computer Science A Using Objects and Methods Multiple Choice Questions

Work through AP Computer Science A multiple-choice 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 111–120 of 454
  1. 111
  2. 112
  3. 113
  4. 114
  5. 115
  6. 116
  7. 117
  8. 118
  9. 119
  10. 120

Question 111

Multiple choice Using Objects
/** Returns true if the 4-digit integer n is valid, * false otherwise. */ boolean checkNumber(int n) { int d1, d2, d3, checkDigit, nRemaining, rem; //strip off…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 112

Multiple choice Using Objects
Consider the following declarations in a program to find the quantity \(\text{base}^{\text{exp}}\). double base = < a double value > double exp = < a double…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 113

Multiple choice Using Objects
Consider the squareRoot method defined below. /** Returns a Double whose value is the square root * of the value represented by d. */ public Double…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 114

Multiple choice Using Objects
Here are some examples of negative numbers rounded to the nearest integer: Negative real number Rounded to nearest integer -3.5 -4 -8.97 -9…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 115

Multiple choice Using Objects
A program is to simulate plant life under harsh conditions. In the program, plants die randomly according to some probability. Here is part of a Plant class…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 116

Multiple choice Using Objects
A program simulates 50 slips of paper, numbered 1 through 50, placed in a bowl for a raffle…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 117

Multiple choice Using Objects
Consider the following code segment. Integer i = new Integer(20); / * more code * / Which of the following replacements for /* more code…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 118

Multiple choice Using Objects
Refer to these declarations. Integer k = new Integer(8); Integer m = new Integer(4); Which test(s) will generate a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 119

Multiple choice Using Objects
Consider the following code fragment. Object intObj = new Integer(9); System.out.println(intObj); You may…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 120

Multiple choice Using Objects
Consider these declarations. String s1 = "crab"; String s2 = new String("crab"); String s3 = s1;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 111 of 454
Page 12 of 46