Expert Answers



1.  What happens right after the identification of classes in the object oriented design process? (Points : 5)
Determining the class responsibilities
Determining class interaction
Creating UML diagram
Developing SOW

2.  In what type(s) of situation(s) would it be best to make a new derived class from a base class? (Points : 5)
When your old class is a general form of what your new class should be
When you need to create a specialized class from an existing class
A and B
None of the above

3.  _____ is the ability to combine data and operations on that data into a single unit. (Points : 5)
Inheritance
Encapsulation
Polymorphism
Composition

4.  A black box is a term used to describe a system that can be understood solely based on its inputs, a description of its processing and the resulting _____. (Points : 5)
outputs
inherited processes
attributes
accessors

5.  Given a private attribute called species, which of the following are proper pseudocode implementations for a getter and a setter? (Points : 5)
void GetSpecies(){return species}
void SetSpecies(string newSpecies){ species = newSpecies }
string GetSpecies (){return species }
string SetSpecies (string newSpecies){return newSpecies }
string GetSpecies (){species = newSpecies }
void SetSpecies (string newSpecies){return species }
string GetSpecies (){return species }
void SetSpecies (string newSpecies){ species = newSpecies}

6.  You are tasked to create an EntertainmentSystem class and you want to minimize data dependencies. You also need to protect specific attributes from outside entities. What object-oriented concept(s) would you use to accomplish these goals? (Points : 5)
Composition of classes
Universal access to methods
Inheritance
Encapsulation
All of the above

7.  Which of the following statements are true? (Points : 5)
Interfaces are written across multiple files, unlike classes.
The name of an interface often begins with a lowercase “I” in C#.
Interfaces can be used to implement a form of triple inheritance.
Interfaces are not instantiated like a concrete class.

8.  Which of the following statements is/are false? (Points : 5)
Abstract methods may or may not contain a method body
Abstract methods may be defined in an abstract class, a regular class or an interface
Abstract methods do not specify a return type
All of the above
None of the above

9.  In terms of object-oriented programming, rules for the use of an application programming interface or framework can be enforced through the use of a(n) _____. (Points : 5)
encapsulation
inheritance hierarchy
contract
object constructed with a multi-arg constructor
None of the above

10.  Data/information hiding and encapsulation improves construction and maintenance because: (Points : 5)
Program bugs are isolated to a single class.
Programming to an interface makes the code more logical.
Both A and B
None of the above

11.  What are some of the characteristics of a “good” comment? (Points : 5)
Detailed comments should address all aspects of the code and structure
Code markers should be used to show what the developer still needs to do
Comments showing the intent of the code
All of the above
None of the above

12.  Which of the following allow a programmer to reduce the complexity of an object-oriented program? (Points : 5)
Create each class in a separate file
Combine multiple classes in a same file to allow easy access
Using one file to combine all the code to allow easy access
None of the above

13.  Assuming a class definition of a Horse that has a default constructor and constructor that accepts three string arguments, and the appropriate properties defined, how many objects are created in the code below?
static void Main(string[] args)
{Horse newObject;
Horse newHorseObject = new Horse();
Horse newHorse = new Horse(“Horse”, “Ben”, “Appaloosa”);
newObject = newHorse;
newObject = newHorseObject;}
(Points : 5)
3
4
2
5

14.  Which of the following is a proper implementation for a getter? (Points : 5)
intGetDayOfBirth() { return day;}
void GetDayOfBirth() {return day;}
intGetDayOfBirth (int day) {this.day = day;}
void GetDayOfBirth () {return day;}

15. Which of the following declares an abstract method in an abstract class? (Points : 5)
public abstract CalculateTip();
public abstract double CalculateTip();
public double abstract CalculateTip();
public double CalculateTip() {}

16. Does Encapsulation imply Data/Information Hiding in object-oriented programming or vice versa? Are these two terms the same? Please explain. (Points : 18)

17.  List the benefits of using inheritance. (Points : 18)

18.  What are the differences between inheriting interface and inheriting implementation? How do inheritance hierarchies designed for inheriting interface differ from those designed for inheriting implementation? (Points : 18)

19.  Given the following list of classes, attributes and methods,
identify which items are classes, which items are attributes and which items are methods;
identify which class each attribute and method belongs to; and
suggest a class hierarchy given your list of classes.
*Note – no particular capitalization scheme is used in the list below to differentiate between classes, methods and attributes.

20.  Briefly describe what an Interface is and how it can be used in an object-oriented program. Provide example pseudocode showing how an IComputer Interface might be constructed. (Points : 18)


21. Keeping in mind all object-oriented programming best practices, create a class for a Keyboard, with the following specifications:
· Specify two data members
· Default Constructor
· Overloaded Constructor which takes both data member values as input.
· Generate a unique identification number for each object instantiated from this class. Use a static data member to keep track of the identification number last assigned to an object so that duplications will not occur. Code the necessary portion of the class definition so as to support this requirement.
· Show a statement which instantiates an object of this class using the overloaded constructor.
You do not need to provide any accessor/mutator methods or other methods. (Points : 22)
22. Briefly describe best practices as it relates to naming classes. (Points : 18) 

Comp 230 Final Exam



1. (TCO 1) Write the Windows CLI NET commands that will turn the Spooler service OFF and then ON. (Points : 13)

2. (TCO 1) Write the Windows CLI commands that will Clear the screen; Turn off Command echo; and display the current IP address, Subnet Mask, and Default Gateway. (Points : 13)

3. (TCO 2) Write the VBScript code lines that perform the following tasks: Define a variable age that is initialized to 25. Display a message that uses the variable to display “Your age is 25, but in 10 years you will be 35.” where the value 25 and 35 use the variable age. (Points : 14)

4. (TC0 3) Given the variables hoursWorked and payRate, write the VBScript code that will calculate grossPay such that all hoursWorked 40 will be paid at time and a half. (Points : 14)

5. 1. (TCO 4) Write the VBScript code that initializes all the variables in the numArray(100) to the value numArray(0) =1, numArray(1) =2,…,numArray(100) =101. (Points : 14)

6. (TCO 5) Write a VBScript function called GetName( ) that prompts the user to input his or her name and returns the name value. Use the StdIn and StdOut streams for input and output. (Points : 14)

7. (TCO 6) Write the VBScript code that defines the Scripting.FileSystemObject and the file C:\Data\DataFile.txt for writing. Make sure the file will be created if it doesn’t exist, and ensure that the format is ASCII. (Points : 14)

8. (TCO 7) Assuming that you are connected to a database called Computers.mdb with the fields Computer, Hostname Room_Num, CPU_Type, Num_CPUs, Bit_Size, OS_Type, Memory, Speed and HDD_Size, write the SQL Query String sqlStr such that all the fields will be displayed for the records that indicate a speed less than two and a memory value less than four. The returned records should be sorted by Room_Num. (Points : 14)

Multiple Choice Answers

Question 1
Accrued interest resulting from a trade note receivable would have which effect on the categories?
A. Total assets would be increased.
B. Owner’s equity would be decreased.
C. Total liabilities would be increased.
D. None of these answers are correct.

Question 2
A promissory note comes due on the:
A. maturity date.
B. issue date.
C. interest note.
D. discount date.

Question 3
Interest on a $3,000, 10% promissory note for four months is:
A. $100.
B. $30.
C. $75.
D. $300.

Question 4
Steadman’s Computer endorses a customer’s note dated June 17 to the bank on August The interest rate on the note is 10%, and the bank discount rate is 12%. The note matures on September 6. The discount period is:
A. 60 days.
B. 0 days.
C. 81 days.
D. 21 days.

Question 5
On February 15, Weber Services discounts a customer’s 9%, 90-day, $10,000 note dated January 10. The discount rate charged by the bank is 12%. The discount period is:
A. 90 days.
B. 0 days.
C. 54 days.
D. 36 days.

Question 6
Interest expense is on a merchandise company’s income statement under the heading:
A. Daily Expenses.
B. Borrowing Expenses.
C. Operating Expenses.
D. Other Expenses or Interest Expense.

Question 7
Given a 360-day year, the interest expense on a $7,300, 8%, 77-day promissory note payable is:
A. $124.91.
B. $459.09.
C. $584.00.
D. some other amount.

Question 8
The proceeds from discounting a note receivable are the:
A. maturity value – discount.
B. principal – discount.
C. maturity value minus principal.
D. principal + discount.

Question 9
Martin Company needs additional time to pay its accounts payable to Boster Company. Martin makes a written promise to pay Boster the amount on a certain date. Boster records this transaction as follows:
A. debit Cash; credit Accounts Receivable.
B. debit Accounts Receivable; credit Notes Receivable.
C. debit Notes Receivable; credit Accounts Receivable.
D. debit Notes Receivable; credit Cash.

