Question Answers
Textbooks
Search Textbook questions, tutors and Books
Oops, something went wrong!
Change your search query and then try again
Toggle navigation
FREE Trial
S
Books
FREE
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Hire a Tutor
AI Tutor
AI Flashcards
FREE
Search
Search
Sign In
Register
study help categories
/
Computer science
Top Selling Computer science Questions
Student records are stored in ID number order, but accessed by grade point average for a report. Grade point average order is a(n) _____ order. a. Imaginary b. Physical c. Logical d. Illogical
When you store a list of key fields paired with the storage address for the corresponding data record, you are creating _____. a. A directory b. A three-dimensional array c. A linked list d. An index
Assume you have written a method with the header void myMethod(num a, string b). Which of the following is a correct method call? a. MyMethod(12) b. MyMethod("Goodbye") c. MyMethod(12, "Hello") d. It...
Assume you have written a method with the header num yourMethod(string name, num code). The methods type is _____. a. Num b. String c. Num and string d. Void
Your downloadable files for Chapter 9 include DEBUG09-01.txt, DEBUG09-02.txt, and DEBUG09-03.txt. Each file starts with some comments that describe the problem. Comments are lines that begin with two...
A file named MAINTENANCE10-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...
Employing inheritance reduces errors because _________. a. The new classes have access to fewer data fields b. The new classes have access to fewer methods c. You can copy and paste methods that you...
Which of the following is true? a. A classs methods usually are public. b. A classs data fields usually are public. c. Both of the above d. None of the above
Write a formal description of the following graph. 1 4 2 3 6
Let = {a,b}. Give a CFG generating the language of strings with twice as many as as bs. Prove that your grammar is correct.
Let = {1, 2, 3, 4} and C = {w * | in w, the number of 1s equals the number of 2s, and the number of 3s equals the number of 4s}. Show that C is not context free.
Say that a language is prefix-closed if all prefixes of every string in the language are also in the language. Let C be an infinite, prefix-closed, context-free language. Show that C contains an...
Modify the proof of Theorem 3.16 to obtain Corollary 3.19, showing that a language is decidable iff some nondeterministic Turing machine decides it. (You may assume the following theorem about trees....
Use the construction in the proof of Theorem 1.47 to give the state diagrams of NFAs recognizing the concatenation of the languages described in a. Exercises 1.6g and 1.6i. b. Exercises 1.6b and...
Use the construction in the proof of Theorem 1.49 to give the state diagrams of NFAs recognizing the star of the languages described in a. Exercise 1.6b. b. Exercise 1.6j. c. Exercise 1.6m. Exercise...
Review the way that we define sets to be the same size inDefinition 4.12 (page 203). Show that is the same size is an equivalence relation.
This exercise concerns TM M 2 , whose description and state diagram appear in Example 3.7. In each of the parts, give the sequence of configurations that M 2 enters when started on the indicated...
Show that EQ CFG is undecidable.
Consider the problem of determining whether a two-tape Turing machine ever writes a nonblank symbol on its second tape when it is run on input w. Formulate this problem as a language and show that it...
Read the informal definition of the finite state transducer given in Exercise 1.24. Give a formal definition of this model, following the pattern in Definition 1.5. Assume that an FST has an input...
Prove that there exists an undecidable subset of {1} * .
Show that P is closed under union, concatenation, and complement.
Using the solution you gave to Exercise 1.25, give a formal description of the machines T 1 and T 2 depicted in Exercise 1.24. Exercise 1.24. A finite state transducer (FST) is a type of...
In Theorem 3.21, we showed that a language is Turing-recognizable iff some enumerator enumerates it. Why didnt we use the following simpler algorithm for the forward direction of the proof? As...
Show that NP is closed under union and concatenation.
Show that ALL DFA is in P.
Complete the C++ instructions column in Figure 3-24. Use the double data type for the input and output items. IPO chart information C++ instructions Input food rent utilties car payment Processing...
Create a program that allows the user to enter the ages (in years) of five people. The program should display the average age. Use the for statement. Display the average age with one decimal place....
Silvias Pizzeria sells four different sizes of pizzas: small, medium, large, and family. The manager of the pizzeria wants a program that displays the total number of pizzas sold, as well as the...
Rewrite the code from Pencil and Paper Exercise 4 using the do while statement in the outer loop and the while statement in the nested loop.
Rewrite the code from Pencil and Paper Exercise 2 using the replace function.
In this exercise, you will modify the program from Lab 5-1. If necessary, create a new project named ModifyThis10 Project, and save it in the Cpp8\Chap05 folder. Enter the instructions shown earlier...
What is the output of the following code? b = 1; while(b < 4) { System.out.print(b + " "); b = b + 1; } a. 1 b. 1 2 3 c. 1 2 3 4 d. 1 1 1 1 1...
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
A third-grade teacher at Potter Elementary School wants a program that allows a student to enter the amount of money a customer owes and the amount of money the customer paid. The program should...
Figure 6-40 shows a partially completed chart for a program that displays the amount of a salespersons commission. The commission is based on the salespersons sales amount, as indicated in the...
What does the following statement output? for(b = 1; b > 3; ++b) System.out.print(b + " "); a. 1 1 1 b. 1 2 3 c. 1 2 3 4 d. Nothing
The owner of Harrys Car Sales pays each salesperson a commission based on his or her quarterly sales. The sales ranges and corresponding commission rates are shown in Figure 6-43. The program should...
In this exercise, you will modify the tip program shown earlier in Figure 7-31. Follow the instructions for starting C++ and viewing the ModifyThis16.cpp file, which is contained in either the...
Create a JFrame that holds five buttons with the names of five different fonts. Include a sixth button that the user can click to make a font larger or smaller. Display a demonstration JLabel using...
In this exercise, you will modify the program from Lab10-2. If necessary, create a new project named Intermediate20 Project, and save it in the Cpp8\Chap10 folder. Copy the instructions from the...
Which of the following is true in a standard menu application? a. A JMenuItem holds a JMenu. b. A JMenuItem holds a JMenuBar. c. A JMenuBar holds a JMenu. d. A JMenu holds a JMenuBar
You developed an interactive GUI application for Carlys Catering. Now, design a JPanel that uses graphics to display a logo for the company, and modify the GUI application to include it. Save the...
Write an application that extends JPanel and uses the Graphics2D environment to create a GeneralPath object. Use the GeneralPath object to create the outline of your favorite state. Display the...
a. Create aMine Field game in which the user attempts to click 10 panels of a grid before hitting the bomb. Set up a JFrame using BorderLayout, use the NORTH region for a congratulatory message, and...
Suppose that you want to implement a bag class to hold non-negative integers, and you know that the biggest number in the bag will never be more than a few thousand. One approach for implementing...
What is meant by the term prompt?
Suppose that you have created a program with only the following variables. int a = 5; int b = 6; Suppose that you also have a method with the following header: public static void mathMethod(int a)...
Specify, design, and implement a class that can be used to keep track of the position of a location in three-dimensional space. For exampleex, acmonpslieder this location: The location shown in the...
In three-dimensional space, a line segment is defined by its two endpoints. Specify, design, and implement a class for a line segment. The class should have two private instance variables that are 3D...
A one-variable quadratic expression is an arithmetic expression of the form , where ax 2 , bx, and c are some fixed numbers (called the coefficients) and x is a variable that can take on different...
This project is a continuation of the previous project. For a quadratic expression such as ax 2 + bx + c, a real root is any double number x such that ax 2 + bx + c = 0. For example, the quadratic...
Which operator do you use to read into a variable?
Specify, design, and implement a class that can be used to simulate a lunar lander, which is a small spaceship that transports astronauts from lunar orbit to the surface of the moon. When a lunar...
In this project, you will design and implement a class that can generate a sequence of pseudorandom integers, which is a sequence that appears random in many ways. The approach uses the linear...
Add a new method to the random number class of the previous project. The new method generates the next pseudorandom number but does not return the number directly. Instead, the method returns this...
Run some experiments to determine the distribution of numbers returned by the new pseudorandom method from the previous project. Recall that this method returns a double number in the range [0..1)....
What terminates input into an integer?
This project is a continuation of the previous project. Many applications require pseudorandom number sequences that are not uniformly distributed. For example, a program that simulates the birth of...
Write a class for rational numbers. Each object in the class should have two integer values that define the rational number: the numerator and the denominator. For example, the fraction 5/6 would...
Write a program that converts spelled-out numbers such as zero and two into digits, such as 0 and 2. When the user inputs a number, the program should print out the corresponding digit. Do it for the...
This project requires a little understanding of velocity and gravity, but dont let that scare you away! Its actually an easy project. The assignment is to write a class in which each object...
Give five examples of legal names that you shouldnt use because they are likely to cause confusion.
Using Appendix I as a guide, implement an applet for interactive testing of the sequence class from the previous project. Appendix I Its useful to have a small interactive test program to help you...
In this project, you will design and implement a class called Towers, which is part of a program that lets a child play a game called Towers of Hanoi. The game consists of three pegs and a collection...
Define a rule to help decide if a conversion from one type to another is safe or unsafe.
Implement the Statistician class from Project 2 on page 95, but include a new method that returns the median value of all the numbers. The median is a number that is greater than or equal to at least...
Implement the previous project with the following modification: All of the input numbers to the Statistician are required to be integers in the range from 0 to 100. This modification means that its...
Another way to store a collection of items is called a keyed bag. In this type of bag, whenever an item is added, the programmer using the bag also provides an integer called the key. Each item added...
Write a method that takes a linked list of integers and rearranges the nodes so that the integers stored are sorted into the order of smallest to largest, with the smallest integer in the node at the...
Write a program to solve quadratic equations. A quadratic equation is of the form ax 2 + bx + c = 0 If you dont know the quadratic formula for solving such an expression, do some research. Remember,...
Revise the set class (Programming Project 5 on page 169) so that it stores the items in a linked list instead of in an array. Data from Project 5 Using Appendix I as a guide, implement an applet for...
Revise the Statistician with median (Programming Project 15 on page 172) so that it stores the input numbers on a doubly linked list using the doubly linked node class from the previous project....
Do exercise 6, but with three string values. So, if the user enters the values Steinbeck, Hemingway, Fitzgerald, the output should be Fitzgerald, Hemingway, Steinbeck.
Reimplement the bag class from Figure 4.17 so that the items of the bag are stored with a new technique. Heres the idea: Each node of the noefw linked list contains two integers. The first integer is...
The bags clone method creates a copy of an ArrayBag. As with other clone methods, adding or removing elements from the original bag will not affect the copy, nor vice versa. However, these elements...
Modify the bag from the previous exercise so that all of the add methods attempt to make a clone of any item that is added to the bag. These clones are then put in the bag (rather than just putting a...
Enhance the calculator program given in Figure 6.5 on page 330 so that it has all of the following features: After one expression is evaluated, the user is asked if he or she wants to evaluate...
In Figure 6.5 on page 330, we presented a program to evaluate arithmetic expressions. In this exercise, you will write a similar program to evaluate boolean expressions. Rather than arithmetic...
Redo the calculator program given in Figure 6.5 on page 330, but this time implement it in a different way. To evaluate the arithmetic expression, your program will first convert the expression to...
Write a program that evaluates an arithmetic expression in infix notation, without full parentheses. Use the following algorithm: There are two stacks: a numbers stack and an operators stack. When a...
Suppose that you have n queens from a chess game, and that you also have an n-by-n chess board. Is it possible to place all n queen on the board so that no two queens are in the same row, no two...
In Figure 7.3, we presented a program that checks a string to see if the letters in the string read the same forward and backward. The previous exercise performed a similar check using words in place...
Find a good cookbook. Read the instructions for baking blueberry muffins (if you are in a country where blueberry muffins is a strange, exotic dish, use a more familiar dish instead). Please note...
Enhance the car wash simulation method in Figure 7.8 so that it has the following additional property. There is an additional parameter, which is a maximum length for the queue. When the queue gets...
A permutation is an ordered subset of a set. For example, say you wanted to pick a combination to a vault. There are 60 possible numbers, and you need three different numbers for the combination....
Build a regular expression that captures all nonempty sequences of letters other than file, for, and from. For notational convenience, you may assume the existence of a not operator that takes a set...
Write a simulation program for a small airport that has only one runway. There will be a queue of planes waiting to land and a queue of planes waiting to take off. However, only one plane can use the...
Do an airplane simulation that is more complex than the previous project. In this version, planes arrive for landing with a random amount of fuel, which determines how long they can remain in the...
Give a grammar that captures all levels of precedence for arithmetic expressions in C.
Write top-down and bottom-up grammars for the language consisting of all well-formed regular expressions. Arrange for all operators to be left associative. Give Kleene closure the highest precedence...
This project uses the Towers class from Chapter 3s Programming Project 12. For the project, write a recursive methodxtxhxat computes and prints a solution to the Towers of Hanoi game. The method...
Suppose that the expression grammar in Example 2.8 were to be used in conjunction with a scanner that did not remove comments from the input, but rather returned them as tokens. How would the grammar...
Implement a new method for the BTNode from Figure 9.10. The new method creates a Java Vector that contains the data from all the nodes in a tree, as specified in Figure 9.15. Details about the Java...
Java has a generic interface called Comparable. A class that implements the Comparable interface must have a method with this specification: compareTo public boolean compareTo(E obj) Compare this...
Give three concrete examples drawn from programming languages with which you are familiar in which a variable is live but not in scope.
Consider the design of a Fortran 77 compiler that uses static allocation for the local variables of subroutines. Expanding on the solution to the previous question, describe an algorithm to minimize...
Write a simple program in Scheme that displays three different behaviors, depending on whether we use let, let*, or letrec to declare a given set of names.
Give two examples of reasonable semantic rules that cannot be checked at reasonable cost, either statically or by compiler-generated code at run time.
Expand the class from Project 10 or 11 so that there is an extra method that produces a Java Iterator for the bag. Data from Project 10 Write a class for a bag of strings, where the strings are...
Showing 4500 - 4600
of 5000
First
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50