APCS Chapter 4 Test

What was true about the Cryptic Programming Stage?

a. Computers were extremely expensive.
b. Programmer salaries were very low.
c. Programs were not designed for future updates.
d. All of the above.
Click the card to flip 👆
1 / 58
Terms in this set (58)
Which of the following Math class features converts real numbers into integers or converts real numbers (1, 2, 3...) into values equivalent to integers (1.0, 2.0, 3.0)? a. floor b. ceil c. round d. All of the aboveAll of the aboveWhich of the following keywords is not a method? a. PI b. E c. final d. All of the aboveAll of the aboveWhat is the value of result in the following statement? double result = Math.pow(5,2);25.0What is the value of result in the following statement? double result = Math.pow(-2,2);4.0What is the value of result in the following statement? double result = Math.pow(2,-2);0.25Assume that n is a non-zero integer. What is the value of result in the following statement? double result = Math.pow(n,0);1.0What is the value of result in the following statement? double result = Math.max(4.0,3.0);4.0What is the value of result in the following statement? int result = Math.max(3,4);4What is the value of result in the following statement? int result = Math.min(4,3);3What is the value of result in the following statement? double result = Math.min(Math.max(11,22), Math.max(33.0,44.0));22.0What is the value of result in the following statement? double result = Math.floor(9.999999);9.0What is the value of result in the following statement? double result = Math.floor(9.000001);9.0What is the value of result in the following statement? double result = Math.ceil(9.999999);10.0What is the value of result in the following statement? double result = Math.ceil(9.000001);10.0What is output as the result of executing the following statement? System.out.println(Math.round(9.999999));10What is output as the result of executing the following statement? System.out.println(Math.round(9.000001));9What is output as the result of executing the following statement? System.out.println(Math.round(9.499999));9What is output as the result of executing the following statement? System.out.println(Math.round(9.500001));10What is the value of result in the following statement? double result = Math.sqrt(256);16.0What is the value of result in the following statement? double result = Math.sqrt(Math.sqrt(256));4.0What is the value of result in the following statement? double result = Math.sqrt(Math.sqrt(Math.sqrt(256)))2.0What is the value of result in the following statement? double result = Math.sqrt(sqrt(81);Compile Error MessageWhat is the output of the following code segment? int a = 25; int b = 16; double result = Math.sqrt(a - b); System.out.println(result);3.0What is the output of the following code segment? int a = 25; int b = 16; double result = Math.sqrt(b-a); System.out.println(result);NaNWhat is the output of the following code segment? int a = 25; int b = 16; double result = Math.sqrt(Math.abs(b - a)); System.out.println(result);3.0Assume that a and b are non-equal integers. What is the value of result in the following statement? int a = 25; int b = 16; double result = Math.sqrt(Math.min(a, b) - Math.max(b, a));NaNWhat is the output of the following statement? System.out.println(Math.pow(-2,0.5));NaNWhat is the output of this statement? System.out.println(Math.sqrt(-25));NaNWhat is the output of this statement? System.out.println(Math.abs(Math.sqrt(-25)));NaN_______ means many forms.Polymorphism_______ is the process of creating a new specialized class from a class that already exists.InheritanceAn attribute of a class is like what part of speech?nounA method of a class is like what part of speech?verbA parameter in a method call can be what? a. A literal constant like 23 b. A variable like x c. An expression like x+23 d. A call to another method e. All of the aboveAll of the aboveWhich word is a synonym for parameter? a. class b. attribute c. method d. argumentargumentIn a Geometric, Cartesian Coordinate system... a. X-values increase moving left and Y-values increase moving down. b. X-values increase moving right and Y-values increase moving up. c. X-values increase moving left and Y-values increase moving up. d. X-values increase moving right and Y-values increase moving down.X-values increase moving right and Y-values increase moving up.In a Computer Graphics Coordinate system... a. X-values increase moving right and Y-values increase moving up. b. X-values increase moving left and Y-values increase moving up. c. X-values increase moving left and Y-values increase moving down. d. X-values increase moving right and Y-values increase moving down.X-values increase moving right and Y-values increase moving down.The (0,0) on the graphics window of a computer is located at the a. bottom-right corner of the window. b. top-left corner of the window. c. bottom-left corner of the window. d. top-right corner of the window.top-left corner of the window.In a graphics method call the consequence of altering the parameter sequence a. will generate a compile error message. b. will not alter the graphics display. c. may alter the graphics display. d. will alter the graphics display.may alter the graphics display.Which 2 lines are at the beginning of all of the graphics programs in Chapter 4?import java.awt.*; import java.applet.*;Assume you have an 800 by 600 applet window and that g is an object of the Graphics class.Which of the following commands will draw a diagonal line from the top-left corner to the bottom-right corner? a. g.drawLine(0,0,799,599); b. g.drawLine(0,0,599,799); c. g.drawLine(0,799,0,599); d. g.drawLine(799,599,0,0); e. Both A and DBoth A and DAssume you have an 800 by 600 applet window and that g is an object of the Graphics class. Which of the following commands will display an open square? a. g.fillRect(100,200,300,300); b. g.drawRect(300,400,100,100); c. g.fillRect(100,200,300,400); d. g.drawRect(100,200,300,400);g.drawRect(300,400,100,100);Assume you have an 800 by 600 applet window and that g is an object of the Graphics class. Which of the following will display one single pixel? a. g.drawPixel(100,200); b. g.drawLine(100,200,100,200); c. Both A and B d. Neither A, nor Bg.drawLine(100,200,100,200);Assume you have an 800 by 600 applet window and that g is an object of the Graphics class.Which of the following program segments will display the entire applet window red? a. g.setColor(Color.red); g.drawRect(0,0,800,600); b. g.setColor(Color.red); g.drawRect(800,600,0,0); c. g.setColor(Color.red); g.fillRect(800,600,0,0); d. g.setColor(Color.red); g.fillRect(0,0,800,600); e. g.setColor(Color.red); g.drawRect(0,0,600,800);The drawOval method uses the exact same parameters as what 3 other method(s)? a. fillOval b. drawRect c. fillRect d. All of the aboveAll of the aboveIf you are using the drawArc command, and the 3rd & 4th parameters are not equal, and the last parameter is 360, what will you draw? a. There is no way to tell without knowing more information on the their parameters. b. a circle c. an oval d. an incomplete oval (essentially an "arc") e. a semi-circlean ovalIf you are using the drawArc command, and the 3rd & 4th parameters are equal, and the last parameter is 180, what will you draw? a. a circle b. an incomplete oval c. an oval d. a semi-circle (half of a circle) e. There is no way to tell without knowing more information on the their parameters.a semi-circle (half of a circle)Assume you have an 800 by 600 applet window and that g is an object of the Graphics class. Which of the following commands will display a message near the bottom of the screen? a. g.drawString(200,50,"APCS is awesome!"); b. g.drawString(200,550,"APCS is awesome!"); c. g.drawString("APCS is awesome!",200,550); d. g.drawString("APCS is awesome!",200,750);g.drawString("APCS is awesome!",200,550);