Java Final exam

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

If you do not provide an access specifier for a class member, the class member is given ________ access by default.

package

Of the following, which would be considered the no-arg constructor for the Rectangle class?

public Rectangle()

The Application class's ________ method is the main entry point for a JavaFx application.

start

true/false As an alternative for manually typing the code for the controller class, Scene Builder can provide a sample "skeleton" for the controller class.

true

Which of the following does not belong in a JavaFX scene graph?

trunk node

When you make a copy of the aggregate object and of the objects it references,

you are performing a deep copy.

When an array is passed to a method

All of these

Which of the following are used as delimiters if the StringTokenizer class's constructor is called and a reference to a String object is passed as the only argument?

All of these

Which of the following is true concerning the sample controller skeleton provided by Scene Builder?

All of these

In JavaFX, this component is commonly used as a GUI's root node.

AnchorPane

The ________ class is the wrapper class for the char data type.

Character

Unchecked exceptions are those that inherit from the

Error class or the RuntimeException class.

All of the exceptions that you will handle are instances of classes that extend this class.

Exception

This is a markup language that describes the components in a JavaFX scene graph.

FXML

True/false If a string has more than one character used as a delimiter, we must write a loop to determine the tokens, one for each delimiter character.

False

true/false The String class's valueOf method accepts a string representation as an argument and returns its equivalent integer value.

False

true/false The names of the enum constants in an enumerated data type must be enclosed in quotation marks.

False

true/false The throw statement informs the compiler that a method throws one or more exception.

False

true/false The throws clause causes an exception to be thrown.

False

true/false You can declare an enumerated data type inside of a method.

False

true/false You cannot assign a value to a wrapper class object.

False

A(n) ________ is a method that appears in a superclass, but expects to be overridden in a subclass.

abstract method

You can use this ArrayList class method to insert an item at a specific location in an ArrayList.

add

All fields declared in an interface

are treated as final and static.

true/false You show inheritance in a UML diagram by connecting two classes with a line that has an open arrowhead that points to the subclass.

false

Classes that inherit from the Error class are

for exceptions that are thrown when a critical error occurs, and the application program should not try to handle them.

This is a name that identifies a component in the FXML file and will also become a variable name that you can use later in the Java code that you will write to run the application.

fx:id

When you write a method that throws a checked exception, you must

have a throws clause in the method header.

The following import statement is required to use the ArrayList class:

import java.util.ArrayList;

Which of the following import statements is required to use the StringTokenizer class?

import java.util.StringTokenizer;

A class that is defined inside of another class is called a(n)

inner class.

What is the value of scores[2][3] in the following array?

94

Once you have created a GUI with Scene Builder, and saved it to an FXML file, you need to write a Java class that performs which of the following?

All of these

The StringBuilder class's insert method allows you to insert into the calling object's string

All of these

The catch clause

All of these

You can use the enum key word to

Both create your own data type and specify the values that belong to that type

Although these are often displayed in groups, they are not usually grouped in a toggle group like RadioButtons are.

CheckBoxes

CRC stands for

Class, Responsibilities, Collaborations.

This section of the Inspector Panel allows you to register the controller class and event listeners with the GUI.

Code

This is a component that can hold other components inside of it.

Container

In a catch statement, what does the following code do? System.out.println(e.getMessage());

It prints the error message for an exception.

If a subclass constructor does not explicitly call a superclass constructor,

Java will automatically call the superclass's default constructor just before the code in the subclass's constructor executes.

The Scene Builder ________ provides a list of JavaFX components that you can use in an application.

Library Panel

When a class does not use the extends key word to inherit from another class, Java automatically extends it from the ________ class.

Object

Which of the following statements converts a double variable named tax to a string and stores the value in the String object variable named str?

String str = Double.toString(tax);

The String[] args parameter in the main method header allows the program to receive arguments from the operating system command line.

True

To determine if two arrays are equal, you must compare each of the elements of the two arrays.

True

true/false If a class has a method named finalize, it is called automatically just before an instance of the class is destroyed by the garbage collector.

True

true/false In a try statement, the try clause must appear first, followed by all of the catch clauses, followed by the optional finally clause.

True

If ClassC is derived from ClassB, which is derived from ClassA, this would be an example of

a chain of inheritance.

When a method's return type is an object, what is actually returned to the calling program?

a reference to an object of that class

If a method does not handle a possible checked exception, what must the method have?

a throws clause in its header

A static field is created by placing the key word static

after the access specifier and before the field's data type.

The following catch clause catch (Exception e)

can handle all exceptions that are instances of the Exception class or one of its subclasses.