Question 10
A $6,500, 12% note dated April 23 for 88 days was discounted on June 2 at 14%. The number of days in the discount period is:
A. 40 days.
B. 48 days.
C. 88 days.
D. some other number.

Question 11
There was no accrual for interest on a promissory note receivable; this error would cause:
A. the period’s net income to be overstated.
B. the period end assets to be overstated.
C. the period end liabilities to be understated.
D. the period’s net income to be understated.

Question 12
Using a 360-day year, interest calculated for 180 days on a $7,000, 9% promissory note is:
A. $315.
B. $310.
C. $630.
D. some other amount.

Question 13
Brooke Company grants James Decorating additional time to pay its past due account. James makes a written promise to pay Brooke the amount on a certain date. James records this transaction as follows:
A. debit Accounts Payable; credit Notes Payable.
B. debit Cash; credit Accounts Receivable.
C. debit Accounts Receivable; credit Notes Receivable.
D. debit Notes Receivable; credit Accounts Receivable.

Question 14
A $6,500, 12% note dated April 23 for 88 days was discounted on June 2 at 14%. The amount of the discount (using a 360-day year) is:
A. $190.67.
B. $124.89.
C. $780.00.
D. $115.56.

Question 15
The basic formula for calculating the interest on a note is:
A. Interest = Principal × Rate × Time.
B. Interest = (Principal × Rate) – Time.
C. Interest = Principal × Rate/ Time.
D. Interest = (Principal × Time) + Rate.

Question 16
The company returned $200 of damaged merchandise. The entry to record this under the periodic inventory method is:
A. debit Merchandise Inventory $200; credit Accounts Payable $200.
B. debit Accounts Payable $200; credit Purchases Returns and Allowances $200.
C. debit Accounts Payable $200; credit Merchandise Inventory $200.
D. debit Cost of Goods Sold $200; credit Accounts Payable $200.

Question 17
A credit customer purchased $450 worth of items. Two days later, the customer returned $300 worth of those items. The entry to record this under the perpetual inventory method would include:
A. a debit to Sales Returns and Allowances $300; credit Accounts Receivable $300.
B. a credit to Cost of Goods Sold for our cost.
C. a debit to Merchandise Inventory for our cost.
D. All of the above.

Question 18
As a result of understating ending inventory by $10,000 at the end of Year 1:
A. there will be no effect on net income for Year 2.
B. net income for Year 2 will be overstated.
C. net income for Year 2 will be understated.
D. ending inventory for Year 2 will be overstated.

Question 19
Last year’s ending inventory was overstated. This error would cause:
A. this period’s net income to be understated.
B. this period’s end assets to be overstated.
C. this period’s net income to be overstated.
D. None of these are correct.

Question 20
The inventory method that assumes the cost of the ending inventory consists of new inventory is:
A. FIFO.
B. LIFO.
C. weighted-average.
D. specific invoice.

Question 21
Chewy Candy has a beginning inventory of $1,000 with a retail value of $1,800. June purchases were $3,000, with a retail value of $4,700 and retail sales were $4,200.What is the June 30 estimated ending inventory at cost under the retail method?
A. $4,161
B. $949
C. $1,416
D. $351

Question 22
An understated cost of goods sold of $100 will cause:
A. income to be understated.
B. merchandise inventory to be understated.
C. income to be overstated.
D. None of these answers are correct.

Question 23
The advantage of the weighted-average method is:
A. flow of goods and flow of costs are the same.
B. old costs are matched against current income.
C. an equal cost is assigned to each unit so net income does not fluctuate as much as with other methods.
D. it matches current selling prices and current costs.

Question 24
Barry’s Books uses a periodic inventory system. Barry’s Books sold 45 copies of Helpful Hints during September. Other data for September include:
Sep. 1 Balance 12 books @ $20
8 Purchased 10 books @ $21
17 Purchased 30 books @ $22
25 Purchased 15 books @ $24
Ending inventory under the FIFO method is:
A. $528.
B. $514.
C. $440.
D. $450.

Question 25
This method assumes that the most recently acquired goods are sold first.
A. Weighted-average method
B. Specific invoice method
C. FIFO
D. LIFO

Question 26
If the ending inventory is overstated in period 1:
A. goods available for sale in period 2 are overstated.
B. cost of goods sold in period 2 is overstated.
C. beginning inventory in period 2 is overstated.
D. All of these answers are correct.

Question 27
The perpetual inventory system is a system which:
A. updates inventory continuously.
B. uses either FIFO, LIFO, weighted-average, or specific invoice method.
C. never needs a physical inventory taken.
D. both A and B.

Question 28
This inventory method produces the lowest income tax during a period of inflation.
A. Weighted-average
B. FIFO
C. LIFO
D. All would have the same tax effect.

Question 29
The inventory method that matches old costs with current selling prices is:
A. specific invoice.
B. weighted-average.
C. LIFO.
D. FIFO.

Question 30
The journal entry to record the return of a purchase of inventory under the periodic system includes a:
A. credit to Merchandise Inventory.
B. credit to Purchases Returns and Allowances.
C. debit to Merchandise Inventory.
D. credit to Purchases.

Multiple Choice Answers



(TCO 7) In terms of object-oriented programming, rules for the use of an application programming interface or framework can be enforced through the use of a(n) _____. (Points : 5)
encapsulation
inheritance hierarchy
contract
object constructed with a multi-arg constructor
None of the above

(TCO 8) Data/information hiding and encapsulation improves construction and maintenance because: (Points : 5)
Program bugs are isolated to a single class.
Coupling is increased.
Programming to an interface makes the code and design difficult.
All of the above
None of the above

Question 5.5. (TCO 8) What are some of the characteristics of a “good” comment? (Points : 5)
Summary comments that distill the logic of an algorithm
Comments are well written and clear
Comments showing the intent of the code
All of the above
None of the above

(TCO 9) Which of the following allow a programmer to reduce the complexity of an object-oriented program? (Points : 5)
Create each class in a separate file
Using namespaces as a container for logically related items
Using namespaces to create global types
All of the above
None of the above

(TCO 1) Assuming a class definition of a Bird that has a default constructor and constructor that accepts three string arguments, and the appropriate properties defined, how many objects are created in the code below?
static void Main(string[] args)
{Bird newObject;
Bird newBirdObject;
Bird newBird = new Bird(“Bird”, “Pockets”, “Quaker Parakeet”); ;
newObject = null;}
(Points : 5)
0
2
3
1

(TCO 2) Given a private attribute called favoriteColor, which of the following are proper implementations for a getter and a setter? (Points : 5)
int GetFavoriteColor(){return favoriteColor;}, int SetFavoriteColor(int favoriteColor){return favoriteColor;}
void GetFavoriteColor (){return favoriteColor;}, void SetFavoriteColor (int favoriteColor){this.favoriteColor = favoriteColor;}
string GetFavoriteColor (){return favoriteColor;}, void SetFavoriteColor (string favoriteColor){this.favoriteColor = favoriteColor;}
string GetFavoriteColor (){this.favoriteColor = favoriteColor;}, void SetFavoriteColor (string favoriteColor){return favoriteColor;}

(TCO 7) Which of the following declares an abstract method in an abstract class? (Points : 5)
public abstract CalculateTip();
public abstract double CalculateTip();
public double abstract CalculateTip();
public double CalculateTip() {}

(TCO 2) A class is designed with three public attributes: attributeOne, attributeTwo and attributeThree. attributeOne is an integer data type, attributeTwo is a double data type and attributeThree is a string data type. Which pseudocode representation(s) of setters would be appropriate for this class? (Points : 5)
A. int SetAttributeOne(int newAttributeOne)
{ return attributeOne}
B. void SetAttributeTwo(double newAttributeTwo)
{ attributeTwo = newAttributeTwo}
C. string SetAttributeThree (int newAttributeThree)
{ attributeThree = newAttributeThree}
D. void SetAttributeOne ()
{ attributeOne = 0}
Both A and C
None of the above

(TCO 2) You are tasked to create an EntertainmentSystem class and you want to minimize data dependencies. You also need to protect specific attributes from outside entities. What object-oriented concept(s) would you use to accomplish these goals? (Points : 5)
Composition of classes
Universal access to methods
Inheritance
Encapsulation

(TCO 7) Which of the following statements are true? (Points : 5)
Interfaces contain a list of methods to be implemented later.
Interfaces contain at least one abstract and one implemented method.
Interfaces are instantiated just like regular classes.
An Interface is a very specific type of class implementation.

(TCO 7) Which of the following statements is/are true? (Points : 5)
Interfaces contain both regular and abstract methods
Abstract classes always provide implementations for all of their methods
Abstract methods can be inherited by subclasses
None of the above