Ask Computer Engineering Expert

1. Which of the following would be a more appropriate choice for a method in a PhoneCharger class?

Voltage

Manufacturer

Current

Charge

Question 2.Object-oriented programming generally focuses on _____.

A. separating the interface from the implementation.

B. client side access to implementation details.

C. creating as many classes as possible.

D. code reuse with methods.

All of the above

None of the above

Only A, B, and D

Question 3. Which of the following components of a class definition do not have an access modifier?

State variables

Data members

Member methods

Destructor

None of the above

Question 4. Which of the following statements is/are true?

A. In general, reusable classes tend to have interfaces that are more abstract than concrete.

B. The compiler generated default constructor does the exact same job as any user defined default constructor

C. A private (helper) method is part of a class's interface

None of the above

Only A and B

Question 5. Which of the following method pairs are not examples of method overloading?

public void Bake() ; public int Bake()

public int Mix(int x, int y) ; public int Mix(int y, int x)

public int Shake(int x, int y) ; public int Shake(int x, int y, int z)

None of the above

Only A and B

Question 6. Which of the following statements is/are false?

Abstraction is the process of ignoring the high level information about a category entity or activity, while concentrating on the "unimportant" details.

The object-oriented paradigm permits the modeling of a software system in a more natural way compared to the procedural paradigm.

In object-oriented programming, we design the program as a set of cooperating objects.

None of the above

Question 7. You have been tasked to create an Automobile class and your boss wants you to consider the concept of encapsulation as you design your class. Which of the following actions will you take?

Declare as many class attributes public as you can, creating accessor/mutators for each one.

Package attributes and behaviors specific to an Automobile together.

Make sure to include a specific implementation for a drive method that all subclasses can inherit.

Declare the class as private.

All of the above

Question 8.A black box is a term used to describe a system that can be understood solely based on its inputs, a description of its _____ and the resulting outputs.

processing

inherited processes

attributes

accessors

Question 9. A class is designed with two public attributes: attributeOne and attributeTwo. attributeOne is an integer data type while attributeTwo is a string data type. Which pseudocode representation(s) of setters would be appropriate for this class?

int setAttributeOne(int newAttributeOne)

{

return attributeOne

}

void setAttributeOne(int newAttributeOne)

{

attributeOne = newAttributeOne

}

string setAttributeTwo (int newAttributeTwo)

{

attributeTwo = newAttributeTwo

}

void setAttributeTwo ()

{

attributeTwo = " "

}

Both A and C

None of the above

Question 10. How is the pure virtual function different from a regular function?

It can only be declared in an abstract class.

It is declared with =0 at the end of the function signature.

It does not contain function implementation.

All of the above

Question 11. A(n) _____ cannot be instantiated and therefore is used only to form related derived classes.

method

abstract method

class

abstract class

Question 12. 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) _____.

contract

inheritance hierarchy

has-a relationship

object constructed with a multi-arg constructor

All of the above

13.If you have a complete, working Box class that has been thoroughly tested, and you wish to add an overloaded displayVolume() method that can display the location and volume of a GraphicBox, how should this be accomplished?

Derive a new GraphicBox class from the first Box class.

Add the method to your existing Box class.

Make a brand new class.

Add the method in the same class as the main.

Question 14. An Order class and RushOrder class have what type of relationships?

The Order has-a RushOrder.

The Order is-a RushOrder.

The RushOrder has-an Order.

The RushOrder is-an Order.

Question 15. Why might it be better to create a derived class instead of adding a few lines of code to an existing Class?

Simplifies testing

No need to re-test the previously written class

Saves time on debugging the program

All of the above

None of the above

Question 16. Suppose class Child is derived from class Parent which in turn is derived from class GrandParent. When we destroy an object of class Child, three destructors are called: i) Child, ii) Parent, iii) GrandParent. What is the order?

Child, Parent, GrandParent

Parent, GrandParent, Child

GrandParent, Child, Parent

GrandParent, Parent, Child

Question 17.The ability to reuse objects already defined, perhaps for a different purpose, with modification appropriate to the new purpose, is referred to as _____.

information hiding.

inheritance.

redefinition.

overloading

Question 18. Which of the following is not a good example of a hierarchy that could be modeled with inheritance?

Airplanes

Geometric shapes

Animals

Prime numbers

Question 19. Examine the class definition. How many members does it contain?

class clockType

{

public:

void setTime(int, int, int);

void getTime()const;

void printTime() const;

void icrementSeconds();

void incrementMinutes();

void incrementHours();

bool equalTime(const clockType&) const;

private:

int hr;

int min;

int sec;

};

7

3

5

10

Question 20. Which of the following declares a pure virtual function in an abstract C++ class?

public void cookIngredients() {}

public void cookIngredients()

public void cookIngredients()=0;

public cookIngredients();

Question 21.Suppose that bClass is a class. Which of the following statements correctly derives the class dClass from bClass?

