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.

Questions 231–240 of 776
  1. 231
  2. 232
  3. 233
  4. 234
  5. 235
  6. 236
  7. 237
  8. 238
  9. 239
  10. 240

Question 231

Multiple choice Primitive Types
Let x be a variable of type double that is positive. A program contains the boolean expression (Math.pow(x,0.5) == Math.sqrt(x)). Even though \(x^{0.5}\) is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 232

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 233

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 234

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 235

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 236

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 237

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 238

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 239

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 240

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 231 of 776
Page 24 of 78