Deck 4: Introduction to Graphical Applications
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/57
Play
Full screen (f)
Deck 4: Introduction to Graphical Applications
1
Which of the following statements is true?
A) Application class is the superclass, and ShellGraphicsApplication is the subclass.
B) ShellGraphicsApplication is the superclass, and the Application is the subclass.
C) ShellGraphicsApplication is the superclass, and main is the subclass.
D) None of these is correct.
A) Application class is the superclass, and ShellGraphicsApplication is the subclass.
B) ShellGraphicsApplication is the superclass, and the Application is the subclass.
C) ShellGraphicsApplication is the superclass, and main is the subclass.
D) None of these is correct.
A
2
The stroke and fill methods draw the figures in the ____________ colors.
A) main
B) prominent
C) foreground
D) background
A) main
B) prominent
C) foreground
D) background
C
3
Graphical applications require a _________ method, which contains the code to execute when the application begins.
A) main
B) paint
C) draw
D) Graphics
A) main
B) paint
C) draw
D) Graphics
A
4
What is the likely cause if a figure is not visible inside a window?
A) The figure's coordinates are outside the bounds of the window.
B) At least one of the (x, y) coordinates is not valid.
C) The paint method was used.
D) The constructor requires a larger window.
A) The figure's coordinates are outside the bounds of the window.
B) At least one of the (x, y) coordinates is not valid.
C) The paint method was used.
D) The constructor requires a larger window.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
5
Gray consists of equal amounts of black and white.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
6
A(n) ___________ line is drawn if the startX and endX values are the same.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
7
The ______________ class provides the functionality for drawing shapes.
A) IntegerObject
B) paint
C) main
D) GraphicsContext
A) IntegerObject
B) paint
C) main
D) GraphicsContext
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
8
A JavaFX graphical application opens a new window.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
9
When using the Color class, you can instantiate 16,000 additional combinations of the component values.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
10
The coordinate of the top left corner of the window is (0, 0).
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
11
Which of the following is the purpose of the fill methods?
A) Render solid figures
B) Render the outline of the figure
C) Draw a rectangle in the background color
D) None of these is correct.
A) Render solid figures
B) Render the outline of the figure
C) Draw a rectangle in the background color
D) None of these is correct.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
12
JavaFX's GraphicsContex class, in the javafx.scene.canvas package, provides methods to draw figures such as rectangles, circles, and lines; to set the colors for drawing; and to write text in a window.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
13
fillRect( double x, double y, double width, double height ) draws a solid rectangle with its top-left corner at (x, y), with the specified width and height in pixels, and returns an int.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
14
It is more difficult to draw an octagon than a circle.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
15
When drawing a figure, it is useful to specify coordinates as offsets from a starting (x, y) coordinate.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
16
What would happens if the (x,y) coordinate you specify for a figure is not inside the window?
A) If a figure's coordinates are outside the bounds of the window, an error will be generated but the figure will be visible.
B) If a figure's coordinates are outside the bounds of the window, an error will be generated and the figure will not be visible.
C) If a figure's coordinates are outside the bounds of the window, no error will be generated, but some of the figure may not be visible.
D) None of these is correct.
A) If a figure's coordinates are outside the bounds of the window, an error will be generated but the figure will be visible.
B) If a figure's coordinates are outside the bounds of the window, an error will be generated and the figure will not be visible.
C) If a figure's coordinates are outside the bounds of the window, no error will be generated, but some of the figure may not be visible.
D) None of these is correct.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
17
When drawing a square blue box crisscrossed with a yellow ribbon, you would draw the blue box before the yellow ribbon.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
18
An applet viewer, which is provided as part of the Java SE Development Kit (JDK), is a minimal browser that enables us to view the applet without needing to open a web browser.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
19
In Java, the __________ keyword specifies that one class is an extension of another and inherits the properties of the other class.
A) application
B) main
C) extends
D) elaborate
A) application
B) main
C) extends
D) elaborate
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
20
Which package is the GraphicsContext class part of?
A) javax.swing
B) javafx.swing
C) java.awt
D) javax.awt
E) javafx.scene.canvas
A) javax.swing
B) javafx.swing
C) java.awt
D) javax.awt
E) javafx.scene.canvas
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
21
Calling the launch method in main automatically triggers a call to the ______ method.
A) init
B) main
C) start
D) exit
E) launch
A) init
B) main
C) start
D) exit
E) launch
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
22
Where is the (0, 0) coordinate in the window?
A) Top left
B) Top right
C) Bottom left
D) Bottom right
A) Top left
B) Top right
C) Bottom left
D) Bottom right
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
23
In horizontal lines, the startX and endX values are the same.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
24
strokeOval draws a solid oval.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
25
In JavaFX, we draw shapes and text on a(n) ________.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
26
If we want to draw a string in a specific font, we can change the font by calling the ________ method.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
27
The name of the method you would call to draw a solid square is __________.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
28
The name of the method you would call to display a String is __________ and fillText.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
29
The name of the method you would call to draw a solid oval is __________.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
30
The name of the method you would call to add a line to a polygon is __________.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
31
In the method strokeRect( 10, 20, 100, 200 ), 100 and 200 represent __________, respectively, of the rectangle being drawn.
A) the x and y coordinates of the top left corner
B) the x and y coordinates of the bottom right corner
C) the x and y coordinates of the top right corner
D) the width and height
E) the height and the width
A) the x and y coordinates of the top left corner
B) the x and y coordinates of the bottom right corner
C) the x and y coordinates of the top right corner
D) the width and height
E) the height and the width
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
32
In the method call strokeRect( 10, 20, 100, 200 ), 10 and 20 represent, __________, respectively, of the rectangle being drawn.
A) the x and y coordinates of the top left corner
B) the x and y coordinates of the bottom right corner
C) the x and y coordinates of the top right corner
D) the width and the height
E) the height and the width
A) the x and y coordinates of the top left corner
B) the x and y coordinates of the bottom right corner
C) the x and y coordinates of the top right corner
D) the width and the height
E) the height and the width
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
33
The RGB values of Color.GREEN are:
A) 0,128,0.
B) 255,0,0.
C) 0,0,255.
D) 0,0,0.
E) 255,255,255.
A) 0,128,0.
B) 255,0,0.
C) 0,0,255.
D) 0,0,0.
E) 255,255,255.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
34
The RGB values of Color.ORANGE are:
A) 255,0,0.
B) 255,165,0.
C) 255,0,165.
D) 0,0,0.
E) 255,255,165.
A) 255,0,0.
B) 255,165,0.
C) 255,0,165.
D) 0,0,0.
E) 255,255,165.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
35
Using the Color static method rgb( int rr, int gg, int bb ), how many color combinations can you instantiate?
A) 255
B) 380
C) Around 1,000
D) Around 65,000
E) Around 16.7 million
A) 255
B) 380
C) Around 1,000
D) Around 65,000
E) Around 16.7 million
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
36
JavaFX is the most recent system for building graphical applications using Java.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
37
In JavaFX, the stroke and fill colors must always be the same.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
38
In JavaFX, once we have set the fill color, we can no longer change it.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
39
The strokeLine, strokeRect, and strokeOval methods are all void methods.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
40
The strokeText method is a value-returning method.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
41
The Color class contains Color constants.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
42
Black has RGB values (0, 0, 0).
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
43
JavaFX uses a mixed performance/art metaphor. We start with a(n) __________ and add one or more scenes to it.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
44
To produce graphical output with JavaFX, we draw shapes and text on a(n) __________.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
45
In JavaFX, the name of the class that contains methods we can use to draw shapes is __________.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
46
The current stroke and fill colors are also called the __________ colors.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
47
The names of the methods used to set the current stroke color and current fill color are __________ and setFill, respectively.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
48
RGB stands for __________.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
49
Compare and contrast standard and graphical applications.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
50
How can you draw shapes made of straight lines that are not rectangles?
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
51
CORAL is a constant of the Color class. How do we use it in a program?
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
52
How is the strokeOval( double x, double y, double width, double height ) method related to graphical output?
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
53
Estimate where the point (289, 240) would fall in a rectangle, 300 pixels wide by 250 pixels high.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
54
Can a method call using strokeOval( double x, double y, double width, double height ) be used in an expression?
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
55
How is the clearRect( double x, double y, double width, double height ) method related to graphical output?
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
56
Identify the programming line needed to print "Roses are red, violets are blue" twice on two different lines if the first line is gc.strokeText( "Roses are red", 140, 100 );.
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck
57
Why do you need to imagine a rectangle bounding all sides of the oval or circle in order to draw the figure?
Unlock Deck
Unlock for access to all 57 flashcards in this deck.
Unlock Deck
k this deck