Details of this Paper

Multiple choice 21214

Description

solution


Question

Question Completion Status;Question 1;1. Suppose that printHeadingis a function without any parameters. Which of the following is a valid;function heading?;2. 3. 4. void printHeading()?;5. 6. 7. void printHeading();8. 9. 10. void printHeading(noParameters)?;11. 12.13. void printHeading(void);3 points;Question 2;1. Which of the following is a legal C++ function definition?;2. 3. 4. void funcTest(int& u, double& v){ cout << u << " " << v << endl?};5. 6. 7. void funcTest(int& u, double& v)?{ cout << u << " " << v;endl?};8. 9. 10. void funcTest(int& u, double& v)(cout << u << " " << v << endl);11. 12.13. void funcTest(int& u, double& v)[ cout << u << " " << v << endl?];3 points;Question 3;1. There are two types of ____ parameters: value parameters and reference parameters.;2. 3. 4. actual;5. 6. 7. formal;8. 9. 10. active;11. 12.13. passive;3 points;Question 4;1. If an & is attached after the data type of a formal parameter, then the formal parameter is a ____.;2. 3. 4. value parameter;5. 6. 7. reference parameter;8. 9. 10. global variable;11. 12.13. default variable;3 points;Question 5;1. A void function accomplish has three parameters: a parameter u of type int, a parameter v of;type double, and a parameter letter of type char. The parameters uand letter need to pass;their values out of the function and the parameter v is to only receive the value from the calling;environment. Which of the following is a correct function heading?;2. 3. 4. void accomplish(int& u, double v, char& letter);5. 6. 7. void accomplish(int u, double& v, char letter);8. 9. 10. void accomplish(int& u, double v, char& letter)?;11. 12.13. void accomplish(int u, double& v, char letter)?;3 points;Question 6;1. Consider the following definition.void funBbeta(int& one, double two){...}Based on this;function definition, which of the following statements is valid?;2. 3. 4. one is a value parameter and two is a reference parameter.;5. 6. 7. one is a reference parameter and two is a value parameter.;8. 9. 10. one and two are reference parameters.;11. 12.13. one and two are value parameters.;3 points;Question 7;1. Which of the following is a legal C++ function definition?;2. 3. 4. void funcAlpha(int u, double v &){ cout << u << " " << v;endl?};5. 6. 7. void funcAlpha(int #, double #){ cout << u << " " << v << endl?};8. 9. 10. void funcAlpha(int &, double &){ cout << u << " " << v << endl?};11. 12.13. void funcAlpha(int u, double& v){ cout < alpha >> alpha >> alpha?;5. 6. 7. cin >> alpha[0]>> alpha[1] >> alpha[2]?;8. 9. 10. cin >> alpha[1]>> alpha[2] >> alpha[3]?;11. 12.13. cin >> alpha;3 points;Question 45;1. In C++, the null character is represented as ____.;2. 3. 4. '\0';5. 6. 7. "\0";8. 9. 10. '0';11. 12.13. "0";3 points;Question 46;1. Consider the following declaration char str[15]?. Which of the following statements stores;Blue Sky" into str?;2. 3. 4. str = "Blue Sky"?;5. 6. 7. str[15] = "Blue Sky"?;8. 9. 10. strcpy(str, "Blue Sky")?;11. 12.13. strcpy("Blue Sky")?;3 points;Question 47;1. Consider the following declaration.char charArray[51]?char discard?Assume that the input;is:Hello There!How are you?;2. What is the value of discard after the following statements execute? cin.get(charArray;51)?cin.get(discard)?;3. 4. 5. discard = ' ' (Space);6. 7. 8. discard = '!;9. 10.11. discard = '\n;12. 13.14. discard = '\0';3 points;Question 48;1. Consider the statement int list[10][8]?. Which of the following about list is true?;2. 3. 4. list has 10 rows and 8 columns.;5. 6. 7. list has 8 rows and 10 columns.;8. 9. 10. list has a total of 18 components.;11. 12.13. list has a total of 108 components.;3 points;Question 49;1. Which of the following correctly declares and initializes alpha to be an array of four rows and;three columns and the component type is int?;2. 3. 4. int alpha[4][3] = {{0,1,2} {1,2,3} {2,3,4} {3,4,5}}?;5. 6. 7. int alpha[4][3] = {0,1,2? 1,2,3? 2,3,4? 3,4,5}?;8. 9. 10. int alpha[4][3] = {0,1,2: 1,2,3: 2,3,4: 3,4,5}?;11. 12.13. int alpha[4][3] = {{0,1,2}, {1,2,3}, {2,3,4}, {3,4,5}}?;3 points;Question 50;1. Given the following declaration;2. int j?int sum? double sale[10][7]?;3. which of the following correctly finds the sum of the elements of the fifth row of sale?;4. 5. 6. sum = 0?for(j = 0? j < 7? j++) sum = sum + sale[5][j]?;7. 8. 9. sum = 0?for(j = 0? j < 7? j++) sum = sum + sale[4][j]?;10. 11.12. sum = 0?for(j = 0? j < 10? j++) sum = sum + sale[5][j]?;13. 14.15. sum = 0?for(j = 0? j > bigRect.length >> width?;7. 8. 9. cout << bigRect.length?;10. 11.12. cout << bigRect?;13. 14.15. cout < > circle.radius?circle.area = 3.14 * radius * radius?;6. 7. 8. cin >> circle.radius?circle.area = 3.14 * circle.radius * radius?;9. 10.11. cin >> circle?;12. 13.14. cin >> circle.radius?;3 points;Question 61;1. Consider the following statements.struct personalInfo{ string name? int age?;double height? double weight?}?struct commonInfo{ string name? int;age?}?;2. personalInfo person1, person2?commonInfo person3, person4?Which of the following;statements is valid in C++?;3. 4. 5. person1 = person3?;6. 7. 8. person2 = person1?;9. 10.11. person2 = person3?;12. 13.14. person2 = person4?;3 points;Question 62;1. Consider the following statements.struct studentType1;2. { string name? int ID? double gpa?;3. }?studentType1 student1, student2?struct studentType2;4. { string name? int ID? double gpa?;5. }?studentType2 student3, student4?Which of the following statements is valid in C++?;6. 7. 8. student2 = student3?;9. 10.11. student1 = student4?;12. 13.14. student2.ID = ID?;15. 16.17. student1.ID = student3.ID?;3 points;Question 63;1. You can assign the value of one struct variable to another struct variable of ____ type(s).;2. 3. 4. any;5. 6. 7. the same;8. 9. 10. a different;11. 12.13. a heterogeneous;3 points;Question 64;1. Consider the following statements.;2. struct rectangleData{ double length? double width? double area?;double perimeter?}?;3. rectangleData bigRect?rectangleData smallRect?Which of the following statements is;legal in C++?;4. 5. 6. if (bigRect == smallRect);7. 8. 9. if (bigRect != smallRect);10. 11.12. if (bigRect.length == width);13. 14.15. if (bigRect.length == smallRect.width);3 points;Question 65;1. Which of the following aggregate operations can be executed on array variables?;2. 3. 4. Arithmetic;5. 6. 7. Assignment;8. 9. 10. Comparison;11. 12.13. Parameter passing;3 points;Question 66;1. A list has two items associated with it: ____.;2. 3. 4. the length and the references;5. 6. 7. the values and the references;8. 9. 10. the indexes and the length;11. 12.13. the values and the length;3 points;Question 67;1. Consider the following statements.;2. struct supplierType;3. { string name? int supplierID?;4. }?struct applianceType;5. { supplierType supplier? string modelNo? double cost?;6. }?;7. applianceType applianceList[25]?Which of the following best describes applianceList?;8. 9. 10. It is an array.;11. 12.13. It is a struct.;14. 15.16. It is an array of structs.;17. 18.19. It is a struct of arrays.;3 points;Question 68;1. Consider the following statements.struct supplierType;2. { string name? int supplierID?;3. }?struct paintType;4. { supplierType supplier? string color? string paintID?;5. }?;6. paintType paint?What is the data type of paint.supplier?;7. 8. 9. string;10. 11.12. paintType;13. 14.15. supplierType;16. 17.18. struct;3 points;Question 69;1. The components of a class are called the ____ of the class.;2. 3. 4. elements;5. 6. 7. members;8. 9. 10. objects;11. 12.13. properties;3 points;Question 70;1. If a member of a class is ____, you cannot access it outside the class.;2. 3. 4. public;5. 6. 7. automatic;8. 9. 10. private;11. 12.13. static;3 points;Question 71;1. clockType;2. hr;intmin;intsec;int;3. +setTime(int, int, int): void+getTime(int&, int&, int&) const;void+printTime() const: void+incrementSeconds(): int+incrementMinutes();int+incrementHours(): int+equalTime(const clockType&) const: bool;4.;5. The word ____ at the end of the member functions in the class clockType specifies that these;functions cannot modify the member variables of a clockType object.;6. 7. 8. static;9. 10.11. const;12. 13.14. automatic;15. 16.17. private;3 points;Question 72;1. A ____ sign in front of a member name on the UML diagram indicates that this member is a;private member.;2. 3. 4.;5. 6. 7.;8. 9. 10.;11. 12.13.;3 points;Question 73;1. 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?}? Consider the accompanying class;definition. Which of the following class variable declarations is correct?;2. 3. 4. rectangle rectangleType?;5. 6. 7. class rectangleType rectangle?;8. 9. 10. rectangleType rectangle?;11. 12.13. rectangle rectangleType.area?;3 points;Question 74;1. Consider the accompanying class definition, and the declaration:rectangleType bigRect?;2. Which of the following statements is correct?;3. 4. 5. rectangleType.print()?;6. 7. 8. rectangleType::print()?;9. 10.11. bigRect.print()?;12. 13.14. bigRect::print()?;3 points;Question 75;1. In C++, the ____ is an operator called the member access operator.;2. 3. 4..;5. 6. 7.;8. 9. 10.;11. 12.13. #;3 points;Question 76;1. A class object can be ____. That is, it can be created once, when the control reaches its;declaration, and destroyed when the program terminates.;2. 3. 4. static;5. 6. 7. automatic;8. 9. 10. local;11. 12.13. public;3 points;Question 77;1. In C++, the scope resolution operator is ____.;2. 3. 4.;5. 6. 7.;8. 9. 10. $;11. 12.13..;3 points;Question 78;1. To guarantee that the member variables of a class are initialized, you use ____.;2. 3. 4. accessors;5. 6. 7. mutators;8. 9. 10. constructors;11. 12.13. destructor;3 points;Question 79;1. class secretType{public: static int count? static int z? secretType()?;secretType(int a)? void print()? static void incrementY()?private;int x? static int y?}?secretType::secretType(){ x =;1?}secretType::secretType(int a){ x = a?}void secretType::print(){ cout;x = " << x << ", y = " << y << "z = " << z << ", count =;count << endl?}static void secretType::incrementY(){ y++?};2. Consider the accompanying class and member functions definitions. How many constructors are;present in the class definition above?;3. 4. 5.;6. 7. 8.;9. 10.11.;12. 13.14.;3 points;Question 80;1. class secretType{public: static int count? static int z? secretType()?;secretType(int a)? void print()? static void incrementY()?private;int x? static int y?}?secretType::secretType(){ x =;1?}secretType::secretType(int a){ x = a?}void secretType::print(){ cout;x = " << x << ", y = " << y << "z = " << z << ", count =;count << endl?}static void secretType::incrementY(){ y++?} Consider the;accompanying class and member functions definitions. Which of the following statements;correctly creates the object mySecret of type secretType and sets the value of the member;variable x to 9?;2. 3. 4. secretType mySecret(9)?;5. 6. 7. mySecret = secretType(9)?;8. 9. 10. secretType = mySecret(9)?;11. 12.13. secretType(9).mySecret?;3 points;Question 81;1. How many destructors can a class have?;2. 3. 4. 0;5. 6. 7. 1;8. 9. 10. 2;11. 12.13. Any number;3 points;Question 82;1. What does ADT stand for?;2. 3. 4. abstract definition type;5. 6. 7. asynchronous data transfer;8. 9. 10. abstract data type;11. 12.13. alternative definition type;3 points;Question 83;1. A C++ implementation file has the extension ____.;2. 3. 4..imp;5. 6. 7..h;8. 9. 10..exe;11. 12.13..cpp;3 points;Question 84;1. If a function of a class is static, it is declared in the class definition using the keyword static in;its ____.;2. 3. 4. return type;5. 6. 7. parameters;8. 9. 10. heading;11. 12.13. main function;3 points;Question 85;1. ____ is an ?isa?;relationship.;2. 3. 4. Inheritance;5. 6. 7. Encapsulation;8. 9. 10. Composition;11. 12.13. Polymorphism;3 points;Question 86;1. The new classes that we create from existing classes are called ____ classes.;2. 3. 4. sibling;5. 6. 7. base;8. 9. 10. derived;11. 12.13. parent;3 points;Question 87;1. Suppose that bClass is a class. Which of the following statements correctly derives the class;dClass from bClass?;2. 3. 4. class dClass:: public bClass{ //classMembersList}?;5. 6. 7. class dClass: private bClass{ //classMembersList}?;8. 9. 10. class dClass:: protected bClass{ //classMembersList}?;11. 12.13. class bClass: public dClass{ //classMembersList}?;3 points;Question 88;1. Consider the following class definition. class dClass: bClass{ //class members;list}?The class dClass is derived from the class bClass using the ____ type of inheritance.;2. 3. 4. public;5. 6. 7. private;8. 9. 10. protected;11. 12.13. static;3 points;Question 89;1. Which of the following is a valid definition of the derived class bClass?;2. 3. 4. class aClass: public bClass{ //...}?;5. 6. 7. class bClass: public aClass{ //...}?;8. 9. 10. class aClass::bClass{ //...}?;11. 12.13. class bClass::aClass{ //...};3 points;Question 90;1. Which of the following is true about inheritance?;2. 3. 4. All public member functions of the base class become the public member functions of the;derived class.;5. 6. 7. All public member variables of the base class become the public member variables of the;derived class.;8. 9. 10. All public members of the base class become the public members of the derived class.;11. 12.13. The public member variables of the base class become the public or private member;variables of the derived class.;3 points;Question 91;1. Which of the following class definitions makes the public members of the class aClass become;the public members of the class bClass?;2. 3. 4. class aClass: public bClass{ //...}?;5. 6. 7. class bClass: public aClass{ //...}?;8. 9. 10. class bClass: aClass{ //...}?;11. 12.13. class aClass: bClass{ //...}?;3 points;Question 92;1. Which of the following is true about a derived class?;2. 3. 4. A derived class can directly access any member variable of the base class.;5. 6. 7. A derived class can redefine any public member function of the base class.;8. 9. 10. A derived class can have at most one base class.;11. 12.13. A derived class can redefine any member function of the base class.;3 points;Question 93;1. To ____ a public member function of a base class in the derived class, the corresponding;function in the derived class must have the same name, number, and types of parameters.;2. 3. 4. redefine;5. 6. 7. overload;8. 9. 10. rename;11. 12.13. reuse;3 points;Question 94;1. If the corresponding functions in the base class and the derived class have the same name but;different sets of parameters, then this function is ____ in the derived class.;2. 3. 4. reused;5. 6. 7. redefined;8. 9. 10. overloaded;11. 12.13. overridden;3 points;Question 95;1. Consider the following class definitions. class bClass{public: void setX(int)?;void print() const?private: int x?}?class dClass: public bClass{public;void setXY(int, int)? void print() const?private: int y?}?Which of the following;statements correctly redefines the member function print of bClass?;2. 3. 4. void dClass::print() const { dClass:print()? cout << ";y << endl? };5. 6. 7. void dClass::print() const { cout << x << " " << y << endl?;8. 9. 10. void bClass::print() const { cout << x << " " << y << endl?;11. 12.13. void dClass::print() const { bClass::print()? cout;y = " << y << endl? };3 points;Question 96;1. If the derived class classD overrides a public member function functionName of the base class;classB, then to specify a call to that public member function of the base class you use the;statement.;2. 3. 4. classD::functionName()?;5. 6. 7. classB::functionName()?;8. 9. 10. classD.functionName()?;11. 12.13. classB.functionName()?;3 points;Question 97;1. What is the output of the following program?;2. #include using namespace std?class bClass{public: void print();const? bClass(int a = 0, int b = 0)? //Postcondition: x = a? y =;b?private: int x? int y?}?class dClass: public bClass{public;void print() const? dClass(int a = 0, int b = 0, int c = 0)?;//Postcondition: x = a? y = b? z = c?private: int z?}?int main(){ bClass;bObject(2, 3)? dClass dObject(3, 5, 8)? bObject.print()? cout << endl?;dObject.print()? cout << endl? return 0?}void bClass::print() const;cout << x << " " << y << endl?}bClass::bClass(int a, int b){ x = a? y =;b?}void dClass::print() const{ bClass:print()? cout << " " << z;endl?}dClass::dClass(int a, int b, int c): bClass(a, b){ z = c?};3. 4. 5. 2 32 3;6. 7. 8. 2 33 5 8;9. 10.11. 3 5 83 5 8;12. 13.14. 5 83 5 8;3 points;Question 98;1. ____ is the ability to combine data, and operations on that data, in a single unit.;2. 3. 4. Inheritance;5. 6. 7. Encapsulation;8. 9. 10. Polymorphism;11. 12.13. Composition;3 points;Question 99;1. OOP implements ____.;2. 3. 4. UML;5. 6. 7. IPE;8. 9. 10. EIP;11. 12.13. OOD;3 points;Question 100;1. The ____ members of an object form its internal state.;2. 3. 4. private;5. 6. 7. protected;8. 9. 10. public;11. 12.13. static

 

Paper#69997 | Written in 18-Jul-2015

Price : $27
SiteLock