Object Oriented Programming (with Java)

Ace your homework & exams now with Quizwiz!

Given a window that is 640 (width) by 480 (height), which of the following represents the lowest position on the left side?

(0, 479)

Which of the following creates a custom style class that will allow a Button control to appear with a blue background and yellow text?

.button { -fx- background-color:blue; -fx- text-fill: yellow; }

Select all that apply. Given the statement shown below, which of the following statements are true?Scene scene = new Scene(hbox, 100, 500);

A Scene object named scene will be created., The width of the scene will be 100 pixels., The root node is hbox.

What happens when the following code is executed?: ComboBox<string> myComboBox = new COmboBox<>(); myComboBox.getItems().addAll(5, 10, 15, 20);

A compiler error will occur.

Select all that apply. Which of the following are constructors of the Rectangle class?

A.Rectangle(width, height) B.Rectangle(X, Y, width, height)

To build a menu system you must:

A.create the Menu objects and register an event handler for each menu item object. B.Add the MenuBar object to the scene graph. C.create a MenuBar object. D.All of these are necessary steps.

When you run the following program, what will happen?: public class Test extends Thread { public static void mai(String[] args){ Test t = new Test(); t.start(); t.start(); } public void run() { System.out.println("test"); } }

An illegal java.lang.IllegalThreadStateException may be thrown because you just started thread and thread might have not yet finished before you start it again.

The foundation of a GUI application is the

Application class.

The ________ arc type causes a straight line to be drawn from one endpoint of the arc to the other endpoint.

ArcType.CHORD

Select all that apply. Which of the following are transition classes? A.RunTransition B.StrokeTransition C.RotateTransition D.FadeTransition

B.StrokeTransition C.RotateTransition D.FadeTransition

Select all that apply. Which of the following file types are supported by the Image class?

BMP, PNG, JPEG, GIF

Select all that apply. Which of the following are constructors of the BorderPane class?

BorderPane(center), BorderPane(center, top, right, bottom, left), BorderPane()

Which of the following will create a CheckBox that displays pizza and shows up as selected?

CheckBox checkOne = new CheckBox("pizza");checkOne.setSelected(true);

Which of the following creates a blue circle centered at X = 50, Y = 50 with a radius of 50?

Circle blueCircle = new Circle(50, 50, 50);blueCircle.setFill(Color.BLUE);

Which of the following statements loads the JDBC-ODBC driver?

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")

Invoking Class.forName method may throw ________.

ClassNotFoundException

Which effect class do you use to increase an image's brightness?

ColorAdjust

To connect to a local MySQL database named test, use ________.

Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/test");

Which of the following is not a way a user can interact with a computer? A. console interface B. GUI C. command line D. All of these are ways a user can interact with a computer.

D. All of these are ways a user can interact with a computer.

What string lists the protocol that should be used to access a database, the name of the database, and potentially other items?

Database URL

Which class specifies the amount of time an animation should last?

Duration

To create an animation in which a node fades in or out over a period of time, use the ________ class.

FadeTransition

In a window that is 640px wide by 480px high, the top right X, Y coordinates would be (0, 480).

False

Radio buttons are normally used when you want the user to be able to select one or more options from a group of several possible options.

False

The BorderPane container always displays its content in five regions which are top, bottom, left, right, and center and each region must be used.

False

The Rotate class creates a rotating animation.

False

To create a circle, you need to specify only the X and Y coordinates of the center point.

False

To make a node half its original size, you pass the setScaleX method the value 2 and pass the setScaleY method the value 0.5.

False

On a Web page, the ________ specifies what information to display and the ________ specifies how that information should be displayed.

HTML, CSS

Suppose that your program accesses MySQL or Oracle database. Which of the following statements are true?

If the driver for MySQL and Oracle are not in the classpath, the program will have a runtime error, indicating that the driver class cannot be loaded. If the database is not available, the program will have a runtime error, when attempting to create a Connection object.

To create an InputStream on a socket s, you use ________.

InputStream in = s.getInputStream();