class dClass:: public bClass

{

//classMembersList

};

class dClass: private bClass

{

//classMembersList

};

class dClass:: protected bClass

{

//classMembersList

};

class bClass: public dClass

{

//classMembersList

};

Question 22. Data/information hiding and encapsulation improves construction and maintenance because: adding additional details is isolated to a single class.

program bugs are isolated to a single class.

programming to an interface makes the code more logical.

All of the above

None of the above

Question 23. What are some of the characteristics of a "good" comment?

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

Question 24. The purpose of a namespace is to:

organize your code.

gives you a way to create global types.

provide a container for logically related items.

All of the above

None of the above

ESSAY QUESTIONS

Briefly describe which elements of a class use the Camel case, and what are the best practices regarding the naming of these elements.

Question 1. Provide an example that shows how we can have Encapsulation without Data/Information Hiding in object-oriented programming.

Question 2. Given the following program description,

• identify the required classes/objects necessary to achieve the program requirements;

• briefly describe any relationships that might exist between your classes; and

• briefly describe the overall hierarchy of your proposed classes.

Program Description - You have been asked to create a program designed to keep track of the inventory in a person's house. The program must keep track of all items owned by the house's resident and their specific location in the house. A single room can contain any number of items and every item should have a unique ID to differentiate it from all the other items.

Question 3. How are pure virtual functions created? When a class contains one pure virtual function, what will happen? Can we still treat the class like a normal class?

Question 4. Consider the class Bicycle. Given your knowledge of some common components of bicycles

• show a class hierarchy in which the class Bicycle inherits from other classes, which, in turn, can also be inherited from yet other classes;

• discuss inheritance from class Bicycle for other closely related derived classes; and

• discuss the common components of class Bicycle.

Question 5. How does the "has-a" relationship relate to composition? Give an example of such a relationship.

Question 6. Define and implement the overloaded constructors that support the following test function for a StudentEmployee class. The data members for the StudentEmployee class are:

• age - integer number

• name - String

• DSI - String

• salary - floating point number

int main()

{ //s1 will take all default value

StudentEmployee s1();

//s2 will take all supplied values

StudentEmployee s2 (50, "Jackie Chan", "D87654321", 10000000.99);

//s3 will take supplied age value, name, DSI and salary will take default values

StudentEmployee s3 (25);

//s4 will take supplied age and name value, DSI and salary will take default values

StudentEmployee s4 (35, "Jenny");

//s5 will take supplied age, name and DSI value, salary will take default value

StudentEmployee s5 (45, "Jack", "D11223344");

//s6 will take supplied age, name and salary value, DSI will take default value

StudentEmployee s6 (60, "James Bond", 65000.0);

//s7 will take the same value of s2

StudentEmployee s7=s2;

//the rest of the code

}

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91331845
  • Price:- $19

Guranteed 24 Hours Delivery, In Price:- $19

Have any Question?


Related Questions in Computer Engineering

Does bmw have a guided missile corporate culture and

Does BMW have a guided missile corporate culture, and incubator corporate culture, a family corporate culture, or an Eiffel tower corporate culture?

Rebecca borrows 10000 at 18 compounded annually she pays

Rebecca borrows $10,000 at 18% compounded annually. She pays off the loan over a 5-year period with annual payments, starting at year 1. Each successive payment is $700 greater than the previous payment. (a) How much was ...

Jeff decides to start saving some money from this upcoming

Jeff decides to start saving some money from this upcoming month onwards. He decides to save only $500 at first, but each month he will increase the amount invested by $100. He will do it for 60 months (including the fir ...

Suppose you make 30 annual investments in a fund that pays

Suppose you make 30 annual investments in a fund that pays 6% compounded annually. If your first deposit is $7,500 and each successive deposit is 6% greater than the preceding deposit, how much will be in the fund immedi ...

Question -under what circumstances is it ethical if ever to

Question :- Under what circumstances is it ethical, if ever, to use consumer information in marketing research? Explain why you consider it ethical or unethical.

What are the differences between four types of economics

What are the differences between four types of economics evaluations and their differences with other two (budget impact analysis (BIA) and cost of illness (COI) studies)?

What type of economic system does norway have explain some

What type of economic system does Norway have? Explain some of the benefits of this system to the country and some of the drawbacks,

Among the who imf and wto which of these governmental

Among the WHO, IMF, and WTO, which of these governmental institutions do you feel has most profoundly shaped healthcare outcomes in low-income countries and why? Please support your reasons with examples and research/doc ...

A real estate developer will build two different types of

A real estate developer will build two different types of apartments in a residential area: one- bedroom apartments and two-bedroom apartments. In addition, the developer will build either a swimming pool or a tennis cou ...

Question what some of the reasons that evolutionary models

Question : What some of the reasons that evolutionary models are considered by many to be the best approach to software development. The response must be typed, single spaced, must be in times new roman font (size 12) an ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As