Week 4 - Week 5
ASCII
American Standard Code for Information Interchange, not used in java only has 128 characters
T/F Using the Java API in a program is a rare occurrence
Falsw
What string is printed by the following code if it is executed when the value of finger is 3? switch (finger) { case 1: System.out.println("Thumb"); break; case 2: System.out.println("Index finger"); break; case 3: System.out.println("Middle finger"); break; case 4: System.out.println("Ring finger"); break; case 5: System.out.println("Pinky"); break; default: System.out.println("Not a finger!"); }
Middle Finger
Swing API
Replaced AWT
T.F An alpha channel value of 1.0 represents a fully opaque color.
TRU
T/F Objects created from the Color class are immutable
TRUE
T/F The human eye has three types of color receptors that correspond to wavelengths of red, green, and blue
TRUE
T/F Arial is an example of a font family.
True
T/F Elements of the Java API are organized into packages
True
T/F Full documentation about the Java API can be found online
True
T/F The Java Virtual Machine is software
True
ALU
arithmetic logic unit
what does this line of code do? bigger = (x1 > x2) ? x1 : x2;
assigns larger of x1 and x2 to the variable bigger
Which of the following circles is largest? a new Circle(30, 80, 25) b new Circle(50, 50, 50) c new Circle(150, 175, 45) d new Circle(20, 100, 30)
b
Which of the following lines is horizontal? a new Line(75, 20, 75, 90) b new Line(25, 70, 125, 70) c new Line(30, 30, 50, 50) d new Line(40, 20, 100, 70)
b
Which of the following rectangles extends furthest down? a new Rectangle(80, 25, 100, 130) b new Rectangle(150, 90, 70, 45) c new Rectangle(50, 85, 70, 75) d new Rectangle(100, 50, 50, 100)
c
What software tool is used to translate Java source code into Java bytecode? editor Java Virtual Machine (JVM) compiler interpreter
compiler
Rectangle
new Rectangle(x, y, width, height)
What does an import statement do? Reads data from an input source. Specifies classes that are to be used in a program. Merges the separate elements of a program into one unit. Puts classes into packages.
specifies classes that are to be used in a program
lexicographic ordering
technique of ordering characters based on a character set
break statement
terminates cases in a switch statement break;
root node
the node that contains all other nodes in a scene
stage
the window in which the scene takes place
T/F A break statement is used at the end of each case of a switch statement to keep processing from continuing into the next case.
True
T/F A rectangle's corners can be rounded using calls to the setArcWidth and setArcHeight methods.
True
If the following arc is an ArcType.ROUND arc, which direction would it "point"? That is, where is the center point of the ellipse relative to the arc? new Arc(200, 200, 70, 30, 45, 90) up down right left
down
The von Neumann Model consists of the following components: a hardware, software, data and programs b flash memory, hard disks and network storage c keyboard, mouse, touchscreen and joystick d fetch, decode, execute and store e control unit, arithmetic logic unit, memory, input and output
e
Text
new Text(x, y, text)
If the value of weight is 7, what does the following statement print? System.out.println("The weight is " + ((weight % 2 == 0) ? "even" : "odd")); The weight is even The weight is odd The weight is void The weight is null
weight is odd
Which of the following expressions represents the color white? Color.rgb(255, 255, 255) Color.rgb(100, 0, 0) Color.rgb(0, 0, 0) Color.rgb(100, 100, 100)
255,255,255
If the value of num is 7 and the value of max is 10, what is the value of num after the following statement is executed? num = (max < num) ? max : max - num; 3 4 7 10
3
how many bits are a float and a double
32, 64, with 7 sig dig, and 15 sig dig
What number is printed by the following code? int num = 20; switch (num) { case 1: num = num + 1; break; case 12: num = num + 1; num = num * 2; case 20: num = num * 2; case 25: num = num + 1; break; case 999: num = 20; break; default: num = 999; } System.out.println(num);
41
Unicode
65,536 characters represented, java supports unicode set the first 126 of unicode are the same as ASCII
how many bits are a byte, short, int and long
8, 16, 32, 64
conditional expression
?: instead of a if else made up of a boolean expression followed by a question mark example: x = (y > 0) ? 1 : -1;
T.F Text color is determined by the font applied to a Text object
False
T/F Each value of a case in a switch statement can be a constant, variable, or expression
False
T/F The leftmost end point of a line segment must be specified as the start point of the line.
False
T/F The parameters to the Rectangle constructor represent the upper left corner and lower right corner of the rectangle.
False
T/F The Java Development Kit (JDK) is an example of an integrated development environment (IDE).
False, JDK is a command line environment
T/F When creating a Text object, you specify the position on which you want the text centered.
False, coordinates specify where the leading left edge of the text begins
T/F If left unspecified, the font applied to a Text object is 12 point Lucinda Grande
False, default depends on the operating system of the program
T/F John von Neumann is known for the observation that the number of transistors that fit on a computer chip doubles every year
False, he's known for the general computer design used by most computers today
T.F The JavaFX Image class does not currently support the PNG image format
False, image class supports gif jpg png and bmp
T/F The expression in a switch statement can be an int or double value
False; can only be int char or enumeration (no floating points)
T.F The font applied to a Text object determines whether that text is underlined or not
False; underlining is accomplished using setUnderline method
T.F An Image object cannot be displayed directly in a scene
True
T.F An image can be loaded into an Image object from a web page
True
T.F Setting a viewport does not change the underlying image
True
T.F Whether text is displayed in bold or italic type is a function of the font object applied to the text
True
T/F A switch statement can always be rewritten as a series of nested if statements
True
T/F An ImageView can be used to set the size at which an image is presented
True
T/F Switch statements can only test equality; they cannot make relational comparisons like greater than (>).
True
T/F The Text class and the Font class are part of the same package.
True
T/F Java source code cannot be executed directly by a computer.
True must be parsed into byetcode
The main method of a Java program must have which of the following method headers? a public static void main(String[] args) b public static int main() c public abstract void main(String[] args) d private abstract void main()
a
What does the following statement print? System.out.println((count < 0) ? "Invalid" : count); a) The value of count, or "Invalid" if count is negative. b) The value of count, or "Invalid" if count is positive. c) Zero, or "Invalid" if count is positive. d) Zero, or "Invalid" if count is negative.
a
Which of the following ellipses is also a circle? a new Ellipse(100, 200, 55, 55) b new Ellipse(95, 120, 95, 120) c new Ellipse(150, 150, 150, 100) d new Ellipse(70, 70, 100, 70)
a
What is the Java API? A large library of classes A set of program testing routines A set of data conversion techniques A graphical interface to a Java program
a large library of classes
What does the fourth parameter in this method call represent? Color.rgb(100, 100, 200, 0.65); The primary color ratio The alpha channel (transparency) The key color (black) contribution The color's hue
alpha channel
Which assignment statement is functionally equivalent to the following if statement? if (num1 > total) num1 = total; else num1 = 0; a) num1 = (total > 0) ? 0 : total; b) num1 = (num1 > total) ? 0 : total; c) num1 = (num1 > total) ? total : 0; d) num1 = (num1 > 0) ? total : 0;
c
Which of the following ellipses is thinner than it is tall? a new Ellipse(150, 135, 80, 60) b new Ellipse(90, 90, 60, 55) c new Ellipse(140, 100, 20, 50) d new Ellipse(270, 300, 180, 100)
c
non-printable characters
characters like newline which have no visual symbol
Supplementary Characterse
characters that don't map to the fixed width (16 bit) unicode encoding
layout pane
manages visual presentation of the nodes
Which of the following arcs is the same as this one? new Arc(200, 220, 80, 50, 40, 140) new Arc(100, 200, 80, 50, 40, 140) new Arc(200, 220, 50, 80, 40, 140) new Arc(200, 220, 80, 50, -40, -140) new Arc(200, 220, 80, 50, -180, -140)
new Arc (200, 220, 80, 50, -180, -140)
Arc
new Arc(centerX, centerY, radiusX, radiusY, startAngle, length)
Circle
new Circle(centerX, centerY, radius)
Ellipse
new Ellipse(centerX, centerY, radiusX, radiusY)
Lines
new Line(startX, startY, endX, endY)
JavaFX
replaced swing allows you to develop rich internet applications (RIA)
If the following arc is an ArcType.ROUND arc, which direction would it "point"? That is, where is the center point of the ellipse relative to the arc? new Arc(150, 250, 100, 150, 160, 40) up down right left
right
Which statement is true about the following two circles? new Circle(50, 120, 50) new Circle(70, 120, 20) They have the same size. They have the same center point. They partially overlap. One fully surrounds the other (but they don't have t he same center point).
same center point
bus
set of wires in a computer system that carry information
label
single GUI element like a button or text and doesn't support user interaction
character encoding
the way characters are stored in memory
Escape sequences
used for characters not in our alphabet such as greek letters
Colors on the RGB scale range from 0 to 255 because..
eight bits can represent 256 different things
T/F Java represents a color using the CMYK color model
false, it uses rgb
GB
gigabyte
word
group of bytes a computer system works on
scene
holds elements of GUI called nodes
A typical Java compiler produces which type of output? Unicode Java bytecode Java source code JDK code
java bytecode
If the following arc is an ArcType.ROUND arc, which direction would it "point"? That is, where is the center point of the ellipse relative to the arc? new Arc(170, 100, 50, 60, -20, 40) up down right lef
left
switch statement
lets you choose which statement will be executed next If statement wiht no else is a one way selector (it's executed or it isn't if else statement is a two way selector (one of two options is chosen) switch is a n way selector (can go any of n selections)
Abstract Windowing toolkit (AWT)
library of classes ued to managed graphics and graphical user interfaces (GUIs) limited in scope and wasn't sufficient for large scale projects
Character set
list of characters that can be used in a language