What does the following code snippet do?

It creates a circle with center point (50, 50), radius = 25, and duration = 5 seconds.

What does JDBC stand for?

Java database connectivity

Select all that apply. Which of the following nodes are allowed in a scene graph?

Leaf, Root, Branch

Which of the following code snippets creates a Line and uses a RotateTransition object to animate it for seven seconds?

Line myLine = new Line(25, 50, 100, 50); RotateTransition rtans = new RotationTransition(ew Duration(7000), myLine);

The control that displays a list of items and allows the user to select an item from the list is the ________ control.

ListView

Which mouse event occurs when the user presses and releases the mouse button?

MOUSE_CLICKED

The ________ class is used to create a menu bar.

MenuBar

The type of control normally used when you want the user to only be allowed to select one option from several possible options is the

RadioButton.

What is the default concurrency level of a ResultSet object?

Read-only

Which class creates an animation in which a node rotates?

RotateTransition

The standard language for working with database management systems is ________.

SQL

Which transition class causes a node to become larger or smaller?

ScaleTransition

Which of the following statements creates a Slider with a range of 1 to 20 with a starting value of 1?

Slider slider = new Slider(1.0, 20.0, 1.0);

The client requests a connection to a server by using which of the following statements?

Socket s = new Socket(ServerName, port);

The server listens for a connection request from a client by using which of the following statements?

Socket s = serverSocket.accept()

To create a statement on a Connection object conn, use ________.

Statement statement = conn.createStatement();

Which of the following statements creates an empty TextArea?

TextArea textArea = new TextArea();

________ models an IP address, which can be used to find the host name and IP address of the client.

The InetAddress class

What does the following code do, assuming there is a variable that references a Scene object? myScene.getStylesheets().add("sceneStyles.css");

The getStylesheets method returns an object containing the scene's collection of stylesheets and that object's add method adds

What does the following code snippet do when the animation is played, given that imageView has been created?

The image will be completely opaque when displayed and will decrease to 50% opacity over the five seconds of the animation.

Analyze the following code: ResultSet resultSet = statement.executeQuery("select firstName, mi, lastName from Student where lastName " + "= 'Smith'"); System.out.println(ResultSet.getString(1));

The program will have a runtime error, because the cursor in resultSet does not point to a row. You must use resultSet.next() to move the cursor to the first row in the result set. Subsequently, resultSet.next() moves the cursor to the next row in the result set. resultSet.getString(1) returns the firstName field in the result set.

Adding RadioButton controls to a ________ object creates a mutually exclusive relationship between them.

ToggleGroup

If you have two RadioButtons (dogRadio and catRadio), how should you code them to create a mutually exclusive relationship?

ToggleGroup radioGroup = new ToggleGroup();dogRadio.setToggleGroup(radioGroup);catRadio.setToggleGroup(radioGroup):

Which class is used to move a node from one position on the screen to another?

TranslateTransition

A TextArea is a multiline TextField that can accept or display several lines of text.

True

A polygon, created by the Polygon class is, by default, filled with the color black.

True

CSS uses the RGB color system to define colors and colors can be specified using six hexadecimal numbers preceded by the # symbol.

True

In JavaFX all CSS properties begin with -fx-.

True

In a JavaFX application, a CSS type selector corresponds to a specific JavaFX node.

True

JavaFX provides transition classes that allow the creation of animations by causing a node to change, over time, from one state to another.

True

The FillTransition class works only with objects of the Shape class or one of its subclasses.

True

The following statement will draw the string "Welcome!" starting at the top left corner of the screen.Text welcomeText = new Text(0, 0, "Welcome!");

True

To create a mutually exclusive relationship between RadioMenuItem controls, you must group them in a ToggleGroup object.

True

When the user selects an item in a ListView, a change event occurs.

True

Which of the following do most developers prefer to use when developing applications that work with an intensive amount of data?

a database management system

To connect to a server running on the same machine with the client, which of the following can be used for the hostname?

