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

Question 1 Not yet answered Marked out of 2.00 Flag question Question text Left

ID: 3771494 • Letter: Q

Question

Question 1

Not yet answered

Marked out of 2.00

Flag question

Question text

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

Select one:

a. TRUE

b. FALSE

Question 2

Not yet answered

Marked out of 2.00

Flag question

Question text

Only a pointer variable can be set to have the value NULL.

Select one:

a. FALSE

b. TRUE

Question 3

Not yet answered

Marked out of 2.00

Flag question

Question text

Any function, variable declaration or class method can be marked virtual.

Select one:

a. TRUE

b. FALSE

Question 4

Not yet answered

Marked out of 2.00

Flag question

Question text

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

Question 5

Not yet answered

Marked out of 2.00

Flag question

Question text

Whenever they are passed as parameters to a function, the IO classes istream and ostream must be passed using a pass-by-reference parameter passing scheme.

Select one:

a. TRUE

b. FALSE

Question 6

Not yet answered

Marked out of 2.00

Flag question

Question text

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

Select one:

a. FALSE

b. TRUE

Question 7

Not yet answered

Marked out of 2.00

Flag question

Question text

The body of a do { ... } while(...); loop will always executes atleast once, no matter what test condition is stated.

Select one:

a. TRUE

b. FALSE

Question 8

Not yet answered

Marked out of 2.00

Flag question

Question text

The body of a while(...) { ... } loop will always executes atleast once, no matter what test condition is stated.

Select one:

a. FALSE

b. TRUE

Question 9

Not yet answered

Marked out of 2.00

Flag question

Question text

A throw(...) statement is an alternative way to return from a function or method that indicates some kind of failure occurred.

Select one:

a. FALSE

b. TRUE

Information

Flag question

Information text

Please consider the following code fragment when answering the next few questions:

Question 10

Not yet answered

Marked out of 2.00

Flag question

Question text

The variable named var1 declared above will include an ending NULL character.

Select one:

a. TRUE

b. FALSE

Question 11

Not yet answered

Marked out of 2.00

Flag question

Question text

The variable named var4 declared above is an object and therefore has callable methods driver code can call.

Select one:

a. TRUE

b. FALSE

Question 12

Not yet answered

Marked out of 2.00

Flag question

Question text

Run-time parameters passed to a function allow you to use different values each time the function is called.

Select one:

True

False

Question 13

Not yet answered

Marked out of 2.00

Flag question

Question text

A function defined to return void is allowed to have not even a single return statement.

Select one:

True

False

Question 14

Not yet answered

Marked out of 2.00

Flag question

Question text

In C++, a class' constructor is allowed to accept parameters.

Select one:

True

False

Question 15

Not yet answered

Marked out of 2.00

Flag question

Question text

When authoring a friend function, the keyword friend only appears in the .h file, NOT the .cpp file.

Select one:

True

False

Question 16

Not yet answered

Marked out of 2.00

Flag question

Question text

When a class method is marked with the keyword friend in a .h file,

Select one:

a. it will be a link error if C++ programmers mark that class method with the keyword friend in the class' .cpp file.

b. None of the choices here are correct.

c. it will be required for C++ programmers to mark that class method with the keyword friend in the class' .cpp file.

d. it will be a compile error if C++ programmers mark that class method with the keyword friend in the class' .cpp file.

e. it will be a run-time error if C++ programmers mark that class method with the keyword friend in the the class' .cpp file.

Question 17

Not yet answered

Marked out of 2.00

Flag question

Question text

The default case is required in the switch selection statement.

Select one:

True

False

Question 18

Not yet answered

Marked out of 2.00

Flag question

Question text

When a class method is marked with the keyword const in a .h file,

Select one:

a. it will be a compile error if C++ programmers mark that class method with the keyword const in the class' .cpp file.

b. it will be required for C++ programmers to mark that class method with the keyword const in the class' .cpp file.

c. it will be a run-time error if C++ programmers mark that class method with the keyword const in the class' .cpp file.

