Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
167 Cards in this Set
- Front
- Back
Software objects share two characteristics of ________ and ___________. |
State, behavior |
|
Benefits of modeling using objects in software include. |
All of the above (Code re-use, Information-hiding, Modularity, Pluggability and debugging ease) |
|
The purpose of a class in object-oriented programming environment is to model the state and behavior of a real-world object. |
True |
|
In object-oriented terms what is used as a blueprint to model a real-world object? |
Class |
|
Object-oriented programming allows for inheritance so commonly used state and behavior can be reused. The class that is inherited from is the _______ and the new class is the ______. |
Superclass, Subclass |
|
A declaration statement declares a variable. The following code is a correct example of a declaration statement: double value = 100; |
True |
|
How many superclasses can a subclass extend when using inheritance in object-oriented programming using the Java programming language? |
One |
|
When using inheritance what does the new class inherit when it is derived from another class? |
State, Behavior |
|
When implementing an interface in object-oriented programming all ________ must be included in the source code for the class to compile. |
Methods |
|
What programming best practice should be used when identifying state and behaviors that are derived from another class or defined locally in the new class? |
Comment the code |
|
Local variables are commonly used in methods to store a temporary state. Local variables are visible _________. |
Between the opening and closing braces of the method where they are declared. |
|
Given the signature for the required main method in the Java programming language, public static void main (String[] args), what is args called from a variable perspective? |
Parameter |
|
Compound assignment operators combine an arithmetic operator with the _______ operator. |
= |
|
An expression can comprise |
A, B, and C (Variables, Operators, Method invocations) |
|
An expression statement forms a complete unit of execution with a terminating semicolon. The following code is a correct example of an expression statement: Bicycle myBike = new Bicycle() |
False |
|
Regarding source code, a block is a group of ()... n statements balanced between _____. |
{ } |
|
When using the switch decision-making statement the break statement is required. |
False |
|
Control flow statements in source code files break up the flow of execution and allow for programs to execute blocks of code _______. |
Conditionally |
|
Which of the following is considered a decision-making statement? |
All of the above (if, if/else, if/else if/else, switch) |
|
Which of the following is considered a looping statement? |
A, B, and C (for, while, do/while) |
|
Which of the following is NOT considered branching statements? |
goto |
|
When using the if/else if decision-making statement the else leg is not required. |
True |
|
When declaring a class which of the following components are REQUIRED? |
A and B (Class name, Class Body using {}) |
|
Within a class, a method declaration has up to six components, The REQUIRED elements of a method declaration include _____, _____, _____, _____. |
Method's return type, name, (), {} |
|
What are the components of a method declaration that comprise the method signature? |
Method name and method parameter list |
|
The object-oriented concept of software reuse allows a class to be created once and used ______. |
As many times as desired to include extending it using inheritance |
|
A unique aspect of some object-oriented programming languages is not having to explicitly declare a class constructor. this is true with the Java programming language. When instantiating an instance of a class and a class constructor has not been explicitly declared how is the following source code valid? Bicycle bike1 = new Bicycle(); |
The compiler automatically provides a no-argument constructor |
|
If a class explicitly declares a constructor that takes 0....n parameters when instantiated what happens to the default constructor of the class? |
It no longer exists |
|
The Java Application Programming Interface (API) includes predefined classes grouped into categories of related classes. |
True |
|
Select the statement that is true about Java programming language. |
All of the above (Java is case sensitive, White space is not ignored, Semicolons must be used at the end of variable) |
|
If there are an unknown number of parameters being passed to a method a software developer can use a construct called _______. |
varargs |
|
The ternary operator takes three operands and uses the (?:) notation. What control structure does the ternary operator mimic? |
If/else |
|
Which of the following is NOT valid regarding methods calls in the Java programming language? |
All methods are automatically public so they can be called whenever throughout a program |
|
Regarding object-oriented programming, declaration means that a variable name is associated with an object type and creates an object of that type. |
False |
|
When method parameters have the same name as class fields this is called ___________. |
Shadowing |
|
When having to programmatically differentiate a parameter having the same name as a field of a class what keyword can resolve this issue with the compiler when setting the field value equal to the argument value passed into the method? |
this |
|
Regarding object-oriented programming, when an object is instantiated the keyword new is used, memory is allocated, and a reference to that memory is returned. |
True |
|
How are primitive and reference data arguments pass into a method? |
By value |
|
An interface can and should be instantiated |
False |
|
A method in Java can return primitive data types, __________, or __________. |
class, interface |
|
What is used in the java programming language to organize classes and interfaces in a logical manner? |
Package |
|
When defining an interface in the object-oriented programming language Java it can comprise which of the following? |
All of the above (Constants, Keyword "interface", Default methods, Modifiers) |
|
The keyword this is used to reference _______. |
The current object |
|
An array is a container object to that holds a _______ number of values of a ________ data type. |
Fixed, single |
|
To create a static method in the Java programming language the modifier __________ must be used in the declaration. |
Static |
|
Returning a value from a method that is declared with a return type of void results in a compiler error. |
True |
|
Unary operators _________. |
Both B and C (Require one operand, Are used for incrementing/decrementing a value by one) |
|
The length of an array is established when the array is created. |
True |
|
Which of the following declares an array correctly from a syntax perspective? |
Both B and C (String[] stringArray; String stringArray[];) |
|
Operators are special symbols that perform specific operations on _________ operands, and return a result. |
One, two, or three |
|
Operators with higher precedence are evaluated _______ operators with relatively _____________ precedence. |
Before, lower |
|
Each item in an array is called an ___________ and to access them programmatically user an ______. |
Element, index |
|
When defining classes in the Java programming language a software developer can extend ________ superclasses and implement ________ interfaces. |
One, unlimited |
|
A class that uses an explicitly constructor invocation uses the keyword this to _______. |
Call another constructor in the same class |
|
When a method has a return type other than void what data type can be returned from that method? |
The returned data type must match the declared return data type |
|
Access level modifiers define how other classes can reference a field or invoke a method |
True |
|
What are the two required components of an array declaration in the Java programming language? |
Type and name |
|
When does a method return to the code that invoked it? |
A, B or C (Completes all the statements in the method, Reaches a return statement, Throws and exception) |
|
Polymorphism refers to a principle in biology in which an organism or species can have many different forms or stages. |
True |
|
Static fields of a class are common to all objects. |
True |
|
The content pan of a top-level container (i.e. JFrame, JDialog, JApplet) is the container where the root pane's visible components are comprised, excluding the ________. |
JMenuBar |
|
When defining an interface in the object-oriented programming language Java it can comprise which of the following? |
All of the above (Constants, Keyword "interface", Default methods) |
|
An ActionListener is equivalent to an event handler. |
True |
|
When writing an ActionListener there are specific steps that should be followed. Select the correct combination of steps. |
A, B and C (Declare an even handler class that implements the ActionListener interfact, Register an instance of the defined event handler class on one or more components, Ensure the class that implements interface ActionListener includes method public void actionPerformed(ActionEvent e) {} ) |
|
An interface can and should be instantiated. |
False |
|
Which of the following are valid class member access levels? |
All of the above (public, package-private, private) |
|
The keyword this is used to reference ________. |
The current object |
|
The javax.swing and javax.swing.event, or Swing API, has 18 public packages that group features for developing user interfaces, this is known as part of the ________. |
Java Foundation Classes (JFC) |
|
JDialog is one of the three top-level containers |
True |
|
What are the options for the JDialog setDefaultCloseOperation? |
All of the above (DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE, DISPOSE_ON_CLOSE) |
|
A JOptionPane implementation uses a JDialog behind the scenes |
True |
|
Which of the following is NOT one of the four standard icons supported by JOptionPane? |
Alert |
|
GridBagLayout layout manager uses ____ to specify the size and position characteristics of its components. |
GribBagConstraints |
|
Which java programming language layout manager arranges the components into rows and columns using equal-sized rectangular grid? |
GridLayout |
|
GridBagLayout layout manager allows for components to span multiple rows and columns |
True |
|
When adding components to a JPanel using the FlowLayout layout manager how are the components placed if not specified? |
Left to right in the order they were added |
|
Which layout manager is the default layout for class javax.swing.JPanel? |
FlowLayout |
|
BoxLayout allows the developer to do which of the following? |
Align components |
|
GridBagLayout is the most flexible layout manager as well as one of the most simple. |
False |
|
CardLayout is often controlled by a JComboBox in order to determine which ______ to display. |
Panel |
|
Which of the following is not one of the 5 legacy compass-based areas of the BoarderLayout layout manager class? |
LEFT |
|
By default a JOptionPane creates JDialogs that are modal. |
True |
|
CardLayout allows for implementing an area that contains different components at different times. |
True |
|
Two of the six layout managers provided by the Java API were designed with the intent to use them with GUI builder tools, they are _______ and ___________. |
SpringLayout, GroupLayout |
|
Which of the following statements is true regarding when to use a JTextArea? |
To display multiple lines of text that optionally allow the user to edit the text |
|
JTextArea is customizable, if the developer wanted to allow line wrapping which method would be called? |
textArea.setLineWrap(true); |
|
Which of the legacy locations for the 5 BorderLayout areas is still maintained in the perferred standard to adjust to languages with different orientations instead of points of a compass? |
CENTER |
|
Which layout manager is the default layout for the 3 top-level container classes in the javax.swing package? |
BorderLayout |
|
The JDialog class is a subclass of the java.awt.Dialog class |
True |
|
When a JDialog is set to be modal and is visble it does NOT block input to all other windows in the application |
False |
|
When using FlowLayout, if the width of a container is not wide enough to accommodate all the components in a single row how does the layout manager respond? |
Starts a new row |
|
When using the JDialog constructor defined with two parameters where the second parameter is data type boolean, the second parameter sets if the JDialog is __________. |
Modal |
|
The layout above that places components in 5 specific areas is representative of which layout manager? |
BorderLayout |
|
When declaring a constant in the Java programming language which keyword(s) ensures that the value of the constant cannot be changed? |
final |
|
A popup menu bar is _______ until the user invokes the appropriate commands to make it appear |
Invisble |
|
To add a clickable button to a user interface the javax.swing class JButton is commonly used. Which of the following statements is true about the class JButton? |
A JButton instance can display its text in a different place relative to its image |
|
The purpose of writing ActionListeners is to define what code should be executed when the application fires a specific ActionEvent. |
True |
|
Each of the 3 top level container classes has a content pane that contains the visible components in its container user interface. |
True |
|
Which method would be called on a top-level container if the software developer wanted to explicitly set the content pane? |
setContentPane(somePane) |
|
What is the key purpose of default methods regarding interfaces? |
Allows for binary compatibility with previously written code while providing the opportunity to add new functionality |
|
actionPerformed(ActionEvent) is the only method that is required to be implemented when implementing the ActionListener interface in Java. |
True |
|
Menus in the Java programming language are unique as they aren't placed with the other components in the user interface |
True |
|
With the exception of the three top-level containers all Swing components that start with the letter "J" descend from the _________ class. |
JComponent |
|
Java Swing text components only display texts and do not allow for the user to edit the text |
False |
|
By default a JTextArea is editable |
True |
|
The layout above that displays components from left to right in the order they were added to the user interface is representative of which layout manager? |
FlowLayout |
|
The layout above that displays components in a row/column format with each component being of equal size is representative of which layout manager? |
GridLayout |
|
What is the direct superclass for class BattleshipUI? |
JFrame |
|
Which menu component is set on the JFrame instance? |
JMenuBar |
|
When using menus, what is the order that menu components are added to each other? |
Add a JMenuItem to a JMenu, add a JMenu to a JMenuBar |
|
What is the code at line 58 called? |
Overridden no-argument constructor |
|
What is the purpose of the method initComponents() defined starting at line 65? |
Initializes the components that are part of class BattleshipUI |
|
If line 68 were not included and the user closed the UI, what happens to the application processing in the background? |
It keeps running |
|
Line 86, 91, 96, 101, 108, 112, 118, 126, and 130 all call the method addActionListener(). What is the purpose of this method? |
To register an action listener |
|
JLabels display text and they are also editable during run time. |
False |
|
Line 265 defines method getThisParent(), what is this method doing? |
Returning the reference to the instance of class BattleshipUI using keyword this |
|
Line 327 is the definition for private class ShipListener. In the actionPerformed(ActionEvent e) method what is the source code evaluating? |
Which item in the JComboBox was selected |
|
Line 368-370 of the source code are doing what? |
Disabling the relative JComponents (i.e. JButton and JComboBox) |
|
What is the data type of attribute billValid? |
BillValid |
|
What is the name of the class where data type BillValid is defined? |
Enumerations
|
|
What value does the instance of class Random have to return from method randomNumber.nextInt(100) to set attribute billValid equal to the enumerated value of BillValid.FALSE? |
50 |
|
Where is attribute sensors instantiated? |
In the custom constructor CentralComputer() |
|
When writing an inline comment to either document the source code or insert TODO statements for work that needs to be done the appropriate format is _______. |
// this is an inline comment |
|
What is the data type of the return value in method getProductSelected()? |
String |
|
In method setProductSelected(String aProductSelected), when the substring(1) method is called on attribute productSelected, the 1 indicates _____.
|
1 is the start index. |
|
In method setProductSelected(String aProductSelected), what is the purpose method call Integer.parseInt(productSelected.substring(1))? |
Converts a String to an int |
|
In method setProductSelected(String aProductSelected), if the user selected a product that had a count greater than 0 and they entered greater than or equal to the price of the product, what state is the VendingMachine application's CentralComputer set to? |
VendingState.DISPENSED |
|
Method setState is defined with one parameter. What is the data type of the parameter |
VendingState |
|
In method setMoneyEntered() what message is displayed to the user when the conditional if(billValidator.getBillValid()) equals BillValid.FALSE? |
Bill not valid, try again! |
|
In the method setMoneyEntered() what message is displayed to the user when the conditional if(coinIdentifier.getCoinValid()) equals CoinValid.TRUE? |
No message |
|
In method setProductSelected() what message is displayed to the user when the conditional if(moneyEntered >= productManager.getProductPrice(row, column) evaluates false? |
Enter more funds |
|
In method setProductSelected() what message is displayed to the user when the conditional if(productManager.getProductCount(row, column) evaluates false? |
Product out of stock, select again |
|
What is the data type of attribute coinValid? |
CoinValid |
|
What is the name of the class where data type CoinValid is declared? |
Enumerations |
|
Method getCoinValid() casts parameter value to an instance of which class? |
BigDecimal |
|
What is the conditional if statement if(cents.inValue() % 5 == 0) evaluating? |
If the integer value of cents divided by 5 results in a remainder of 0 |
|
What key word is used when declaring an enumeration? |
enum |
|
Unless otherwise defined what is the int value of the first member of the enumeration? |
0 |
|
What are the data types of the two parameters defined in the custom constructor? |
int, double |
|
What is the return type of method setCount(int count)? |
void |
|
When declaring a two-dimensional array and you are not initializing the data during declaration, you must explicity set the size of the ________. |
rows |
|
When using indexes to reference an element in array productData[0][2]. value 0 is the _______ and value 2 is the________. |
row, column |
|
Given the class definition of ProductManager, how does the two-dimensional array productData get initialized with instances of class Product? |
The custom constructor ProductManager() is called when instantiating an instance of the class which calls method initializeData(). |
|
What is the data type of the array productData? |
Product |
|
What method from class Product is called in method getProductCount()? |
getCount() |
|
What method from class Product is called in method dispenseProduct()? |
setCount() and getCount() |
|
What method from class Product is called in method repriceProduct()? |
setPrice() |
|
Information hiding is accomplished in class Sensors by creating _____________ and _________ to access the class attributes. |
Getters, setters |
|
What is the data type of attribute dispensed? |
Dispensed |
|
What layout manager is used to display the objects on the JPanel? |
GridBagLayout |
|
When defining custom constructor Keypad() what happens to the default constructor of the class? |
It no longer exists |
|
Object moneyEntered calls method .setBorder() to set its border using which class? |
BorderFactory |
|
What is the term to describe what is happening when calling method .addActionListener(new KeyPressAction()) for each of the letter, number, and dot JButtons? |
Registering the event handler |
|
What is the name of the inner class declared to handle events fired when JButton money is clicked? |
MoneyAction |
|
Method setProductBin() calls method setProductBin() defined in class _____________. |
CentralComputer |
|
Inner class KeyPressAction implements which interface? |
ActionListener |
|
What executable statement is performed if e.getActionCommand() equals a period (or dot)? |
JButton dot is disabled |
|
When the VendingMachine application's CentralComputer is in state VendingState.PRODUCT, to accept the e.getActionCommand() input as part of attribute product when the user clicks the A, B, C, or D JButton, what other condition must be true? |
Attribute product is equal to an empty String |
|
When evaluating the length of attribute product being greater than 0 and less than 2 the correct syntax for the and condition is |
&& |
|
Inner class MoneyAction implements interface ActionListener, as a result it must override method _________. |
actionPerformed(ActionEvent e) |
|
Inner class MoneyAction is registered to a single JButton. When the text on the JButton equals "Finished" what is it updated to? |
Enter Money |
|
Method imageResize() is defined to receive one parameter, it also returns a value, what is the data type for the parameter and return type? |
ImageIcon |
|
Method imageResize() calls what method from class Image to resize the image based on specified pixel size? |
getScaledInstance() |
|
Constructor ProductBin() is the default constructor created by the compiler |
false |
|
What class is used to set the preferred size of object bin? |
Dimension |
|
What would be the runtime result if method keypad.setProductBin(productBin) was called before the instance of ProductBin() was instantiated? |
The application would throw a NullPointerException |
|
What is the significance of class VendingMachine.java in the overall VendingMachine application |
All of the above (VendingMachine instantiates an instance of VendingMachineUI which invokes the user interface of the application, VendingMachine contains the public static void main(String[] args) method that must be defined in order for the Java Virtual Machine to start the application, VendingMachine is the emply point into the VendingMachine application during runtime) |