a."localhost" b."127.0.0.1" c.InetAddress.getLocalHost(),

Which of the following are interfaces?

a.Connection b.Statement c.ResultSet

You can use the ________ method to temporarily release time for other threads.

a.sleep(long milliseconds) b.yield()

What is the output of the following code?

aaaaabbbbb

A ServerSocket can connect to ________ clients.

an unlimited number of

Which of the following statements are defined in the Object class?

b. wait() c. notify() d. notifyAll() e. toString()

Which of the following statements are true? a.You may load multiple JDBC drivers in a program. b.You may create multiple connections to a database. c.You may create multiple statements from one connection. d.You can send queries and update statements through a Statement object.

b.You may create multiple connections to a database. d.You can send queries and update statements through a Statement object.

Select all that apply. Which of the following are operations that can be performed by the launch method?

calling the start method, creating a Stage object

Select all that apply. Which of the following are regions where content can be displayed in the BorderPane layout container?

center, top and bottom, left and right

Which of the following is a CSS named color?

crimson maroon lavender All of these

Which Statement interface method should be used to execute a SELECT statement?

executeQuery

Which Statement interface method should be used to execute an INSERT statement?

executeUpdate

You can obtain the server's hostname by invoking ________ on an applet.

getCodeBase().getHost()

The ________ method in the InetAddress class returns the IP address.

getHostAddress()

To replace a ListView control's existing items with a new list of items, use the ________ method.

getItems().setAll()

To retrieve text that a user has typed into a TextField control, you call the ________ method.

getText

Which of the following import statements must be used in order to use the Color class?

import.javafx.scene.paint.Color;

One important difference between the command line interface and a GUI interface is that

in a GUI environment the user determines the order in which things happen while the user has no control over the order or events in a command line interface.

Where is com.mysql.jdbc.Driver located?

in a JAR file mysqljdbc.jar downloadable from the book's Companion Website

To display an image in a JavaFX application you must

include both the Image and the ImageView classes.

When creating a server on a port that is already in use, ________.

java.net.BindException occurs

When a client requests connection to a server that has not yet started, ________.

java.net.ConnectionException occurs

A database URL for a MySQL database named test on host panda.armstrong.edu is ________.

jdbc:mysql://panda.armstrong.edu/test

A database URL for an access database source test is ________.

jdbc:odbc:test

You can use the ________ method to force one thread to wait for another thread to finish.

join()

Which of the following statements will allow a user to type input into a field of a ComboBox named myComboBox?

myComboBox.setEditable(true);

To obtain an ObjectInputStream from a socket, use ________.

new ObjectInputStream(socket.getInputStream());

Which of the following expressions must be true if you create a thread using Thread = new Thread(object)?

object instanceof Runnable

In the hexadecimal color value #CCAA99, the CC refers to which color component?

red

In memory, GUI objects in a ________ are organized as ________ in a tree-like hierarchical data structure.

scene, nodes

How would a stylesheet named javafxstyles.css be applied to a JavaFX application, assuming that scene is the variable that refers to a Scene object?

scene.getStylesheets().add("javafxstyles.css");

To change the alignment of an HBox you call the

setAlignment method.

Which of the following method is a static in java.lang.Thread?

sleep(long)

Which of the following methods in Thread throws InterruptedException?

sleep(long)

You can invoke ________ on a Socket object, say socket, to obtain an InetAddress object.

socket.getInetAddress();

SQL stands for

structured query language.

When creating a client on a server port that is already in use, ________.

the client can connect to the server regardless of whether the port is in use

If a BorderPane region does not contain anything,

the region will not appear in the GUI.

You should always invoke the unlock method in the finally clause.

true

In CSS, selector names that begin with a period are called ________ selectors.

type


Related study sets

Філософія Рівень 3

View Set

Athletic injuries Shoulder/ Upper Arm

View Set

Legal/Ethics practice questions (nclex style)

View Set

Fahrenheit 451 multiple choice questions

View Set

Chapter 5 Safety and infection control

View Set