d. it will be a link error if C++ programmers mark that class method with the keyword const in the class' .cpp file.

e. None of the choices here are correct.

Question 19

Not yet answered

Marked out of 2.00

Flag question

Question text

An exception is an occurrence of an undesirable situation that can be detected during program execution.

Select one:

True

False

Question 20

Not yet answered

Marked out of 2.00

Flag question

Question text

If operator- is supported by a class, how many parameters should it be defined to accept?

Select one:

a. 1 or 2

b. 3

c. None

d. 1

e. 2

Question 21

Not yet answered

Marked out of 2.00

Flag question

Question text

The loop below:

int j = 0;
while ( j <= 10 )
j++;

terminates if j > 10.

Select one:

True

False

Question 22

Not yet answered

Marked out of 2.00

Flag question

Question text

If operator >> is supported by a class, how many parameters should it be defined to accept?

Select one:

a. 3

b. 1

c. 2

d. None

e. 1 or 2

Question 23

Not yet answered

Marked out of 2.00

Flag question

Question text

In C++, the first element in an array has the index value

Select one:

a. 1

b. 0

c. All of the answers listed here are correct

d. -1

e. None of the answers listed here are correct

Question 24

Not yet answered

Marked out of 2.00

Flag question

Question text

The access modifiers public and private can be listed only once within a class' header (.h) file.

Select one:

a. FALSE

b. TRUE

Question 25

Not yet answered

Marked out of 2.00

Flag question

Question text

The following code:
SpaceShip s;
cin >> s;
calls the operator<< defined as:
friend SpaceShip operator<<( istream& ins, SpaceShip & s );.

Select one:

a. TRUE

b. FALSE

Question 26

Not yet answered

Marked out of 2.00

Flag question

Question text

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

Select one:

a. TRUE

b. FALSE

Question 27

Not yet answered

Marked out of 2.00

Flag question

Question text

When declaring an array of classtype such as:
Student myStudents[ 10 ];
C++ will require that there is a public parameterless constructor for the class Student. Lacking that constructor, the declaration above will not compile.

Select one:

a. TRUE

b. FALSE

Question 28

Not yet answered

Marked out of 2.00

Flag question

Question text

The methods of a class represents the "actions" that thing knows how to perform.

Select one:

a. TRUE

b. FALSE

Question 29

Not yet answered

Marked out of 2.00

Flag question

Question text

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

Question 30

Not yet answered

Marked out of 2.00

Flag question

Question text

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

Select one:

a. TRUE

b. FALSE

Question 31

Not yet answered

Marked out of 2.00

Flag question

Question text

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

Select one:

a. TRUE

b. FALSE

Question 32

Not yet answered

Marked out of 2.00

Flag question

Question text

A constructor always gets called when a class is asked to create an object.

Select one:

a. TRUE

b. FALSE

Question 33

Not yet answered

Marked out of 2.00

Flag question

Question text

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

Question 34

Not yet answered

Marked out of 2.00

Flag question

Question text

Given a point to an object o, C++ programmers use the symbol . to reference the members and methods of that pointer variable.

Select one:

a. FALSE

b. TRUE

Question 35

Not yet answered

Marked out of 2.00

Flag question

Question text

In C++, cout, the thing we have been using to process output, is actually an example of a class method.

Select one:

a. TRUE

b. FALSE

Question 36

Not yet answered

Marked out of 2.00

Flag question

Question text

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

Select one:

a. TRUE

b. FALSE

Question 37

Not yet answered

Marked out of 2.00

Flag question

Question text

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

Select one:

True

False

char[] var1 = “Hello”; // a c-string variable char * var2 = new char( 20 );
strcpy( var2, “Hello” ); // a c-string variable char var3[ 5 ] = { ‘H’, ‘e’, ‘l’, ‘l’, ‘o’ }; // an array std::string var4( “Hello” ); // a string variable

Explanation / Answer

I have given the answers to you here under by deleting the incorrect answers among the options.

Question 1

Question text

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

Answer:

