C++ True or False Questions 1. In this course, we will be marking all of our operators as friend functions. True or False? 2. Although there are exceptions to this rule, C++ programmers have the power...


C++ True or False Questions 1. In this course, we will be marking all of our operators as friend functions. True or False? 2. Although there are exceptions to this rule, C++ programmers have the power to decide what two parameters their operators take and what type they return. True or False? 3. The following code:Student s; Customer c; Grapefruit g = s + c; calls the operator+ defined as: Grapefruit operator+ ( Customer c, Student s );. True or False? 4. The following code: Grapefruit g; cout <><><(>5. In C++, operator+ comes in two overloaded forms, one that takes one argument and one that takes two arguments. True or False? 6. In C++, operator- comes in two overloaded forms, one that takes one argument and one that takes two arguments. True or False? 7. In C++, operator<>8. In C++, operator>> comes in two overloaded forms, one that takes one argument and one that takes two arguments. True or False? 9. In the declaration int myArray[ 10 ]; is a valid array declaration in C++. True or False? 10. In the declaration: int i = 10 int myArray[ i ];is a valid array declaration in C++.True or False? 11. In the declaration: int myArray[ 10 ]; a total of 10 integer values will make up the array named myArray. True or False? 12. C++ allows arrays of classtype for any class defined in C++. True or False? 13. The following code: Student myStudents[ 10 ]; will call the parameterless constructor on each of the 10 spots defined in the array. True or False? 14. When declaring an array of classtype such as: Student myStudents[ 10 ];b there is no way for a programmer to tell C++ which constructor to use to initialize the elements of the array. True or False? 15. Recursive functions are ones which may call themselves over and over again. True or False? 16. When a recursive function hits its base case, it returns an actual value without calling itself anymore to determine the answer. True or False? 17. Every recursive function needs one (or more) base cases as well as one (or more) recursive cases. True or False? 18. When a recursive function never reaches its base case, C++ will return the value 0 when the function finishes running. True or False? 19. In C++, the following code: string s = "Hello"; for (int i = 0; i <><>

will print out each letter of the variable s on a different line all by itself.


True or False? 20. Whether you are working with char * or string objects, there is a getline(...) function that enables you to read a whole line of data, including the whitespace.


True or False? 21. An exception is an alternative way of returning from a function or class method that designates that some failure occurred. True or False? 22. In the declaration: std::logic_error le( "message" ); le is the name of an object of type logic_error. True or False? 23. In this course, typically, class methods throw exceptions that driver code will catch.] True or False? 24. In C++, the class string is part of the namespace std and requires that programmers #include. True or False? 25. When reading text, the standard >> operator will break on whitespace and eats leading whitespace.


True or False? 26. In C++, the declaration: char * myString = "Hello"; produces an object with many different available methods we can call. True or False? 27. In C++, the following code: char * myString = "Hello"; char * otherString = "Hello"; if (myString == otherString)

{ cout <>28. Any pointer variable you declare and new, you must delete when you are finished using it. True or False? 29. In the declaration: int* myArray = new int[ 10 ]; myArray is the name of an array of int declared to hold 10 elements. True or False? 30. In the declarations: int i = 10; int* myArray = new int[ i ];myArray is the name of anarray of int declared to hold 10 elements.True or False? 31. With the declarations: int i = 10; int* myArray = new int[ i ]; the correct way to delete the variable myArray is to say: delete( myArray ); True or False? 32. With the declaration:



int* pInt = new int( 10 ); the correct way to delete the variable pInt is to say: delete [] pInt; True or False? 33. With the declarations: int i = 10; int* pInt = &i; programmers must not delete pInt when they are finished using it. True or False? 34. With the declarations: int i = 10; int* pInt = &i; the following statement will set the value of the variable i to 11: *pInt = 11; True or False? 35. When a programmer writes the statements:


int* pInt = new int( 10 ); int* pAnotherInt = new int( 11 ); pAnotherInt = pInt; the programmer has created a "memory leak". True or False? 36. With the declarations:


Customer c; Customer* pCustomer = &c; the following statement will invoke the setName method on the object c: pCustomer->setName( "Howard" ); True or False? 37. The -> operator can only be used on pointer variables that are do not have the value NULL or nullptr. True or False? 38. A pointer to any type can be set to NULL or nullptr. True or False? 39. Inheritance is a way that programmers can implement a "HAS-A" or "part-of" relationship. True or False? 40. In the declaration: class Foo : public Bar Bar is the subclass of the class Foo. True or False? 41. When defining inheritance in C++, in addition to defining a .h file correctly, programmers must also correctly code constructor calls so that they call their parent class constructors. True or False? 42. In C++, not every class has a parent class it inherits from. True or False? 43. With the declaration: class Foo : public Bar and the objects: Foo f; Bar b; it is always safe to say: b = f; True or False? 44. With the declaration: class Foo : public Bar and the objects: Foo f; Bar b; it is always safe to say: f = b; True or False? 45. With the declaration: class Foo : public Bar every instance of a Foo is an special kind of Bar. True or False? 46. When working with inheritance and virtual functions, the keyword virtual only belongs in a .cpp file. True or False? 47. Once a method is marked virtual in a parent class, every subclass has that virtualmethod, whether they say it not. True or False? 48. Only methods can be marked virtual, not class data members. True or False? 49. Typically, class constructors are overloaded to provide many convenient ways to create an object. True or False? 50. A class can declare an enumeration in its public or private area. True or False? 51. The access modifiers public and private can be listed many times within a class' header (.h) file. True or False? 52. Left unstated, the default access modifier of a class in C++ is private. True or False? 53. Default-valued parameter arguments do not need to be passed when invoking the function or class method that defines their value. True or False? 54. C++ uses a this pointer value at runtime to track which object is being used when a class' method is called. True or False? 55. Both Visual Studio and XCode shows the features of a class thru many distinctive icons.


True or False? 56. The enumerated value YELLOW shown below: enum COLOR { BLUE = 2, RED, YELLOW } ; will have the value 4. True or False?



May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here