A constructor _____________ parameters. a. Can receive b. Cannot receive c. Must receive d. Can receive a maximum of 10
If you create a class that contains one method, and instantiate two objects, you usually store _____________ for use with the objects. a. One copy of the method b. Two copies of the method c. Two...
Which of the following statements determines the square root of a number and assigns it to the variable s? a. s = sqrt(number); b. s = Math.sqrt(number); c. number = sqrt(s); d. number = Math.sqrt(s);
A LocalDate object _____________. a. Can be displayed as a String b. Contains static fields with data such as the current year c. Is created using a public default constructor d. All of the above
Which of the following expressions correctly returns an integer that represents the month of a LocalDate object named hireDate? a. getMonth(hireDate) b. getMonthValue(hireDate) c....
The logical structure in which one instruction occurs after another with no branching is a ____________. a. Sequence b. Selection c. Loop d. Case
Which of the following is not a type of if statement? a. Single-alternative b. Dual-alternative c. Reverse d. Nested
What is the output of the following code segment? t = 7; if(t > 7) { System.out.print("AAA"); System.out.print("BBB"); } a. AAA b. BBB c. AAABBB d. Nothing
Assuming a variable w has been assigned the value 15, what does the following statement do? w == 15 ? x = 2 : x = 0; a. Assigns 15 to w b. Assigns 2 to x c. Assigns 0 to x d. Nothing
What does the following statement output? for(a = 0; a < 5; ++a) System.out.print(a + " "); a. 0 0 0 0 0 b. 0 1 2 3 4 c. 0 1 2 3 4 5 d. Nothing
In each case, determine the problem and fix the program. After you correct the errors, save each file using the same filename preceded with Fix. For example, save DebugSix1.java as FixDebugSix1.java....
If String myFriend = new String("Ginny");, which of the following has the value 1? a. myFriend.compareTo("Gabby"); b. myFriend.compareTo("Gabriella"); c. myFriend.compareTo("Ghazala"); d....
The String class replace() method replaces ____________. a. A String with a character b. One String with another String c. One character in a String with another character d. Every occurrence of a...
The difference between int and Integer is ____________. a. Int is a primitive type; Integer is a class b. Int is a class; Integer is a primitive type c. Nonexistent; both are primitive types d....
You created a class named Game that included two Team objects that held data about teams participating in a game. Modify the Game class to set the game time to the message Game cancelled! if the two...
When you declare an array, ____________. a. You always reserve memory for it in the same statement b.You might reserve memory for it in the same statement c. You cannot reserve memory for it in the...
You reserve memory locations for an array when you ____________. a. Declare the array name b. Use the keyword mem c. Use the keyword new d. Use the keyword size
Array names represent ____________. a. References b. Values c. Functions d. Allusions
When you initialize an array by giving it values upon creation, you ____________. a. Do not explicitly give the array a size b. Also must give the array a size explicitly c. Must make all the values...
When you use a bubble sort to perform an ascending sort, after the first pass through an array the smallest value is ____________. a. At the beginning of the list b. In the middle of the list c. At...
You created a class named Purchase. Each Purchase contains an invoice number, amount of sale, amount of sales tax, and several methods. Add get methods for the invoice number and sale amount fields...
Create a class named Rock that acts as a superclass for rock samples collected and catalogued by a natural history museum. The Rock class contains fields for a number of samples, a description of the...
Which of the following statements is true? a. Exceptions are more serious than Errors. b. Errors are more serious than Exceptions. c. Errors and Exceptions are different but equally serious. d....
The method that ends the current application and returns control to the operating system is ____________. a. System.exit() b. System.done() c. System.end() d. System.abort()
If you include three statements in a try block and follow the block with three Catch blocks, and the second statement in the try block throws an exception, Then___________. A. The first catch block...
The memory location where the computer stores the list of method locations to which the system must return is known as the ____________. A. Registry B. Archive C. Chronicle D. Call stack
A(n) ____________ is a statement used in testing programs that should be true; if it is not true, an exception is thrown. A. Verification b. Throwable c. Assertion d. Declaration
The path class getfilename() method returns ____________. A. The string representation of a path B. An absolute path C. The first item in a paths list of name elements D. The last item in a paths...
A buffer ____________. A. Holds bytes that are scheduled for input or output B. Deteriorates program performance C. Cannot be flushed in java D. All of the above are true.
A file channel ____________. A. Can be read from B. Can be written to C. Is seekable D. All of the above are true.
Suppose that you have declared a ButtonGroup named twoOptions and added two JCheckBoxes named box1 and box2 to it. Which box is selected after the following statements execute?...
a. Write an application that instantiates a JFrame that contains a JButton. Disable the JButton after the user clicks it. Save the file as JFrameDisableButton.java. b. Modify the JFrameDisableButton...
In Java, you can declare an array of 12 elements and initialize ____________. a. Only the first one b. All of them c. Both of these are true. d. Neither of these is true.
In which of the following situations would setting up parallel arrays be most useful? a. You need to look up an employees ID number to find the employees last name. b. You need to calculate interest...
When you pass an array element to a method, the method receives ____________. a. A copy of the array b. The address of the array c. A copy of the value in the element d. The address of the element
If a method should return an array to its calling method, ____________. a. The methods return type must match its parameter type b. The return type in the method header is preceded by an ampersand c....
Which of the following statements is true? a. JavaFX cannot be used with Swing projects. b. JavaFX uses HTML for design layout. c. JavaFX can be used to develop applications for the desktop and the...
Which of the following statements is true? a. The Inspector panel contains the Controller, Layout, and Code sections. b. The Code section allows you to manage event handling actions for controls. c....
Minimize each of the following expressions for F using a K-map in sums-of product form: (a) F(W, X, Y, Z) = WXYZ + WYZ (b) F = A B C D + ACD + ABCD (c) F = (A + B + C + D)(A + B + C + D)(A + B + C +...
Which of the following statements is true. Javafx ____________. A. Is difficult to use B. Cannot incorporate video, sound, or web content C. Separates the ui from the application logic D. Does not...
Open the VB2017\Chap01\FixIt Solution\FixIt Solution.sln file. If necessary, open the designer window. The interface contains a picture box, two buttons, and a label control that displays the price...
Create an application that calculates and displays the percentage of the total sales made by each of the following three salespeople: Jim, Karen, and Martin. Before creating your Planning Chart,...
In this exercise, you modify the application created in Exercise 2. Use Windows to make a copy of the Hales Solution folder. Rename the copy Hales Solution-Select Case. Open the Hales Solution.sln...
How many times will the string literal Hi appear in the lblMsg control? Dim intCount As Integer Do lblMsg.Text = lblMsg.Text & "Hi" & ControlChars.NewLine intCount += 1 Loop While intCount > 4 A....
Which of the following statements selects the fourth item in the lstNames control? a. lstNames.SelectIndex = 3 b. lstNames.SelectIndex = 4 c. lstNames.SelectedIndex = 3 d. lstNames.SelectedItem = 4
Minimize each of the following functions for f using a K-map and dont care conditions, d. (a) f(A, B, C) = m(1, 2, 4, 7) d(A, B, C) = m(5, 6) (b) f(X, Y, Z) = m(2, 6) d(X, Y, Z) = m(0, 1, 3, 4,...
In this exercise, you create an application for Discount Warehouse. Create a Windows Forms application. Use the following names for the project and solution, respectively: Discount Project and...
Show that the Boolean function, f = A B AB between two variables, A and B, can be implemented using a single two-input gate.
Simplify each of the following functions for F using a K-map. Draw a logic diagram for each using NAND-only and NOR-only gates. (a) F(W, X, Y, Z) = m(0, 2, 4, 8, 12) (b) F(W, X, Y, Z) = m(0, 2, 4,...
Find function F for the following circuit: Do
Design a combinational circuit that accepts a two-bit unsigned number, A and B such that the output, F = A plus B. Note that AB = 11 2 will never occur. Draw a schematic using logic gates. Show all...
Which of the following is false? a. A function returns only one value to the statement that invoked it. b. A Sub procedure can accept only one item of data passed to it. c. The parameterList in a...
What are the items that appear within parentheses in a procedure header called? A. Arguments B. Parameters C. Passers D. None of the above.
Which of the following statements invokes the GetArea Sub procedure, passing it two variables by value? a. GetArea(dblLength, dblWidth) As Double b. GetArea(ByVal dblLength, ByVal dblWidth) c....
Which of the following is a valid header for a procedure that receives an integer followed by a number with a decimal place? a. Private Sub GetFee(intBase As Value, decRate As Value) b. Private Sub...
Which of the following is a valid header for a procedure that receives the address of a Decimal variable followed by an integer? a. Private Sub GetFee(ByVal decX As Decimal, ByAdd intY As Integer) b....
Design a combinational circuit using full adders to multiply a 4-bit unsigned number by 2. Draw a logic diagram using the block diagram of a full adder as the building block.
Draw a logic diagram using a 74138 decoder and a minimum number of external gates to implement the following: F0(A, B, C)= m(1,3,4), F1(A, B, C)= m(0,2,4,7), F2(A, B, C)= m(0,1,3,5,6), F3(A, B, C)=...
Design: (a) A 16-bit adder whose worst-case add-time is 10 using a 4-bit CLA as a building block. (b) The fastest 64-bit adder using a 4-bit CLA as the building block. Estimate the worst-case...
Write SQL queries to answer the following questions: a. Which students are enrolled in Database and Networking? (Use SectionNo for each class so you can determine the answer from the Registration...
Add minimum and maximum cardinality notation to each of the following figures, as appropriate: a. Figure 2-5 b. Figure 2-10a c. Figure 2-11b d. Figure 2-12 (all parts) e. Figure 2-13c f. Figure 2-14
How do you represent a 1:M unary relationship in a relational data model?
Table 4-5 shows a shipping manifest. Your assignment is as follows: a. Draw a relational schema and diagram the functional dependencies in the relation. b. In what normal form is this relation? c....
A sign extension unit extends a twos complement number from M to N (N > M) bits by copying the most significant bit of the input into the upper bits of the output. It receives an M-bit input A and...
In this problem, you will explore the design of a 32-bit prefix adder. (a) Sketch a schematic of your design. (b) Design the 32-bit prefix adder in an HDL. Simulate and test your adder to prove that...
The toggle (T) flip-flop has one input, CLK, and one output, Q. On each rising edge of CLK, Q toggles to the complement of its previous value. Draw a schematic for a T flip-flop using a D flip-flop...
Describe in words what the state machine in Figure 3.70 does. Using binary state encodings, complete a state transition table and output table for the FSM. Write Boolean equations for the next state...
You are designing an FSM to keep track of the mood of four students working in the digital design lab. Each students mood is either HAPPY (the circuit works), SAD (the circuit blew up), BUSY (working...
Write an HDL module that computes a four-input XOR function. The input is a 3:0 , and the output is y.
Write a self-checking testbench for Exercise 4.3. Create a test vector file containing all 16 test cases. Simulate the circuit and show that it works. Introduce an error in the test vector file and...
Sketch a schematic of the circuit described by the following HDL code. Simplify the schematic so that it shows a minimum number of gates. SystemVerilog VHDL module exerctsel (input 1ogt ca, b. c....
What are the main security issues that New Century should address? Prepare a memo that lists the primary concerns and offers a specific recommendation for dealing with each issue. You implemented the...
Consider the entries in Table 4.2 for the sawtooth and the triangular signals normalized in magnitude and period. Use their Fourier coefficients to obtain corresponding periodic signals that are...
Write a program that displays the area and perimeter of a rectangle with the width of 4.5 and height of 7.9 using the following formula: area = width height
The U.S. Census Bureau projects population based on the following assumptions: One birth every 7 seconds One death every 13 seconds One new immigrant every 45 seconds Write a program to display...
The two roots of a quadratic equation ax 2 + bx + c = 0 can be obtained using the following formula: b 2 - 4ac is called the discriminant of the quadratic equation. If it is positive, the equation...
Write a program that prompts the user to enter the number of students and each students name and score, and finally displays the student with the highest score and the student with the second-highest...
Revise Listing 3.4, ComputeAndInterpretBMI.java, to let the user enter weight, feet, and inches. For example, if a person is 5 feet and 10 inches, you will enter 5 for feet and 10 for inches. Here is...
Use nested loops that display the following patterns in four separate programs: Pattern B 12 3 4 5 6 2 3 4 5 123 4 Pattern D 1 2 3 4 5 6 12 3 4 5 123 4 Pattern A Pattern C 2 1 3 2 1 4 3 2 1 5 4 3 2 1...
Write a program that prompts the user to enter the number of students, the students names, and their scores, and prints student names in decreasing order of their scores.
Write a program that prints the characters in the ASCII character table from ! to ~. Display ten characters per line. The ASCII table is shown in Appendix B. Characters are separated by exactly one...
Write a method that computes the commission, using the scheme in Programming Exercise 5.39 . The header of the method is as follows:public static double?computeCommission(double?salesAmount)Write a...
Write a program that reads the integers between 1 and 100 and counts the occurrences of each. Assume the input ends with 0. Hereis a sample run of the program: If a number occurs more than one time,...
Define a class named ComparableCircle that extends Circle and implements Comparable. Draw the UML diagram and implement the compareTo method to compare the circles on the basis of area. Write a test...
Write a program that displays two circles with radius 10 at location (40, 40) and (120, 150) with a line connecting the two circles, as shown in Figure 15.28b. The distance between the circles is...
Write the following two generic methods using bubble sort. The first method sorts the elements using the Comparable interface and the second uses the Comparator interface. public static void...
Write a program that uses a pie chart to display the percentages of the overall grade represented by projects, quizzes, midterm exams, and the final exam, as shown in Figure 14.46c. Suppose that...
Suppose that in a 0-1 knapsack problem, the order of the items when sorted by increasing weight is the same as their order when sorted by decreasing value. Give an efficient algorithm to find an...
Prove that if p 1 p 2 is positive, then vector p 1 is clockwise from vector p 2 with respect to the origin (0, 0) and that if this cross product is negative, then p 1 is counterclockwise from p 2 .
Draw a class inheritance diagram for the following set of classes: Class Goat extends Object and adds an instance variable tail and methods milk( ) and jump( ). Class Pig extends Object and adds an...
Programming Exercise 7.6 describes how to perform matrix multiplication. Suppose you have multiple processors, so you can speed up the matrix multiplication. Implement the following method in...
Modify Listing 28.10, ConnectedCircles.java, to enable the user to remove a circle when the mouse is clicked inside the circle. Listing 1 import javafx.application. Application; 2 import...
Show the longest common subsequence array L for the two strings: X = "skullandbones" Y = "lullabybabies" What is a longest common subsequence between these strings?
Draw the recursion trace for the execution of method PuzzleSolve(3,S,U), from Code Fragment 5.11, where S is empty and U = {a,b,c,d}. Algorithm PuzzleSolve(k, S, U): Input: An integer k, sequence S,...
The following questions refer to the tree of Figure 8.3.a. Which node is the root?b. What are the internal nodes?c. How many descendants does node cs016/ have?d. How many ancestors does node cs016/...
Convert the number 101000101100 2 directly from binary to hexadecimal. Without looking at the original number, convert your answer directly back to binary and compare your final answer with the...
Identify and briefly explain two different ways of configuring a multiprocessing system. Which configuration is more effective for general-purpose computing? Which configuration is more effective for...
Create a JavaFX application for Paulas Portraits, a photography studio. The application allows users to compute the price of a photography session. Paulas base price is $40 for an in-studio photo...
Open the VB2017\Chap06\FixIt Solution\FixIt Solution.sln file. Start the application. Click 20 in the Length combo box and then click 30 in the Width combo box. Click the Calculate area button, which...
In this exercise, you modify the Check Digit application from this chapters Apply lesson. Use Windows to make a copy of the Check Digit Solution folder. Rename the copy Check Digit Solution-ForNext....