Details of this Paper

Object Composition




I really need help with this exam,th teacher who helps me get an awsome grade and finishes the fastest, I will give an extra $10 once I find out the grade.;1. (TCO 1) What is the output of the following C++ code?;int list[5] = {0, 5, 10, 15, 20};int j;for (j = 0, j < 5, j++);cout << list[j];(Points: 4) 0 1 2 3 4;0 5 10 15;0 5 10 15 20;5 10 15 20;2. (TCO 1) What is stored in alpha after the following code executes?;int alpha[5] = {0};int j;for (j = 0, j = 0, j--);cout << "alpha[" << j << "] = " << alpha[j] << endl;(Points: 4) 2 4 6 8 10;4 3 2 1 0;8 6 4 2 0;10 8 6 4 2;4. (TCO 1) Which of the following about arrays as function parameters is true?;(i) Arrays are passed by reference only.;(ii) When we declare an array as a formal parameter we do not attach & after the data type of the array component. (Points: 4) Only (i);Only (ii);Both (i) and (ii);None of these;5. (TCO 1) Consider the following statement;double alpha[10][5];The number of components of alpha is _____. (Points: 4) 15;50;100;150;6. (TCO 1) Which of the following correctly declares and initializes alpha to be an array of four rows and three columns with the component type int? (Points: 4) int alpha[4][3] = {{0,1,2} {1,2,3} {2,3,4} {3,4,5}};int alpha[4][3] = {0,1,2, 1,2,3, 2,3,4, 3,4,5};int alpha[4][3] = {0,1,2: 1,2,3: 2,3,4: 3,4,5};int alpha[4][3] = {{0,1,2}, {1,2,3}, {2,3,4}, {3,4,5}};7. (TCO 1) Consider the following statements.;int alpha[10][5] = {0};int j,k;Which of the following statements correctly initializes alpha to 0?;(i);for (j = 0, j < 10, j++);for(k = 0, k < 5, k++);alpha[j][k] = 0;(ii);for (k = 0, k < 5, k++);for (j = 0, j < 10, j++);alpha[j][k] = 0, (Points: 4) Only (i);Only (ii);Both (i) and (ii);None of these;8. (TCO 1) Given the following multidimensional array declaration, how many elements exist in the array?;double neoMatrix[4][5][6], (Points: 4) 456;60;15;120;9. (TCO 2) In C++, class is a reserved word that defines (Points: 4) a data type.;an object type.;a variable.;an enumeration.;10. (TCO 2) A class and its members can be described graphically by using (Points: 4) Unified Modeling Language (UML) notation.;a flowchart.;Unified Abstract Language (UAL) notation.;Unified Encapsulation Language (UEL) notation.;Page 2;Multiple Choice;1. (TCO 2) If the heading of a member function of a class ends with the word const, then (Points: 4) the function members cannot modify the private member variables, but can modify the public member variables.;the function members cannot modify the public member variables, but can modify the private member variables.;the function members cannot modify the private member variables, nor can they modify the public member variables.;all variables can be modified.;2. (TCO 2) Which of the following class definitions is correct in C++?;(i);class student;public;void student();void student(string s, double g, int i);void set(string s, double g, int i);void print();private;string name;double gpa;int id;(ii);class student;public;student();student(string s, double g, int i);void set(string s, double g, int i);void print();private;string name;double gpa;int id;(Points: 4) Only (i);Only (ii);Both (i) and (ii);None of these;3. (TCO 2) Suppose that you have the following UML class diagram of a class.;According to the UML class diagram, which function is public and doesn't return anything? (Points: 4) incrementHours;equalTime;printTime;setTime;4. (TCO 2) A _____ sign in front of a member name on the UML diagram indicates that this member is protected. (Points: 4) +;-;#;$;5. (TCO 2) Consider the following class definition;class rectangleType;public;void setLengthWidth(double x, double y);//Postcondition: length = x, width = y;void print() const;//Output length and width;double area();//Calculate and return the area of the rectangle;double perimeter();//Calculate and return the parameter;rectangleType();//Postcondition: length = 0, width = 0;rectangleType(double x, double y);//Postcondition: length = x, width = y;private;double length;double width;Which of the following class variable declarations is correct? (Points: 4) rectangle rectangleType;class rectangleType rectangle;rectangleType rectangle;rectangle rectangleType.area;6. (TCO 3) Which is the correct UML connector to designate inheritance? (Points: 4);7. (TCO 8) When creating a macro, which preprocessor directive is used? (Points: 4) ifndef;define;ifdef;endif;8. (TCO 8) Which is a correct preprocessor directive statement? (Points: 4) define PI = 3.141593;define PI = 3.141593;#define PI 3.141593;#define PI = 3.141593;9. (TCO 8) All preprocessor directives begin with a(n) _____. (Points: 4) underscore;blank space;#;Page 3;Multiple Choice;1. (TCO 2) In C++, the _____ is an operator called the member access operator. (Points: 4).;#;2. (TCO 3) Which of the following statements is an accurate example of composition? (Points: 4) A car has an engine.;A car is an automobile.;A car is an object.;A car has a class.;3. (TCO 4) A derived class can redefine (Points: 4) a private member function of the base class.;a public member function of the base class.;both public and private member functions of the base class.;neither public nor private member functions of the base class.;4. (TCO 4) If the derived class does not override a public member function of the base class, you may specify a call to that public member function that has parameters by (Points: 4) using the name of the function and no parameter list.;using only the name of the function.;using the name of the function and the appropriate parameter list.;Public member functions cannot be accessed in a derived class.;5. (TCO 4) Which of the following class definitions makes the public members of the class aClass become the public members of the class bClass? (Points: 4) class aClass: public bClass{ //...};class bClass: public aClass{ //...};class bClass: aClass{ //...};class aClass: bClass{ //...};6. (TCO 4) _____ is the ability to combine data, and operations on those data, in a single unit. (Points: 4) Inheritance;Encapsulation;Polymorphism;Composition;7. (TCO 4) C++ supports (Points: 4) both single and multiple inheritance.;only single inheritance.;only multiple inheritance.;neither single nor multiple inheritance.;8. (TCO 4) Which of the following base class members is never inherited by a derived class, regardless of access attributes? (Points: 4) Mutator;Accessor;Constructor;Data;9. (TCO 4) Which of the following relationships is not a correct example of inheritance? (Points: 4) Parent to Children;Aunt to Uncle;Grandparent to Grandchild;Father and Mother to Children;10. (TCO 8) In a multifile, object-oriented C++ project, which file contains the class definition? (Points: 4) classname.cpp;classname.h;classname.def;classname.hdr;10. (TCO 8) Which preprocessor directive is not used for conditional compilation? (Points: 4) define;ifndef;ifdef;endif;1. (TCO 1) Describe the conceptual model of a three-dimensional array. Include in your explanation how a three-dimensional array might be used and provide an example of one. (Points: 10);2. (TCO 1) Describe an example of a two-dimensional character array that could be used to hold a set of text data that might be displayed on a hand-held information display device such as an MP3 player. Describe what each of the two dimensions might represent and the data that would be held in the array, and provide an example array declaration. (Points: 10);3. (TCO 2) Explain the basic C++ syntax for creating a class. Include an explanation of the private and public section of a class and class members. Include a code segment to illustrate your answer. (Points: 10);4. (TCO 2) Describe in detail what is contained in each of three areas of a Unified Modeling Language (UML) diagram of a class. (Points: 10);5. (TCO 3) Write and explain the definition composition and how it is useful in writing object-oriented programming. Also, explain how it is different from inheritance and how both inheritance and composition are useful in developing object-oriented programs. (Points: 10);6. (TCO 4) Without considering the access attributes, list and describe which base class members may not be inherited by a derived class and provide a rationale for why this is. (Points: 10);7. (TCO 4) If a class is derived public from a base class, explain how this affects the inheritance of all public, protected, and private members of the base class by the derived class. (Points: 10);8. (TCO 8) For a multifile project that contains just one class, list and describe each of the files that would be required to implement and test the functions of the class. (Points: 10)


Paper#71909 | Written in 18-Jul-2015

Price : $32