Rewrite Exercise 20.13 using JSF, as shown in Figure 33.34. Upon clicking the Refresh button, the program displays four random cards and displays an expression if a 24-point solution exists....
Rewrite Exercise 20.17 using JSF, as shown in Figure 33.35. The program lets the user enter four card values and finds a solution upon clicking the Find a Solution button. This exercise is a...
This problem examines three algorithms for searching for a value x in an unsorted array A consisting of n elements. Consider the following randomized strategy: pick a random index i into A. If A[i] =...
Chapter 30 examines an important algorithm called the fast Fourier transform, or FFT. The first step of the FFT algorithm performs a bit-reversal permutation on an input array A[0 . . n - 1] whose...
Consider implementing a stack in a computer that has a relatively small amount of fast primary memory and a relatively large amount of slower disk storage. The operations PUSH and POP work on...
A practical method for interpolating a set of points with a curve is to use cubic splines. We are given a set {(x i , y i ) : i = 0, 1, . . . , n} of n + 1 point-value pairs, where x 0 1 n. We wish...
The IEEE provides a standard 32-bit format for floating point numbers. The format for a number is specified as 1.M 2 E 127 . Explain each part of this format.
To implement the preorder method of the AbstractTree class, we relied on the convenience of creating a snapshot. Reimplement a preorder method that creates a lazy iterator. (See Section 7.4.2 for...
What is routing? Explain the difference between circuit switching and virtual circuit switching. What is a third, more common, alternative? How does it differ from the other two?
Draw a pair of sine waves that are 45 out of phase.
Describe a fully qualified domain name.
Create and test an HTML document that has six short paragraphs of text that describe various aspects of the state in which you live. You must define three different paragraph styles, p1, p2, and p3....
Mats-R-Us sells three different types of mats: Standard ($99), Deluxe ($129), and Premium ($179). All of the mats are available in blue, red ($10 extra), and pink ($15 extra). There is also an extra...
Which of the following assigns the number of characters in the strAddress variable to the intNum variable? a. intNum = strAddress.Length b. intNum = strAddress.LengthOf c. intNum = Length(strAddress)...
In this exercise, you modify the Password application from this chapters Apply lesson. Use Windows to make a copy of the Password Solution folder. Rename the copy Password Solution-Index. Open the...
The intNum array is declared as follows: Dim intNum(,) As Integer = {{6, 12, 9, 5, 2}, {35, 60, 17, 8, 10}}. The intNum(1, 4) = intNum(1, 2) - 5 statement will_____________________. a. Replace the 10...
Develop and test an HTML document that collects the following information from the user: last name, first name, middle initial, age (restricted to be greater than 17), and weight (restricted to the...
What new software must be installed on a browser or server to run Web applications that use Ajax?
Write, test, and debug (if necessary) a Ruby program with the following specification: Input: A list of numbers from the keyboard. Output: The median of the input numbers.
The Fourier transforms of even and odd functions are very important. Let x(t) = e ? ?t ? and y(t) = e ?t u(t) ? e t u(?t). (a) Plot x(t) and y(t), and determine whether they are even or odd. (b) Show...
Explain how you would change the stored procedure in Figure 10A-58 to connect the customer to all artists who either (a) Were born before 1900 or (b) Had a null value for Birthdate.
For signals with infinite support, their Fourier transforms cannot be derived from the Laplace transform unless they are absolutely integrable or the region of convergence of the Laplace transform...
Write an HDL module for the FSM with the state transition diagram given in Figure 3.70 from Exercise 3.23.
Another definition for the finite difference is the backward difference: 1 [x(nT s )] = x(nT s ) x((n 1)T s ) ( 1 [x(nT s )]/T s approximates the derivative of x(t)). (a) Indicate how this new...
Write an HDL module for the latch from Figure 3.18. Use one assignment statement for each gate. Specify delays of 1 unit or 1 ns to each gate. Simulate the latch and show that it operates correctly....
What is the range of instruction addresses to which conditional branches, such as beq and bne, can branch in MIPS? Give your answer in number of instructions relative to the conditional branch...
Explain how to extend the pipelined processor to handle the j instruction. Give particular attention to how the pipeline is flushed when a jump takes place.
Is the miss rate of a two-way set associative cache always, usually, occasionally, or never better than that of a direct mapped cache of the same capacity and block size? Explain.
A cache has the following parameters: b, block size given in numbers of words; S, number of sets; N, number of ways; and A, number of address bits. (a) In terms of the parameters described, what is...
The following questions examine the limitations of the jump instruction, j. Give your answer in number of instructions relative to the jump instruction. (a) In the worst case, how far can the jump...
You decide to speed up the virtual memory system of Exercise 8.21 by using a translation lookaside buffer (TLB) with 128 entries. (a) How big (in bits) is the TLB? Give numbers for data (physical...
Suppose the MIPS multicycle processor described in Section 7.4 uses a virtual memory system. (a) Sketch the location of the TLB in the multicycle processor schematic. (b) Describe how adding a TLB...
Describe a scenario in which the virtual memory system might affect how an application is written. Be sure to include a discussion of how the page size and physical memory size affect the performance...
Suppose you own a personal computer (PC) that uses 32-bit virtual addresses. (a) What is the maximum amount of virtual memory space each program can use? (b) How does the size of your PCs hard drive...
Graph the functions 12n, 6n log n, n 2 , n 3 , and 2n using a logarithmic scale for the x- and y-axes; that is, if the function value f(n) is y, plot this as a point with x-coordinate at log n and...
Consider a virtual memory system that can address a total of 250 bytes. You have unlimited hard drive space, but are limited to 2 GB of semiconductor (physical) memory. Assume that virtual and...
The virtual memory system you are designing uses a single-level page table built from dedicated hardware (SRAM and associated logic). It supports 25-bit virtual addresses, 22-bit physical addresses,...
Create a referential integrity constraint on OwnerID in PET. Assume that deletions should cascade PET_OWNER (OwnerID, OwnerLastName, OwnerFirstName, OwnerPhone, OwnerEmail) PET (PetID, PetName,...
Describe, using pseudocode, an implementation of the method insertBefore(p, e), for a linked list, assuming the list is implemented using a doubly linked list.
Describe, in pseudocode, a link-hopping method for finding the middle node of a doubly linked list with header and trailer sentinels, and an odd number of real nodes between them. What is the running...
Define the internal path length, I(T), of a tree T to be the sum of the depths of all the internal nodes in T. Likewise, define the external path length, E(T), of a tree T to be the sum of the depths...
Describe how to perform the operation findAllElements(k), which returns all the items with keys equal to k in a balanced search tree, and show that it runs in time O(log n + s), where n is the number...
Suppose you would like to build a hash table for images, where the key for each image is a thumbnail image of 7575 pixels, with each pixel being one of 256 possible colors. Describe a hash function...
What is the maxima set from the following set of points: {(7, 2),(3, 1),(9, 3),(4, 5),(1, 4),(6, 9),(2, 6),(5, 7),(8, 6)}?
Give an example of a set of n points in the plane such that every point is a maximum point, that is, no point in this set is dominated by any other point in this set.
An American spy is deep undercover in the hostile country of Phonemia. In order not to waste scarce resources, any time he wants to send a message back home, he removes all the punctuation from his...
Suppose G is a weighted, connected, undirected, simple graph and e is a largestweight edge in G. Prove or disprove the claim that there is no minimum spanning tree of G that contains e.
Show that the problem SAT, which takes an arbitrary Boolean formula S as input and asks whether S is satisfiable, is NP-complete.
Suppose you are given a connected weighted undirected graph, G, with n vertices and m edges, such that the weight of each edge in G is an integer in the interval [1, c], for a fixed constant c > 0....
Which of the following is not a programming control structure? a. Repetition b. Selection c. Sequence d. Sorting
Which of the following is the first step in the problem-solving process? a. Plan the algorithm b. Analyze the problem c. Desk-check the algorithm d. Code the algorithm into a program
Norbert Catering is famous for its roast beef sandwiches. The stores owner wants a program that he can use to estimate the number of pounds of roast beef a customer should purchase, given the desired...
Write a C++ for clause that processes the loop instructions 10 times. Use numTimes as the counter variables name.
A program declares an int variable named evenNum and initializes it to 2. Write the C++ code to display the even integers 2, 4, 6, 8, and 10 on separate lines on the computer screen. Use the do while...
Archie wants a program that calculates and displays a teams final score in a football game, given the numbers of the teams field goals, touchdowns, one-point conversions, two-point conversions, and...
Correct the errors in the lines of code shown in Figure 4-34. (The code contains eight errors.)
Rewrite the code from Pencil and Paper Exercise 5 using the do while statement.
Modify the solution shown earlier in Figure 7-2. The solution should now keep track of the number of times Sahirahs laser beam missed the spider. After saying You are safe now. The spider is dead.,...
Your downloadable files for Chapter 1 include a file named DEBUG01-04.jpg that contains a flowchart that contains syntax and/or logical errors. Examine the flowchart and then find and correct all the...
Which of the following is not a typical housekeeping task? a. Displaying instructions b. Printing summaries c. Opening files d. Displaying report headings
Your downloadable files for Chapter 2 include DEBUG02-01.txt, DEBUG02-02. txt, and DEBUG02-03.txt. Each file starts with some comments that describe the problem. Comments are lines that begin with...
A _____ expression has one of two values, often expressed as true or false. a. Georgian b. Boolean c. Selection d. Caesarian
When a loop executes, the structure-controlling condition is ______________. a. Tested exactly once b. Never tested more than once c. Tested either before or after the loop body executes d. tested...
In an AND condition, the most efficient technique is to first ask the question that ______________. a. Is most likely to be true b. Is least likely to be true c. That contains the most operands d....
If conditionA is 30 percent likely to be true and conditionB is 10 percent likely to be true, then it is most efficient to test conditionA first ______________. a. In an OR decision b. In an AND...
Which of the following is a poorly written, trivial Boolean expression? a. a > b AND b > c b. a = 100 OR b > 200 c. a < b AND c < 100 AND d 5 d. a < 10 AND a > 40
In the following pseudocode, what percentage raise will an employee in Department 8 receive? if department < 5 then raise = SMALL_RAISE else if department < 14 then raise = MEDIUM_RAISE else if...
A programmers most important task before planning the logic of a program is to ____________. a. Decide which programming language to use b. Code the problem c. Train the users of the program d....
A program contains a seven-element array that holds the names of the days of the week. At the start of the program, you display the day names using a subscript named dayNum. You display the same...
A file named MAINTENANCE06-01.txt is included with your downloadable student files. Assume that this program is a working program in your organization and that it needs modifications as described in...
If necessary, create a new project named Introductory20 Project and save it in the Cpp8\Chap14 folder. Also create a new source file named Introductory20.cpp. Create a program that saves prices in a...
Design the logic for the game Hangman, in which the user guesses letters in a hidden word. Store the letters of a word in an array of characters. Display a dash for each missing letter. Allow the...
In the Game Zone section of Chapter 5, you designed a guessing game in which the application generates a random number and the player tries to guess it. After each guess, you displayed a message...
HappyTunes is an application for downloading music files. Each time a file is purchased, a transaction record is created that includes the music genre and price paid. The available genres are...
A file named MAINTENANCE08-01.txt is included with your downloadable student files. Assume that this program is a working program in your organization and that it needs modifications as described in...
Your downloadable files for Chapter 8 include a file named DEBUG08-04.jpg that contains a flowchart with syntax and/or logical errors. Examine the flowchart, and then find and correct all the bugs.
In the Game Zone section of Chapter 6, you designed the logic for a quiz that contains multiple-choice questions about a topic of your choice. (Each question had three answer options.) Now, modify...
Your downloadable files for Chapter 9 include a file named DEBUG09-04.jpg that contains a flowchart with syntax and/or logical errors. Examine the flowchart, and then find and correct all the bugs.
Your downloadable student files for Chapter 10 include DEBUG10-01.txt, DEBUG10-02.txt, and DEBUG10-03.txt. Each file starts with some comments that describe the problem. Comments are lines that begin...
Your downloadable files for Chapter 10 include a file named DEBUG10-04.jpg that contains a class diagram with syntax and/or logical errors. Examine the class diagram, and then find and correct all...
A file named MAINTENANCE11-01.txt is included with your downloadable student files. Assume that this program is a working program in your organization and that it needs modifications as described in...
Your downloadable files for Chapter 11 include DEBUG11-01.txt, DEBUG11-02.txt, and DEBUG11-03.txt. Each file starts with some comments that describe the problem. Comments are lines that begin with...
Your downloadable files for Chapter 11 include a file named DEBUG11-04.jpg that contains a class diagram with syntax and/or logical errors. Examine the class diagram and then find and correct all the...
Give a formal definition of an enumerator. Consider it to be a type of two-tape Turing machine that uses its second tape as the printer. Include a definition of the enumerated language.
Give context-free grammars that generate the following languages. In all parts, the alphabet is {0,1}. Aa. {w| w contains at least three 1s} b. {w| w starts and ends with the same symbol} c. {w| the...
A finite state transducer (FST) is a type of deterministic finite automaton whose output is a string and not just accept or reject . The following are state diagrams of finite state transducers T 1...
Show that EQ CFG is co-Turing-recognizable.
Create a program that allows the user to enter any number of integers. The program should display the sum of the integers. Use the while statement and a negative number as the sentinel value. If...
Write the code to store the number 100 in each element in the balances array from Pencil and Paper Exercise 1. Use two for statements.
Code the algorithm shown in Figure 6-41. Use the switch statement to code the multiple-alternative selection structure. If necessary, create a new project named TryThis11 Project, and save it in the...
Karlton Learning wants a program that displays the amount of money a company owes for a seminar. The fee per person is based on the number of people the company registers, as shown in Figure 6-42....
In this exercise, you will create a program that displays both the smallest and largest of three integers entered by the user. For example, if the user enters the numbers 3, 5, and 9, the program...
In this exercise, you will experiment with the switch statement. a. Follow the instructions for starting C++ and viewing the Advanced20.cpp file, which is contained in either the...
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 list of name...
How would you write cout < < "Hello, "; cout < < fi rst_name; cout < < "! "; as a single line of code?
What kinds of literals are there?
What are some good rules for choosing names?
What is the difference between a declaration and a definition?
What does adding const to a member function do?
Yet another solution to the problem of the previous exercise is to make the sorting routine a method of a sorter class. The comparison routine can then be passed into the class as a constructor...