Select one:

a. TRUE

Question 2

Question text

Only a pointer variable can be set to have the value NULL.

Select one:

Answer:

a. FALSE

Question 3

Question text

Any function, variable declaration or class method can be marked virtual.

Select one:

b. FALSE

Question 4

Question text

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

Question 5

Question text

Whenever they are passed as parameters to a function, the IO classes istream and ostream must be passed using a pass-by-reference parameter passing scheme.

Select one:

a. TRUE

Question 6

Question text

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

Select one:

a. FALSE

Question 7

Question text

The body of a do { ... } while(...); loop will always executes atleast once, no matter what test condition is stated.

Select one:

a. TRUE

Question 8

Question text

The body of a while(...) { ... } loop will always executes atleast once, no matter what test condition is stated.

Select one:

a. FALSE

Question 9

Question text

A throw(...) statement is an alternative way to return from a function or method that indicates some kind of failure occurred.

Select one:

a. FALSE

Question 10

Question text

The variable named var1 declared above will include an ending NULL character.

Select one:

a. TRUE

Question 11

question text

The variable named var4 declared above is an object and therefore has callable methods driver code can call.

Select one:

a. TRUE

Question 12

stion text

Run-time parameters passed to a function allow you to use different values each time the function is called.

Select one:

True

Question 13

Question text

A function defined to return void is allowed to have not even a single return statement.

Select one:

True

Question 14

Question text

In C++, a class' constructor is allowed to accept parameters.

Select one:

True

Question 15

Question text

When authoring a friend function, the keyword friend only appears in the .h file, NOT the .cpp file.

Select one:

False

Question 16

Question text

When a class method is marked with the keyword friend in a .h file,

Select one:

c. it will be required for C++ programmers to mark that class method with the keyword friend in the class' .cpp file.

Question 17

Question text

The default case is required in the switch selection statement.

Select one:

False

Question 18

uestion text

When a class method is marked with the keyword const in a .h file,

Select one:

e. None of the choices here are correct.

Question 19

Question text

An exception is an occurrence of an undesirable situation that can be detected during program execution.

Select one:

True

Question 20

Question text

If operator- is supported by a class, how many parameters should it be defined to accept?

Select one:

None

Question 21

Question text

The loop below:

int j = 0;
while ( j <= 10 )
j++;

terminates if j > 10.

Select one:

True

Question 22

Question text

If operator >> is supported by a class, how many parameters should it be defined to accept?

Select one:

b. 1

Question 23

Question text

In C++, the first element in an array has the index value

Select one:

b. 0

Question 24

Question text

The access modifiers public and private can be listed only once within a class' header (.h) file.

Select one:

a. FALSE

Question 25

Question text

The following code:
SpaceShip s;
cin >> s;
calls the operator<< defined as:
friend SpaceShip operator<<( istream& ins, SpaceShip & s );.

Select one:

b. FALSE

Question 26

uestion text

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

Select one:

b. FALSE

Question 27

uestion text

When declaring an array of classtype such as:
Student myStudents[ 10 ];
C++ will require that there is a public parameterless constructor for the class Student. Lacking that constructor, the declaration above will not compile.

Select one:

b. FALSE

Question 28

Question text

The methods of a class represents the "actions" that thing knows how to perform.

Select one:

a. TRUE

Question 29

uestion text

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:

minimum 2 required. maximum you can have 4

question30

Question text

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

Select one:

a. TRUE

Question 31

Question text

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

Select one:

a. TRUE

Question 32

Question text

A constructor always gets called when a class is asked to create an object.

Select one:

a. TRUE

uestion 33

Question text

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:

FALSE

Question 34

Question text

Given a point to an object o, C++ programmers use the symbol . to reference the members and methods of that pointer variable.

Select one:

a. FALSE

Question 35

Question text

In C++, cout, the thing we have been using to process output, is actually an example of a class method.

Select one:

a. TRUE

Question 36

Question text

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

Select one:

b. FALSE

Question 37

Question text

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

Select one:

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