In the ________ file format, when the data in a spreadsheet is exported, each row is written to a line, and the values in the cells are separated by commas.

comma separated value

In a UML diagram, you show a realization relationship by connecting a class and an interface with a

dashed line that has an open arrowhead at one end.

A declaration for an enumerated type begins with this key word.

enum

A(n) ________ is a method that automatically executes when a specific event occurs.

event listener

A(n) ________ is an object that is generated in memory as the result of an error or an unexpected event.

exception

The JVM periodically performs this process to remove unreferenced objects from memory.

garbage collection

In object-oriented programming, ________ allows you to extend the capabilities of a class by creating another class that is a specialized version of it.

inheritance

You can use this operator to determine whether an object is an instance of a particular class.

instanceof

When a class implements an interface, an inheritance relationship known as ________ is established.

interface inheritance

In the controller class, you can use the CheckBox's ________ method to determine whether the CheckBox is selected or not.

isSelected

When the this variable is used to call a constructor

it must be the first statement in the constructor making the call

To return an array of long values from a method, use this as the return type for the method.

long[ ]

Because only one RadioButton in a toggle group can be selected at any given time, the buttons are said to be this.

mutually exclusive

Any ________ argument passed to the Character class's toLowerCase method or toUpperCase method is returned as it is.

nonletter

By default, a reference variable that is an instance field is initialized to the value

null.

If numbers is a two-dimensional array, which of the following would give the number of columns in row r?

numbers[r].length

When a field is declared static, there will be

only one copy of the field in memory.

A subclass can directly access

only public and protected members of the superclass.

In Java, a reference variable is ________ because it can reference objects of types different from its own, as long as those types are related to its type through inheritance.

polymorphic

Which of the following statements declares Salaried as a subclass of PayType?

public class Salaried extends PayType

Which of the following is a correct method header for receiving a two-dimensional array as an argument?

public static void passMyArray(int[ ][ ] myArray)

All methods specified by an interface are

public.

The ________ method removes an item from an ArrayList at a specific index.

remove

You can use the ________ method to replace an item at a specific location in an ArrayList.

set

To change the image being displayed in an ImageView component as the application is running, you pass a reference to an Image object as an argument to this method.

setImage

A(n) ________ is used as an index to pinpoint a specific element within an array.

subscript

The Character wrapper class provides numerous methods for

testing and converting character data.

In order to do a binary search on an array,

the array must first be sorted in ascending order.

In a class hierarchy

the more general classes are toward the top of the tree and the more specialized classes are toward the bottom.

The only limitation that static methods have is

they cannot refer to nonstatic members of the class.

true/false Because every class directly or indirectly inherits from the Object class, every class inherits the Object class's members.

true

true/false Because the subclass is more specialized than the superclass, it is sometimes necessary for the subclass to replace inadequate superclass methods with more suitable ones.

true

true/false Once you have written and compiled the controller class, you must go back into Scene Builder and register the controller class to the application's GUI.

true

true/false You can use JavaFX to create standalone graphics applications that run on your local computer, applications that run from a remote server, or applications that are embedded in a Web page.

true

In Java, there are two categories of exceptions:

unchecked and checked.

The sequential search algorithm

uses a loop to sequentially step through an array, starting with the first element.

The String class's ________ method accepts a value of any primitive data type as its argument and returns a string representation of the value.

valueOf

Java provides a mechanism known as ________, which makes it possible to write a method that takes a variable number of arguments.

variable-length argument lists

The "has a" relationship is sometimes called a(n) ________ because one object is part of a greater whole.

whole-part relationship

If object1 and object2 are objects of the same class, to make object2 a copy of object1

write a method for the class that will make a field by field copy of object1 data members into object2 data members.

When one object is a specialized version of another object, there is this type of relationship between them.

"is a"

If a program does not handle an unchecked exception, what is the result?

The program is halted and the default exception handler handles the exception.

If the following is from the method section of a UML diagram, which of the following statements is true? + equals(object2:Stock) : boolean

This is a public method that accepts a Stock object as its argument and returns a boolean value.

In the controller class, you can use the RadioButton's ________ method to determine whether the RadioButton is selected or not.

This is an action that takes place within a program, such as the clicking of a button.

Objects in an array are accessed with subscripts, just like any other data type in an array.

True


संबंधित स्टडी सेट्स

BIO 320- CONGENITAL & GENETIC DISORDERS

View Set

Unit 15: Insurance-based Products (NOT DONE)

View Set

Chapter 23: The Child with Gastrointestinal Dysfunction

View Set

FA chapter 6 Accounting for Sales MC+T/F

View Set