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
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...
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...
A class that is used as a basis for inheritance is called a _________. a. Derived class b. Subclass c. Base class d. Child class
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...
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,...
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...
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 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.
Consider the following grammar: G S $$ S A M M S | A a E | b A A E a B | b A | B b E | a B B (a) Describe in English the language that the grammar generates. (b) Show a parse tree for the...
Consider the following grammar : stmt assignment subr_call assignment id := expr subr call id ( arg list ) expr primary expr tail expr tail op expr primary id subr_call ( expr ) op + | -...
Consider the language consisting of all strings of properly balanced parentheses and brackets. (a) Give LL(1) and SLR(1) grammars for this language. (b) Give the corresponding LL(1) and SLR(1)...
Consider the following context-free grammar. G G B G N B ( E ) E E ( E ) N ( L ] L L E L ( (a) Describe, in English, the language generated by this grammar. (Your description should be a...
Refer back to the context-free grammar. Add attribute rules to the grammar to accumulate into the root of the tree a count of the maximum depth to which parentheses are nested in the program string....
We noted in Section 6.1.1 that most binary arithmetic operators are left associative in most programming languages. In Section 6.1.4, however, we also noted that most compilers are free to evaluate...
Consider the following pseudocode: What does this programprint if the language uses static scoping? What does it print with dynamic scoping? Why? x: integer -- global procedure set xln : integer) x:=...
Consider the following pseudocode: x : integer global procedure set x(n : integer) x := n procedure print x() write integer(x) procedure foo(S, P : function; n : integer) x : integer := 5 if n in...
Translate the following expression into postfix and prefix notation: [b + sqrt(b b 4 a c)]/(2 a) Do you need a special symbol for unary negation?
Modify the grammar of Figure 2.25 so that it accepts only programs that contain at least one write statement. Make the same change in the solution to Exercise 2.17. Based on your experience, what do...
Describe a plausible scenario in which a programmer might wish to avoid short-circuit evaluation of a Boolean expression.
Consider the following grammar for reverse Polish arithmetic expressions: E E E op | id op + | - | * | / Assuming that each id has a synthesized attribute name of type string, and that each E and...
Write a C++ preorder iterator to supply tree nodes to the loop in Example 6.69. You will need to know (or learn) how to use pointers, references, inner classes, and operator overloading in C++. For...
Consider the following CFG for floating-point constants, without exponential notation. (Note that this exercise is somewhat artificial: the language in question is regular, and would be handled by...
Write an LL(1) grammar with action routines and automatic attribute space management that generates the reverse Polish translation described in Exercise 4.7. Data From Exercise 4.7: Suppose that we...
In Example 7.53 we mentioned three ways to make the need for comparisons more explicit when defining a generic sort routine in C++: make the comparison routine a method of the generic parameter class...
Revise the algorithm of Figure 6.6 so that it performs an in-order enumeration, rather than preorder. Figure 6.6: class BinTree implements Iterable { BinTree left; BinTree right; T val; // other...
Use iterators to construct a program that outputs (in some order) all structurally distinct binary trees of n nodes. Two trees are considered structurally distinct if they have different numbers of...
(a) Give a generic solution to Exercise 6.19. Data From Exercise 6.19: Write a C++ preorder iterator to supply tree nodes to the loop in Example 6.69. You will need to know (or learn) how to use...
Continuing the previous exercise, suppose that A has row-pointer layout, and that i, j, and k are again available in registers. Show pseudo assembler code to load A[i, j, k] into a register. Assuming...
Consider the array indexing calculation of Example 8.25. Suppose that i, j, and k are already loaded into registers, and that As elements are integers, allocated contiguously in memory on a 32-bit...
In Example 11.59 we showed how to implement interactive I/O in terms of the lazy evaluation of streams. Unfortunately, our code would not work as written, because Scheme uses applicative-order...
Explain how to extend Figure 8.7 to accommodate subroutine arguments that are passed by value, but whose shape is not known until the subroutine is called at run time. sp- Ada: -- procedure foo (size...
Modify the method that calculates the sum of the integers between 1 and N shown in this chapter. Have the new version match the following recursive definition: The sum of 1 to N is the sum of 1 to...
Write a switch statement to convert a letter grade into an equivalent numeric value on a fourpoint scale. Set the value of the variable gradeValue to 4.0 for an A, 3.0 for a B, 2.0 for a C, 1.0 for a...
Write a program that simulates a bouncing ball by computing its height in feet at each second as time passes on a simulated clock. At time zero, the ball begins at height zero and has an initial...
We fixed justvowels so that it works with lowercase or uppercase vowels. Fix notvowels so that it doesnt print out uppercase vowels. (Try it as it is in the chapter, and you will see that it does...
Write a function to convert Celsius to Fahrenheit.
Write a general scaleUp function that takes in any picture and creates and returns a new picture twice as big using makeEmptyPicture(width,height).
Write a method called repl that accepts a String and a number of repetitions as parameters and returns the String concatenated that many times. For example, the call repl( "hello", 3) should return...
The next five questions refer to the following String elements: ["It", "was", "a", "stormy", "night"] Write the code to declare an ArrayList containing these elements. What is the size of the list?...
Write a recursive method called dedup that takes a string as a parameter and that returns a new string obtained by replacing every sequence of repeated adjacent letters with just one of that letter....
Write a denotational semantics mapping function for the following statements: a. Ada for b. Java do-while c. Java Boolean expressions d. Java for
What problem do we encounter when we try to construct an array of type E? How do we resolve this problem?
Define exception, exception handler, raising an exception, continuation, finalization, and built-in exception.
Consider the following program written in C syntax: For each of the following parameter- passing methods, what are all of the values of the variables value and list after each of the three calls to...
The starting value of an algorithm used to generate a range of random numbers is called the _________.
In a binary search of an array named MyArray, the first time the program runs, the value of Low will be ____________.
Which function temporarily converts a string to a number and then returns the number? a. Format b. FormatNumber c. String d. Val
In this exercise, you modify the application from Exercise 5. Use Windows to make a copy of the Guessing Game Solution folder. Rename the copy Modified Guessing Game Solution. Open the Guessing Game...
What does the following program print? public class Mystery { public static void main(String[] args) { int x = 1; int total = 0; while (x
In Listing 19.1, GenericStack is implemented using composition. Define a new stack class that extends ArrayList. Draw the UML diagram for the classes then implement GenericStack. Write a test program...
Write a program that prompts the user to enter a text file name and displays the number of vowels and consonants in the file. Use a set to store the vowels A, E, I, O, and U.
Write a program that displays a tic-tac-toe board, as shown in Figure 31.48b. A cell may be X, O, or empty. What to display at each cell is randomly decided. The X and O are images in the files x.gif...
There are several differences between the coding standards listed in this chapter. Give an explanation for these differences.
Write a program that reads a graph from a file and determines whether the graph is connected. The first line in the file contains a number that indicates the number of vertices (n). The vertices are...
Printing a grid. Write a program that prints the following grid to play tic-tac-toe. Of course, you could simply write seven statements of the form System.out.println("+--+--+--+"); You should do it...
Design a Customer class to handle a customer loyalty marketing campaign. After accumulating $100 in purchases, the customer receives a $10 discount on the next purchase. Provide methods void...
Discuss why some systems developers believe that a data model is one of the most important parts of the statement of information system requirements.
A SPARC implementation has K register windows. What is the number N of physical registers?
Draw a use case diagram for the following situation (state any assumptions you believe you have to make in order to develop a complete diagram). Then convert the use case diagram into a sequence...
Discuss how each of the following features is realized in SQL 2008: object identifier, type inheritance, encapsulation of operations, and complex object structures.
Consider the universal relation R = {A, B, C, D, E, F, G, H, I, J} and the set of functional dependencies F = {{A, B}{C}, {A}{D, E}, {B}{F}, {F}{G, H}, {D}{I, J}}. What is the key for R? Decompose R...
Consider the library relational database schema in Figure 6.6. Write a program segment that retrieves the list of books that became overdue yesterday and that prints the book title and borrower name...
What is the function of a DFD in the SDLC?
What functions do routers, gateways, and proxy servers serve in a network?
Review Section 8.2 and the comments about EHR usability. Research the current status of EHR usability and describe all noteworthy developments.
What is the primary objective of the evaluation and selection team in selecting a development strategy?
Imagine the design of a system used to register students at a university. Discuss the user, task, system, and environmental characteristics (Table 10-10) that should be considered when designing the...
What is outsourcing?
Stephanie Welsh worked for Petries database administrator. She had been overseeing two interns who were helping her translate conceptual database designs into physical designs. As they were finishing...
What are the differences between in-house e-commerce development with packaged solutions and service providers?
Consider the E-R diagram of Figure 9-21. a. Transform this E-R diagram into a set of 3NF relations. b. State and justify all referential integrity rules for the 3NF relations you created in Problem...
Why is there a trend toward giving an increasing fraction of chip area to cache memory?
Derive a minimal state table for an FSM that acts as a three-bit parity generator. For every three bits that are observed on the input w during three consecutive clock cycles, the FSM generates the...
Describe how to implement a capacity-limited queue, which uses the functions of a capacity-limited deque to perform the functions of the queue ADT in ways that do not throw exceptions when we attempt...
Write a program that prompts the user for an integer. Pass the integer to a method that determines whether the number is greater than 0; if it is, the method displays the number and passes one less...
Create a program with an enumeration that contains the names of the eight planets in our solar system. Prompt the user for a planet name and use the ordinal () method to display the planets position....
I. Describe the term separation of duties and why it is important in reducing the risk an organization takes on when limiting the chance an employee will violate information security and break the...
Write an application that prompts a user for the users month, day, and year of birth and uses the Local Date class to compute the day on which the user will become (or became) 10,000 days old. Save...
The remainder operator _____________. a. Is represented by a forward slash b. Must follow a division operation c. Provides the quotient of integer division d. Is represented by a percent sign
Write an application that prompts the user to enter an integer and displays its square root. Accept the users entry as a String using the next Line() method. Then try to use the Integer. parse Int()...
For the Bayes net shown in Figure S13.42, consider the query P(A|h), and the variable elimination ordering B, E, C, F, D. a. In the table below fill in the factor generated at each stepwe did the...
Which of the following is true about a one-to-one relationship? a. They are almost always a mistake. b. They create Cartesian joins in queries. c. They relate two tables using the primary key field...
What prevents a user from entering a reservation for a customer who has not yet been registered in the Customers table?
Which of the following statements is true about a one-to-many relationship? a. Every primary key field participates on the one side. b. Every foreign key field participates on the one side. c. Every...
The ERM emphasizes what part of a relational database? a. Attributes b. Relationships c. Primary key fields d. Foreign key fields