APCS Ch. 4
Terms in this set (60)
What does OOP stand for?
What is the difference between C++ and Java with regards to OOP?
C++ gives you the option to use OOP. Java requires it.
What are the 4 stages of program design?
1) Cryptic Programming Stage
2) Unstructured, spaghetti-programming stage
3) Structured programming stage
4) Object-oriented programming stage
Why were some programs intentionally written very cryptic in the 1st stage of program design?
Many programs were written intentionally in a very cryptic style that only the creator of the program could understand
Why did the first stage of program design not last long?
Computers became cheaper and programmers became more expensive. Programs required frequent debugging and updating, and the cryptic style usually meant starting a program from scratch if the creator left the company. Companies could not afford this wasteful approach
What quick fix statement was used in the 2nd stage of program design?
Refer to the previous question. How did this statement lead to the term spaghetti programming?
If you use a pencil and try to draw the flow of a program that uses goto, what you wind up with rapidly looks like spaghetti
Programs in the past and today have one common goal that allows no compromise. What is that?
Is GOTO used in structured programming?
In structured programming, program flow is strictly controlled with how many entrances and exits?
one entrance, one exit
In structured programming, program statements with a common purpose were grouped together in special _______.
In structured programming, how many tasks per module?
Structured programming greatly improved the _____, _____, and _____ of programs.
creation, debugging, updating
Why are computer programs so much longer today than they were in the late 1980s and early 1990s?
To be more user friendly, computer programs are now GUI based rather than text based
OOP incorporates what 3 features?
2) class interaction
In OOP, what are attributes used for?
To store program information, which is like a noun
In OOP, what are methods used for?
To perform some actions on the information, which is like a verb
What 2 Java methods have you already learned about?
What is encapsulation?
The process of putting attributes and the methods that act upon these attributes in the same container (object)
What does the word polymorphism mean?
Explain class interaction in computer science terms.
Where existing classes work together by interacting with each other and with newly created classes
What are 2 types of class interaction?
Modules that perform a related set of functions are grouped together in a special program type or container. What is this container called?
What 2 things do classes contain?
methods and data
What are the 2 types of methods in Java?
What is the output of System.out.println(Math.sqrt(100)); ?
Refer to the previous question. What does Math signify?
The name of the class
Refer again to question 26. What does sqrt signify?
The name of the method
Refer yet again to question 26. What does 100 signify?
the argument or parameter being passed to the method
Can a method be an argument for another method?
The information which is passed to a method is called an _____ or a _____.
Where are parameters placed?
Between parentheses immediately following the name of the method (method identifier)
What 4 things can parameters be?
What is the output of System.out.println(Math.sqrt(-100)); ?
The floor, ceil, and round methods of the Math class all "round" in some way. What is the difference among them?
: always rounds down
: always rounds up
: rounds normally (up if ≥.5; down if <.5)
What is the output of System.out.println(Math.max(100,50)); ?
What is the output of System.out.println(Math.min(100,50)); ?
What is the output of System.out.println(Math.abs(-7)); ?
What is the output of System.out.println(Math.pow(3,4)); ?
What is the output of System.out.println(Math.pow(4,3)); ?
Are PI and E attributes or methods of the Math class?
Which class had methods that use more parameters: the Math class or the Graphics class?
What method is not found in an applet?
What controls the execution sequence in an applet?
How is calling a method of the Math class different from calling a method in the Graphics class?
You don't use the name of the class to call the method, instead you need a Graphics variable object, in many cases this is g, to call the method
What libraries must be imported in order to use the Graphics class?
What does awt stand for?
abstract windows tool
What do the 4 parameters of the drawLine method of the Graphics class specify?
X and Y values of the coordinate point at both ends of the line
What do the 4 parameters of the drawRect method of the Graphics class specify?
The first two are is the top left coordinate (X,Y). Third parameter is the rectangle's width and the fourth is the rectangle's height.
drawRect(X, Y, Width, Height)
What is the difference between drawRect and fillRect?
drawRect draws the rectangle outline.
fillRect fills in the rectum.
How do you create a square with the drawRect and fillRect methods?
Set the third and fourth parameters (width and height) to the same value.
What do the 4 parameters of the drawOval method of the Graphics class specify?
The first two X,Y is the coordinate of the top left corner
of the rectangle that circumscribes the oval
. The third parameter is the oval's width and the fourth is its height.
drawOval(X, Y, Width, Height)
What is the difference between drawOval and fillOval?
drawOval draws the oval outline inscribed in the imaginary rectangle.
fillOval fills in the oval inscribed in the imaginary rectangle.
How do you create a circle with the drawOval and the fillOval methods?
Set the third parameter (width) and the fourth parameter (height) to the same value.
What is an arc?
a piece of an oval
The 1st 4 parameters of the drawArc method are the same as the drawOval method. What do the 5th and 6th parameters specify?
The 5th parameter specfies the starting degree value.
The 6th parameter specfies how many degrees the arc will be drawn going counter-clockwise.
drawArc(X, Y, Width, Height, StartDeg, DegsTravel)
When you use parameters incorrectly, it may not always be apparent the program has some _____ error.
Assume g is an object of the Graphics class. Print the Java command to change the graphics color to orange.
In Java, it is possible to create any of over 16 million different colors by combining different values of what 3 colors?
red, blue, green
What Graphics method is similar to System.out.println, but is used with graphics output?
YOU MIGHT ALSO LIKE...
Computer Science - Chapter 4 Review
Exposure Java - APCS - Chapter 4 Review
AP Computer Science Chapter 4
ch4 test review (4b)
OTHER SETS BY THIS CREATOR
AAS 206 Final
Midterm 1 - AAS 206
INDE 250 Midterm 1
AMATH 301 FINAL
THIS SET IS OFTEN IN FOLDERS WITH...
APCS CH 1
Ch. 3 APCS
APCS Ch 5