All Matches
Solution Library
Expert Answer
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
Tutors
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
Ask a Question
Search
Search
Sign In
Register
study help
computer science
programming language pragmatics
Questions and Answers of
Programming Language Pragmatics
Why did we type cast dividend and divisor in the function Divide?
The solution to the Case Study did not consider negative fractions. 1. How should a negative fraction be represented? 2. Which of the member functions would have to be changed to represent negative
One of the member functions in the Case Study needs an additional test. Which function is it, and what should the data be?
Name four tools used in software design.
Define information hiding.
Name four types of step-wise refinement.
What is the key feature of top-down design?
What characterizes functional decomposition?
Name two visual tools used by software developers.
In reviews and inspections, what is being reviewed or inspected?
Give the basic design of a test driver.
Why is exhaustive code-coverage testing virtually impossible?
Why is exhaustive data-coverage testing virtually impossible?
Explain what we mean by “data abstraction.”
What is data encapsulation? Explain the programming goal “to protect our data abstraction through encapsulation.”
Name three perspectives from which we can view data. Using the logical data structure “a list of student academic records,” give examples of what each perspective might tell us about the data.
Consider the ADT GroceryStore. 1. At the application level, describe GroceryStore. 2. At the logical level, what grocery store operations might be defined for the customer? 3. Specify (at the logical
What composite types are predefined in the C++ language?
Describe the component selectors for structs and classes at the logical level.
Describe the accessing functions for structs and classes at the implementation level.
Describe the component selectors for one-dimensional arrays at the logical level.
Describe the accessing functions for one-dimensional arrays at the implementation level.
1. Declare a one-dimensional array, name, that contains 20 characters. 2. If each character occupies one “cell” in memory, and the base address of name is 1000, what is the address of the cell
1. Declare a one-dimensional array type, WeatherListType, of WeatherType components, to be indexed by values of type MonthType. Declare a variable, yearlyWeather, of WeatherListType. 2. Assign the
1. Declare a two-dimensional array, decadeWeather, of WeatherType components, to be indexed by values of type MonthType in the first dimension. 2. Draw a picture of decadeWeather. 3. Assign the value
1. Define a three-dimensional array at the logical level. 2. Suggest some applications for three-dimensional arrays.
Construct a member-length-offset table for StudentRecord. typedef char String[10]; struct Student Record { String firstName; String lastName; int id; float gpa; int currentHours; int totalHours; };
If the base address of student is 100, what address does the compiler generate as the target of the following assignment statement? typedef char String[10]; struct Student Record { String firstName;
How much space does the compiler set aside for students? typedef char String[10]; struct Student Record { String firstName; String lastName; int id; float gpa; int currentHours; int totalHours; };
Indicate which predefined C++ types would most appropriately model each of the following (more than one may be appropriate for each): 1. a chessboard2. information about a single product in an
What C++ construct is used to represent ADTs?
Explain the difference between a C++ struct and class.
How is the client prevented from directly accessing the details of an instance of a class?
1. The details of a private member can be seen by the user of a class. (True or False?) 2. The details of a private member may be accessed by a client program. (True or False?)
Why is it good practice to put a class declaration in one file and the implementation in another?
Name three ways that classes can relate to each other.
Distinguish between composition and inheritance.
Distinguish between a base class and a derived class.
Does a derived class have access to the private data members of the base class?
Does a derived class have access to the public member functions of the base class?
1. Write the specification for an ADT SquareMatrix. (A square matrix can be represented by a two-dimensional array with N rows and N columns.) You may assume a maximum size of 50 rows and columns.
Date Type keeps only the integer representation of the month, day, and year. When a month is wanted in string form, the string is calculated. An alternate approach would be to add a string field to
What changes would be necessary if the number of days in the month were carried as a data field in class DateType rather than being looked up when necessary? Would this change make the use of a
Compare and contrast the implementation of class Date Type used in the Case Study and the solution proposed in Exercises 29 and 30. These two approaches represent the classic trade-off between space
These two approaches represent the classic trade-off between space and algorithm complexity. Please comment.Exercises 29DateType keeps only the integer representation of the month, day, and year.
The order of sorting an array of N items using one of the better sorting algorithms such as Quicksort. 1. O(1) 2. O(logN) 3. O(N) 4.O(N logN) 5. O(N*N) 6. O(N*N*N)
The order of sorting an array of N items using one of the slower sorting algorithms such as SelectionSort. 1. O(1) 2. O(logN) 3. O(N) 4. O(N logN) 5. O(N*N) 6. O(N*N*N)
The order of an algorithm that decrements every element in a three-dimensional table of N rows. 1. O(1) 2. O(logN) 3. O(N) 4. O(N logN) 5. O(N*N) 6. O(N*N*N)
The order of an algorithm that increments every element in a twodimensional table of N rows. 1. O(1) 2. O(logN) 3. O(N) 4. O(N logN) 5. O(N*N) 6. O(N*N*N)
The order of comparing three items. 1. O(1) 2. O(logN) 3. O(N) 4. O(N logN) 5. O(N*N) 6. O(N*N*N)
True or False? O(N) is called linear time.
True or False? O(N) is called log time.
True or False? O(N*N) is called quadratic time.
True or False? O(1) is called constant time.
The Unsorted List ADT is to be extended with a Boolean member function, IsThere, which takes as a parameter an item of type ItemType and determines whether there is an element with this key in the
Rather than enhancing the Unsorted List ADTs by adding a member function IsThere, you decide to write a client function to do the same task. 1. Write the specifications for this function. 2. Write
An Unsorted Type ADT is to be extended by the addition of function SplitLists, which has the following specifications: 1. Implement SplitLists as an array-based member function of the Unsorted List
Implement SplitLists described in Exercise 3 as a client function.An Unsorted Type ADT is to be extended by the addition of function SplitLists, which has the following specifications: Exercise
The specifications for the Unsorted List ADT state that the item to be deleted is in the list. 1. Rewrite the specification for DeleteItem so that the list is unchanged if the item to be deleted is
Redo Exercise 5(b) and 5(d), using a linked implementation.Exercise 5b. Rewrite the specification for Delete Item so that all copies of the item to be deleted are removed if they exist.d. Implement
7. 1. Explain the difference between an array-based and a linked representation of a list. 2. Give an example of a problem for which an array-based list would be the better solution. 3. Give an
True or False? If you answer False, correct the statement. 1. An array is a random-access structure. 2. A sequential list is a random-access structure. 3. A linked list is a random-access structure.
Give the values of the following expressions: 1. ptr1->info 2. ptr2->next->info 3. listData->next->next->info
Are the following expressions true or false? 1. listdata->next == ptr1 2. ptr1->next->info == 60 3. ptr2->next == NULL 4. listData->info == 25
Decide whether the syntax of each of the following statements is valid or invalid. If it is valid, mark it OK; if it is invalid, explain what is wrong. 1. listData->next = ptr1->next; 2.
Write one statement to do each of the following: 1. Make listData point to the node containing 45. 2. Make ptr2 point to the last node in the list. 3. Make listData point to an empty list. 4. Set the
An Unsorted List ADT is to be extended by the addition of a member function Head, which has the following precondition and postcondition:Precondition: list has been initialized and is not
An Unsorted List ADT is to be extended by the addition of function Tail, which has the following precondition and postcondition:Precondition: list has been initialized and is not empty.Postcondition:
DeleteItem does not maintain the order of insertions because the algorithm swaps the last item into the position of the one being deleted and then decrements length. Would there be any advantage to
Give a Big-O estimate of the run time for the functions you wrote in Exercises 5 and 6.Exercise 5The specifications for the Unsorted List ADT state that the item to be deleted is in the list. 1.
17. 1. Change the specifications for the array-based Unsorted List ADT so that PutItem throws an exception if the list is full. 2. Implement the revised specifications in (a). Statements int value;
Based on the following declarations, tell whether each statement below is syntactically legal (yes) or illegal (no). int* p; int*q; int* r; int a; int b; int c; int* p; int* q: int* r; int a; int b;
The following program has careless errors on several lines. Find and correct the errors and show the output where requested. #include int main () { } int* ptr: int* temp; int x; ptr = new int; *ptr =
Read the code segment and fill in blank #20. 1. NULL 2. True 3. false 4. listData 5. answer not shown 4 Class Unsorted Type { public: //all the prototypes go here. private: int length; Node Type*
Read the code segment and fill in blank #21. 1. true 2. !found 3. false 4. moreToSearch 5. answer not shown 4 Class Unsorted Type { public: //all the prototypes go here. private: int length; Node
Read the code segment and fill in blank #22. 1. item. Compared To (listData->info) 2. item. Compared To (location->next) 3. item.ComparedTo(location->info) 4. item. Compared To (location) 5.
Read the code segment and fill in blank #23. 1. item 2. *location.next 3. (*location).next 4. predLoc 5. answer not shown 4 Class Unsorted Type { public: //all the prototypes go here. private: int
Read the code segment and fill in blank #24. 1. false 2. true 3. predLoc == NULL 4. location != NULL 5. answer not shown 4 Class Unsorted Type { public: //all the prototypes go here. private: int
Read the code segment and fill in blank #25. 1. preLoc 2. location 3. predLoc->next 4. location->next 5. answer not shown 4 Class Unsorted Type { public: //all the prototypes go here. private:
Read the code segment and fill in blank #26. 1. predLoc == NULL 2. location == NULL 3. predLoc == location 4. predLoc->next == NULL 5. answer not shown 4 Class Unsorted Type { public: //all the
Read the code segment and fill in blank #27. 1. predLoc 2. location 3. location->next 4. listData 5. answer not shown 4 Class Unsorted Type { public: //all the prototypes go here. private: int
Read the code segment and fill in blank #28. 1. listData 2. predLoc->next 3. location->next 4. newNode->next 5. answer not shown 4 Class Unsorted Type { public: //all the prototypes go here.
The Sorted List ADT is to be extended with a Boolean member function, Is There, which takes as a parameter an item of type Item Type and determines whether there is an element with this key in the
Redo Exercise 1 (c) using a linked implementation.Exercise 1 (c) c. Write the array-based function definition using the binary search algorithm.
Rather than enhancing the Sorted List ADTs by adding a member function IsThere, you decide to write a client function to do the same task. 1. Write the specifications for this function. 2. Write the
Write a client function that merges two instances of the Sorted List ADT using the following specification. MergeLists(SortedType list1, SortedType list2, SortedType& result) 1. Write the
Rewrite Exercise 4, making MergeLists an array-based member function of the Sorted List ADT.Exercise 4Write a client function that merges two instances of the Sorted List ADT using the following
Rewrite Exercise 5, making MergeLists a linked member function of the Sorted List ADT.Exercise 5Rewrite Exercise 4, making MergeLists an array-based member function of the Sorted List ADT.Exercise
The specifications for the Sorted List ADT state that the item to be deleted is in the list. 1. Rewrite the specification for DeleteItem so that the list is unchanged if the item to be deleted is not
A Sorted List ADT is to be extended by the addition of function SplitLists, which has the following specifications:SplitLists(SortedType list, ItemType item, SortedType& list1, SortedType&
A Sorted List ADT is to be extended by the addition of a member function Head, which has the following precondition and postcondition: 1. Will this addition be easy to implement in the arraybased
A List ADT is to be extended by the addition of function Tail, which has the following precondition and postcondition: 1. Will this addition be easy to implement in the arraybased sortedType?
1. Change the specifications for the Sorted List ADT so that PutItem throws an exception if the list is full. 2. Implement the revised specifications in (a) using an array-based implementation. 3.
Write a class based on class UnsortedType as a bounded linked implementation. Provide a parameterized constructor that takes the maximum number of items as a parameter. If function PutItem is called
Write a class based on class SortedType as a bounded linked implementation. Provide a parameterized constructor that takes the maximum number of items as a parameter. If function PutItem is called
Write a class based on class UnsortedType as an unbounded array-based implementation. If the dynamically allocated array is full, create an array double the size and move the elements into it.
Write a class based on class SortedType as an unbounded arraybased implementation. If the dynamically allocated array is full, create an array double the size and move the elements into it.
What are the major steps in performing object-oriented design?
In the object-oriented design of an airline passenger reservation program, suppose that “airplane” has been identified as one object and “airplane seat” has been identified as another object.
The OOP phrase “instance variable” is equivalent to what C++ construct?
Showing 200 - 300
of 818
1
2
3
4
5
6
7
8
9