Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Left uncaught, a thrown exception will cause a compile error in Visual Studio. S

ID: 3570478 • Letter: L

Question

Left uncaught, a thrown exception will cause a compile error in Visual Studio.

Select one:

a. TRUE

b. FALSE

For a class Foo, one difference between a variable declared Foo * and a variable declared Foo & is that only the variable declared Foo & can potentially have the value NULL.

Select one:

a. FALSE

b. TRUE

When no class constructors are supplied by the author of a class, that class will generated errors when compiled in C++.

Select one:

a. TRUE

b. FALSE

A function is allowed to have more than one return statement.

Select one:

True

False

When a function changes the value of reference parameter, the value of the actual parameter will get changed as well.

Select one:

True

False

All of the following are reserved keywords in C++ EXCEPT

Select one:

a. tryorfail

b. friend

c. for

d. this

e. class

The following code:
SpaceShip s;
cout << s;
calls the operator<< defined as:
friend SpaceShip operator<<( ostream& outs, const SpaceShip & s );.

Select one:

a. FALSE

b. TRUE

In C++, the class logic_error is part of the namespace cs52 and requires that programmers #include <stdexcept>.

Select one:

a. FALSE

b. TRUE

When declaring an array of classtype such as:
Student myStudents[ 10 ];
a programmer can tell C++ which constructor to use to initialize each of the elements in this array.

Select one:

a. FALSE

b. TRUE

The data members of a class are used to represent the "actions" that thing knows how to perform.

Select one:

a. TRUE

b. FALSE

Consider the following function declaration:

int foo( int a, int b, int c, int d=12, int e=20 );


What is the most number of parameters that can be passed at run-time to call this function?

Select one:

a. 2

b. 3

c. 4

d. 1

e. 5

Typically, class constructors are overloaded to provide many different and convenient ways to create an object.

Select one:

a. FALSE

b. TRUE

When a recursive function hits its base case, it returns an actual value without calling itself anymore to determine the answer.

Select one:

a. FALSE

b. TRUE

When C++ encounters a declaration with no arguments, such as:

Foo f;

it will not invoke a constructor for the class Foo.

Select one:

a. FALSE

b. TRUE

With the declarations:
   int i = 10;
   int* myArray = new int[ i ];
the correct way to delete the variable myArray is to say:
   delete( myArray );

Select one:

a. TRUE

b. FALSE

Given an object o, C++ programmers use the symbol -> to reference the members and methods of that object.

Select one:

a. FALSE

b. TRUE

In C++, cin, the thing we have been using to process input data, is actually an example of a class.

Select one:

a. TRUE

b. FALSE

Typically in C++, most classes have their methods marked private.

Select one:

a. TRUE

b. FALSE

In C++, arrays can be passed as parameters to a function either by value or by reference.

Select one:

True

False

Explanation / Answer

1.Left uncaught, a thrown exception will cause a compile error in Visual Studio.
->True, because any exception which is thrown but not caught will always throw an exception.

2.For a class Foo, one difference between a variable declared Foo * and a variable declared Foo & is that only the variable declared Foo & can potentially have the value NULL.
->False, because Foo* is a pointer to a reference and can refer to NULL where as foo& refer to an address and can never be null.

3. A function is allowed to have more than one return statement.
->False, a function can return multiple values but can have only one return statement

4. When a function changes the value of reference parameter, the value of the actual parameter will get changed as well.
->False. Any change to a reference parameter is local to the parameter and hence does not affect the actual parameter.

5.All of the following are reserved keywords in C++ EXCEPT
->a.tryorfail

6.The following code:
SpaceShip s;
cout << s;
calls the operator<< defined as:
friend SpaceShip operator<<( ostream& outs, const SpaceShip & s );.

->True

7.In C++, the class logic_error is part of the namespace cs52 and requires that programmers #include <stdexcept>.

->true

8.When declaring an array of classtype such as:
Student myStudents[ 10 ];
a programmer can tell C++ which constructor to use to initialize each of the elements in this array.

->True

9.The data members of a class are used to represent the "actions" that thing knows how to perform.

->True

10.Consider the following function declaration:

int foo( int a, int b, int c, int d=12, int e=20 );


What is the most number of parameters that can be passed at run-time to call this function?

-> b. 3

11. Typically, class constructors are overloaded to provide many different and convenient ways to create an object.

->True

12, When a recursive function hits its base case, it returns an actual value without calling itself anymore to determine the answer.
->False, because after completion of every loop,the function returns back to the base program from where it checks the condition and then re-enters the loop if condition is met.

13. When C++ encounters a declaration with no arguments, such as:

Foo f;

it will not invoke a constructor for the class Foo.
->True

14. 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

15. Given an object o, C++ programmers use the symbol -> to reference the members and methods of that object.
->False. Dot(.) operators are used.

16. In C++, cin, the thing we have been using to process input data, is actually an example of a class.
->True. The class for which is declared in the iostream.h library

17.Typically in C++, most classes have their methods marked private.
-> False.By default, all methods are marked public.

18. In C++, arrays can be passed as parameters to a function either by value or by reference.
->True

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote