Write an HDL module for the traffic light controller from Section 3.4.1.
What is the delay for the following types of 64-bit adders? Assume that each two-input gate delay is 150 ps and that a full adder delay is 450 ps. (a) a ripple-carry adder (b) a carry-lookahead adder...
Write the following strings using ASCII encoding. Write your final answers in hexadecimal. (a) SOS (b) Cool! (c) (your own name)
Repeat Exercise 6.3 for memory storage of a 32-bit word stored at memory word 15 in a byte-addressable memory.? Data from problem 3 Consider memory storage of a 32-bit word stored at memory word 42...
The James River Jewelry Project Questions are available online for Appendix D, which can be downloaded from the textbook?s Web site: www.pearsonhighered.com/kroenke . The solutions for these...
Let T be a heap storing n keys. Give an efficient algorithm for reporting all the keys in T that are smaller than or equal to a given query key x (which is not necessarily in T). For example, given...
Answer the previous exercise assuming that we implement both the union-bysize and path compression heuristics.
Consider the recurrence equation,
Suppose that in an instance of the coins-in-a-line game the coins have the following values in the line: (9, 1, 7, 3, 2, 8, 9, 3). What is the maximum that the first player, Alice, can win, assuming...
Let S = {a, b, c, d, e, f, g} be a collection of objects with benefit-weight values, a: (12, 4), b : (10, 6), c : (8, 5), d: (11, 7), e: (14, 3), f : (7, 1), g : (9, 6). What is an optimal solution...
Suppose that CONTROL, a secret U.S. government counterintelligence agency based in Washington, D.C., has build a communication network that links n stations spread across the world using m...
Suppose you are a manager in the IT department for the government of a corrupt dictator, who has a collection of computers that need to be connected together to create a communication network for his...
Answer the following questions on the flow network N and flow f shown in Figure 16.6a: What are the forward and backward edges of augmenting path ? How many augmenting paths are there with respect to...
Suppose an oracle has given you a magic computer, C, that when given any Boolean formula B in CNF will tell you in one step whether B is satisfiable. Show how to use C to construct an actual...
Prove that the set of feasible solutions to a linear program with a nonempty feasible region is convex.
All of the employees at Merks Sales are paid based on an annual salary rather than an hourly wage. However, some employees are paid weekly while others are paid every other week (biweekly). Weekly...
The algorithm shown in Figure 1-14 should calculate and print the gross pay for five workers; however, some of the instructions are missing from the algorithm. Complete the algorithm. If an employee...
Juan wants a program that calculates and displays the number of miles per gallon he drove his car on a recent trip. When he started the trip, the cars gas tank was full and its odometer read 5500....
Write the C++ code for a function that receives four items of information: three by value and one by reference. Each item has the double data type. Name the formal parameters num1, num2, num3, and...
Mountain Coffee wants a program that allows a clerk to enter the number of pounds of coffee ordered, the price per pound, and whether the customer should be charged a 3.5% sales tax. The program...
Create a program that displays a multiplication table similar to the one shown in Figure 7-51. If necessary, create a new project named Introductory20 Project, and save it in the Cpp8\Chap07 folder....
If necessary, create a new project named Introductory20 Project and save it in the Cpp8\Chap13 folder. Also create a new source file named Introductory20.cpp. Write a program that displays the...
If necessary, create a new project named Intermediate23 Project and save it in the Cpp8\Chap13 folder. Also create a new source file named Intermediate23.cpp. Write a program that displays the color...
Which of the following is valid advice for naming variables? a. To save typing, make most variable names one or two letters. b. To avoid conflict with names that others are using, use unusual or...
Which of the following is true of structured logic? a. You can use structured logic with newer programming languages, such as Java and C#, but not with older ones. b. Any task can be described using...
Choose a television game show such as Wheel of Fortune or Jeopardy! and describe its rules using a structured flowchart or pseudocode.
A trivial Boolean expression is one that ______________. a. Is uses only two operands b. Always has the same value c. Is always true d. Is always false
If d is true, e is false, and f is false, which of the following expressions is true? a. e OR f AND d b. f AND d OR e c. d OR e AND f d. two of the above
Your downloadable files for Chapter 4 include DEBUG04-01.txt, DEBUG04-02.txt, and DEBUG04-03.txt. Each file starts with some comments that describe the problem. Comments are lines that begin with two...
As compared to procedural programming, with object-oriented programming, ____________. a. The programmers focus differs b. You cannot use some languages, such as Java c. You do not accept input d....
In your own words, describe the steps to writing a computer program.
Draw a flowchart or write pseudocode to represent the logic of a program that allows the user to enter a value. The program multiplies the value by 10 and outputs the result.
a. Design a program for the Hollywood Movie Rating Guide, which can be installed in a kiosk in theaters. Each theater patron enters a value from 0 to 4 indicating the number of stars that the patron...
Create the logic for a game that simulates rolling two dice by generating two numbers between 1 and 6 inclusive. The player chooses a number between 2 and 12 (the lowest and highest totals possible...
Suppose that you have declared a numeric array named numbers, and two of its elements are numbers[1] and numbers[4]. You know that _________. a. The two elements hold the same value b. The array...
A _________is a variable that can be set to indicate whether some event has occurred. a. Subscript b. Banner c. Counter d. Flag
Trainers at Toms Athletic Club are encouraged to enroll new members. Write an application that allows Tom to enter the names of each of his 25 trainers and the number of new members the trainer has...
Every file on a storage device has a ____________. a. Name b. Size c. Both of the above d. None of the above
The process of _________ a file locates it on a storage device and associates a variable name within your program with the file. a. Declaring b. Closing c. Opening d. Defining
If necessary, create a new project named Introductory19 Project and save it in the Cpp8\Chap14 folder. Also create a new source file named Introductory19.cpp. Create a program that saves a companys...
When you write to a file, you ______________. a. Move data from a storage device to memory b. Copy data from a storage device to memory c. Move data from memory to a storage device d. Copy data from...
Unlike when you print a report or display information on a screen, when a programs output is a data file, you do not _________. a. Include explanations or formatting such as dollar signs b. Open or...
When you close a file, it __________. a. Becomes associated with an internal identifier b. Cannot be reopened c. Is no longer available to the program d. Ceases to exist
A file in which records are stored one after another in order based on the contents of a field is a(n) __________ file. a. Temporal b. Alphabetical c. Random d. Sequential
When you combine two or more sorted files while maintaining their sequential order based on a field, you are __________ the files. a. Tracking b. Collating c. Merging d. Absorbing
A control break occurs when a program _____________. a. Pauses to perform special processing based on the value of a field b. Ends prematurely, before all records have been processed c. Takes one of...
A control break field __________. a. Always is output prior to any group of records on a control break report b. Always is output after any group of records on a control break report c. Never is...
Whenever a control break occurs during record processing in any control break program, you must _________. a. Declare a control break field b. Set the control break field to 0 c. Update the value in...
When you merge records from two or more sequential files, the usual case is that the records in the files _______. a. Contain the same data b. Have the same format c. Are identical in number d. Are...
A file that holds more permanent data than a transaction file is a _________file. a. Master b. Primary c. Key d. Mega-
A transaction file is often used to ____________ another file. a. Augment b. Remove c. Verify d. Update
The saved version of a file that does not contain the most recently applied transactions is known as a ____________ file. a. Master b. Child c. Parent d. Relative
Which of the following is an example of a control break report? a. A list of all customers of a business in zip code order, with a count of the number of customers who reside in each zip code b. A...
Random access files are used most frequently in all of the following except _______________. a. Interactive programs b. Batch processing c. Real-time applications d. Programs requiring direct access
Assume that you are writing a program to merge two files named FallStudents and SpringStudents. Each file contains a list of students enrolled in a programming logic course during the semester...
Student records stored in alphabetical order by last name have been sorted in _____ order. a. Descending b. Ascending c. Staggered d. Recursive
The International Rock Paper Scissors Society holds regional and national championships. Each region holds a semifinal competition in which contestants play 500 games of Rock Paper Scissors. The top...
When computers sort data, they always _____. a. Place items in ascending order b. Use a bubble sort c. Use numeric values when making comparisons d. Begin the process by locating the position of the...
Which type of sort compares list items in pairs, swapping any two adjacent values that are out of order? a. Insertion sort b. Indexed sort c. Bubble sort d. Selection sort
To sort a list of 15 values using a bubble sort, the greatest number of times you would have to pass through the list making comparisons is _____. a. 15 b. 14 c. 13 d. 12
To completely sort a list of 10 values using a bubble sort, the greatest possible number of required pair comparisons is _____. a. 9 b. 10 c. 81 d. 100
When you do not know how many items need to be sorted in a program, you can create an array that has _____. a. Variable-sized elements b. At least as many elements as the number you predict you will...
In a bubble sort, on each pass through the list that must be sorted, you can stop making pair comparisons _____. a. One comparison sooner b. Two comparisons sooner c. One comparison later d. Two...
When performing a bubble sort on a list of 10 values, you can stop making passes through the list of values as soon as _____ on a single pass through the list. a. No swaps are made b. Exactly one...
The bubble sort is _____. a. The most efficient sort b. A relatively fast sort compared to others c. A relatively easy sort to understand d. All of the above
Data stored in a table that can be accessed using row and column numbers is stored as a _____ array. a. Single-dimensional b. Two-dimensional c. Three-dimensional d. Nondimensional
In a two-dimensional array declared as num myArray[6][7], the highest row number is ______. a. 5 b. 6 c. 7 d. 8
If you access a two-dimensional array with the expression output myArray[2][5], the output value will be _____. a. 0 b. 2 c. 5 d. Impossible to tell from the information given
Assume you have written a method with the header string myMethod(num score, string grade). Also assume you have declared a numeric variable named test. Which of the following is a correct method...
Programmers should strive to _____. a. Increase coupling b. Increase cohesion c. Both of the above d. Neither a nor b
Create the logic for a program that prompts a user for 12 numbers and stores them in an array. Pass the array to a method that reverses the order of the numbers. Display the reversed numbers in the...
Each of the programs in Figure 9-25 uses a recursive method. Try to determine the output in each case. a. b. c. start start start output recursiveA(0) stop num recursiveA(num x) num result if x = 0...
The process of acquiring the traits of ones predecessors is ________. a. Polymorphism b. Encapsulation c. Inheritance d. Orientation
An instance method ________. a. Is static b. Receives a this reference c. Both of the above d. None of the above
Assume that you have created a class named Dog that contains a data field named weight and an instance method named setWeight(). Further assume that the setWeight() method accepts a numeric parameter...
A static method is also known as a(n) ________ method. a. Instance b. Class c. Private d. Public
By default, methods contained in a class are ________methods. a. Static b. Nonstatic c. Class d. Public
Assume that you have created a class named MyClass, and that a working program contains the following statement: output MyClass.numberOfStudents Which of the following do you know? a....
Assume that you have created an object named myObject and that a working program contains the following statement: output myObject.getSize() Which of the following do you know? a. getSize() is a...
Assume that you have created a class that contains a private field named myField and a nonstatic public method named myMethod(). Which of the following is true? a. myMethod() has access to myField...
An object can be ________. a. Stored in an array b. Passed to a method c. Returned from a method d. All of the above
Design a class named TermPaper that holds an authors name, the subject of the paper, and an assigned letter grade. Include methods to set the values for each data field and display the values for...
Which of the following is not a similarity between constructors and destructors? a. Both can be called automatically. b. Both can be overloaded. c. Both have the same name as their class. d. Both...
A class that is used as a basis for inheritance is called a _________. a. Derived class b. Subclass c. Base class d. Child class
Which of the following is not an advantage of creating a class that inherits from another class? a. You make it easier for anyone who has used the original class to understand the new class. b. You...
Use the construction in the proof of Theorem 1.45 to give the state diagrams of NFAs recognizing the union of the languages described in a. Exercises 1.6a and 1.6b. b. Exercises 1.6c and 1.6f....
This exercise concerns TM M 1 , whose description and state diagram appear in Example 3.9. In each of the parts, give the sequence of configurations that M1 enters when started on the indicated input...
Give an example in the spirit of the recursion theorem of a program in a real programming language (or a reasonable approximation thereof ) that prints itself out.
A local zoo offers three different memberships: an individual membership for $99 per year, a dual membership for $175 per year, and a family membership for $225 per year. The membership director...
Write an application that allows a user to enter any number of student test scores until the user enters 999. If the score entered is less than 0 or more than 100, display\ an appropriate message and...
Write an application that prompts a user for a full name and street address and constructs an ID from the users initials and numeric part of the address. For example, the user William Henry Harrison...
Allow a user to enter any number of double values up to 20. The user should enter 99999 to quit entering numbers. Display an error message if the user quits without entering any numbers; otherwise,...
Write an application that extends JPanel and displays a phrase in every font size from 6 through 20. Save the file as JFontSizesPanel.java.
You wrote an application named DistanceFromAverage that allows a user to enter up to 20 double values and then displays each entered value and its distance fromthe average. Now,modify that programto...
You set up the card game Concentration by placing pairs of cards face down in a grid. The player turns up two cards at a time, exposing their values. If the cards match, they are removed from the...
From your own experience, describe an activity that would not have been possible without computers.
Write a program that doesnt do anything, but declares a number of variables with legal and illegal names (such as int double = 0;), so that you can see how the compiler reacts.
What do x&&y and x||y, respectively, mean?
Build an ad hoc scanner for the calculator language. As output, have it print a list, in order, of the input tokens. For simplicity, feel free to simply halt in the event of a lexical error.
Write a program in your favorite scripting language to remove comments from programs in the calculator language.