CIS 247 DEVRY FINAL EXAM 4 DIFFERENT VERSIONS
Visit Below Link, To Download This Course:
CIS 247 DeVry Final Exam (4 Different
Versions)
CIS247
CIS 247 DeVry Final Exam (4 Different
Versions)
Version 1
1. Design a class named Fan to represent a fan. The class
contains:
an int data field named speed that specifies
the speed of the fan. A fan has three speeds indicated with a value 1, 2, 3.
A bool data field named on that specifies
whether the fan is on.
A double data field named radius that
specifies the radius of the fan.
A no-arg constructor that creates a default
fan with speed = 1, and radius = 10
The accessor and mutator functions for all the
data fields.
NOTE: JUST CREATE fan.h and fan.cpp – no need
to create the main.cpp – I just want to see the design of the class. (Points :
18)
2. Create a class called person that can hold a person’s
name and age – also use dateType from class exercises to hold the person’s
birthday in the person class.
Create the necessary attributes, accessor and
mutator methods, a print function, and a constructor WITH arguments
Note: Create the class person.h and person.cpp
only – you don’t need the main.cpp
Note: You do not need to include the dateType
class in your answer just show me how you would use an object of the dateType
class in your person class. (Points : 18)
3. Create a class called Child that inherits from the person
class from the previous question.
Aside from entering a child’s name, age and
bithday using the person class.
The Child class should allow for entering what
grade the child is in and the child’s gender.
Create the necessary attributes, accessors,
mutators, print function, and a constructor WITH arguments.
4. Create a class called parent that inherits from the
person class – aside from setting the adult’s name, age and birthday using the
person class – you should also be able to set the parent’s occupation, spouse’s
name, whether they are mom or dad, and the number of children they have.
Create the necessary attributes, accessors,
mutators, print function, and a constructor WITH arguments.
Note: Create adult.h and adult.cpp only – not
the main.cpp (Points : 18)
5. Create a class called simpleMath – this class should have
two int attributes and accessor and mutator methods to set and get those two
int attributes – and a calcSum method that returns the sum of the two ints, a
calcDifference method that returns the difference of the two ints, a
calcProduct method that returns the product of the two ints, and a calcDivision
method that returns the division result of the two ints. Also make sure to
create a constructor WITH arguments.
(The order of a/b or b/2 , a-b, b-a, is up to
you)
Note: Just need to create the simpleMath.h and
simpleMath.cpp files not main.cpp (Points : 18)
6. Create a class called Coin with one string attribute.
Create the proper accessor/mutator methods for
the attribute.
Create a constructor that takes no arguments
that sets the string to “Unknown”
Create a method that returns the numeric value
of the coin string name.
For example:
.25 should be returned if the string attribute
holds “Quarter”
.05 should be returned if the string attribute
holds “Nickel”
etc.
Note: Just write out Coin.h and Coin.cpp – no
need for main.cpp (Points : 18)
7. Put the person, child, and the parent classes together –
keep in mind that person also has a composition with a dateType object. (You
don’t need dateType.h and dateType.cpp in your answer here – but might need it if
you want to compile this in visual studio)
Edit your classes –
1) Make the print function in the person class
a pure virtual function – which makes person class an abstract class
2) Make the parent class also contain a child
object array so that in the parent class you can not only put in how many
children the parent has but that many array objects holding each of the child’s
name, age, birthday, grade, and gender.
3) Edit the parent class print function so
that it prints both the parent object information and the child information.
Create your void main –
In your void main create one dynamic instance
of a parent object – and ask a user (assuming they are a parent) for their
name, age, birthday, occupation, spouse’s name, whether they are mom or dad,
number of children. Then for each children ask for the child’s name, age,
birthday, grade, and gender.
Once you set all of this information for the
dynamic parent object. Call the print function from the parent object so that
it displays all of this information back to the user.
Note: Since I can see the classes from your
previous answers – just paste in here the editted methods from the classes you
made and the void main code. (Points : 22)
Version 2
1. (TCO 8) Briefly describe best practices as it
relates to naming classes.
2. (TCO 2) Does Encapsulation imply
Data/Information Hiding in object-oriented programming or vice versa? Are these
two terms the same? Please explain. (Points : 18)
3. (TCO 4) What is inheritance and what are the
major benefits of using inheritance? What programming technique shall you
follow when the base class methods are not appropriate for the derived class
object?
4. (TCO 6) What is static binding? What is dynamic binding? How do
you distinguish between static binding and dynamic binding?
5. . (TCO 2) 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.
6. (TCO 2) Briefly describe what an Interface is and how
it can be used in an object-oriented program. Provide example pseudocode
showing how an IAnimal Interface might be constructed. (Points : 18)
7. (TCO 2) Keeping in mind all object-oriented programming best
practices, create a class for a Cabinet, with the following specifications:
Version 3
1. (TCO 8) Briefly describe which elements of a class use the Pascalcase, and what are the best practices regarding the naming of these elements.(Points : 18)
2. (TCO 2) Does Encapsulation imply Data/Information Hiding in
object-oriented programming or vice versa? Are these two terms the same? Please
explain. (Points : 18)
3. (TCO 2) 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
4. (TCO 7) How do you distinguish between virtual functions and pure
virtual functions? How do you use the abstract class and the methods defined
inside the abstract class? (Points : 18)
5. (TCO 4) Explain how inheritance allows you to use knowledge of
general situations and apply it to more specific categories. List the benefits
of using inheritance. (Points : 18)
6.(TCO 6) How does polymorphism promote extensibility? How does
polymorphism enables you to program “in the general” rather than “in the
specific.” Explain the key advantages of programming “in the general.” (Points
: 18)
7. (TCO 2) Define and implement the overloaded constructors that
support the following test function for an Employee class. The data members for
the Employee class are:
Version 4
1. (TCO 1) Object-oriented programming does not generally focus on
_____. (Points : 5)
- data abstraction.
- cutting down on the lines of code.
- client side access to implementation details.
- information hiding.
- All of the above
- None of the above
- Only B and C
2. (TCO 2) Which of the following components of a class definition
can be overloaded? (Points : 5)
- Properties
- Destructors
- Static data members
- All of the above
- None of the above
3. (TCO 5) Which of the following method pairs are examples of method
overloading? (Points : 5)
- public void Dance() ; public int Dance(int x)
- public int Walk(int x, int y) ; public void Walk(int x,
int y, int z)
- public int Jump(int x, int y) ; public int Jump(int y,
int x)
- All of the above
- Only A and B
4. (TCO 1) Which of the following statements is/are true? (Points :
5)
- Abstraction is the process of ignoring the unimportant details
about a category entity or activity, while concentrating on the high level
information.
- Abstraction is the basic concept of the object-oriented
paradigm.
- Objects are created during program execution and
eventually destroyed.
- All of the above
5. (TCO 1) Which of the following would be the most appropriate
choice for a method in a Cup class? (Points : 5)
- Drink()
- Hot()
- Break()
- Color()
6. (TCO 2) Which of the following statements is/are true? (Points :
5)
- A private (helper) method can only be used inside the
class. It cannot be called outside of the class, through an object of that
class.
- The programmer can control the scope of a data member
of a class using access specifiers.
- An important consideration when designing a class is
identifying the audience, or users, of the class.
- All of the above
- Only A and C
7. (TCO 4) Which of the following terms can be used to describe
inheritance relationships between classes? (Points : 5)
- parent/child
- super/sub
- base/derived
- All of the above
8. (TCO 4) A Car class, Civic, and Driver class have what type of
relationships? (Points : 5)
- The Driver has a Civic, and the Civic is a Car.
- The Driver has a Civic, and the Car is a Civic.
- The Driver has a Car, and the Civic is a Car
- The Driver uses a Car, and the Car is a Civic.
9. (TCO3) Which of the following might be potential class(es) in an
application? (Points : 5)
- address
- item
- credit
- All of the above
- None of the above
10. (TCO3) 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
11. (TCO 4) Which of the following is true about an inheritance
hierarchy? (Points : 5)
- It is not a good practice to have deeply layered inheritance
hierarchies.
- When inheritance hierarchy is too deep, it is easy to
lose track of the members in the great-grandchildren classes.
- Inheritance hierarchies are easier to implement than to
design.
- All of the above
- None of the above
12. (TCO 6) _____ is the ability to use the same expression to denote
different implementation depending on the type of object calling the
expression. (Points : 5)
- Inheritance
- Encapsulation
- Polymorphism
- Composition
13. (TCO 2) What parts of a class, designed as a black box system,
should not be exposed to future programmers? (Points : 5)
- Inputs
- Outputs
- Interface
- Implementation
14. (TCO 2) 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){ }
- string GetSpecies (){return species }
- string SetSpecies (string newSpecies){return newSpecies
}
- string GetSpecies (){ }
- void SetSpecies (string newSpecies){return species }
- string GetSpecies (){return species }
- void SetSpecies (string newSpecies){ }
15. (TCO 2) You have been tasked to create an EntertainmentSystem
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? (Points
: 5)
- Declare a single no-arg constructor in order to prevent
outside entities from initializing the state of a new EntertainmentSystem
object.
- Combine attributes and behaviors specific to an
EntertainmentSystem together into one cohesive unit.
- Declare the class as static so that only one instance
of an EntertainmentSystem can be used at a time.
- Declare the class as private.
- All of the above
1. (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.
2. (TCO 7) In an object-oriented program, methods with no
implementation might be found in an _____ and/or a(n) ______. (Points : 5)
- abstract class; base class
- abstract class; interface
- interface; base class
- None of the above
3. (TCO 7) An object-oriented program may use _____ and _____ to
force programmers to adhere to a contract or a specification defined by a
framework. (Points : 5)
- base classes; abstract methods
- abstract classes; interfaces
- has-a; is-a relationships
- abstract classes; constants
- None of the above
4. (TCO 8) 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
5. (TCO 8) What are some of the characteristics of “self-documenting”
code? (Points : 5)
- Detailed comments, addressing all aspects of the code
- Deep levels of nesting to ensure all situations are
addressed
- Straightforward algorithms
- All of the above
- None of the above
6. (TCO 9) Which of the following allow a programmer to reduce thecomplexity of an object-oriented program? (Points : 5)
- create each class in a separate file
- using namespaces as a container for logically related
items
- Both A and B
- None of the above
7. (TCO 1) 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 Horse();
Horse Horse(“Horse”, “Ben”, “Appaloosa”);
;
;
}
(Points : 5)
- 3
- 4
- 2
- 5
8. (TCO 2) Given a private attribute called weight, which of the
following are proper implementations for a getter and a setter? (Points : 5)
- void GetWeight(){return weight;}, void SetWeight (int
weight){;}
- intGetWeight (){return weight;}, intSetWeight (int
weight){return weight;}
- intGetWeight (){;}, void SetWeight (int weight){return
weight;}
- intGetWeight (){return weight;}, void SetWeight (int
weight){;}
9. (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() {}
Comments
Post a Comment