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

c++ Question 5 Whenever they are passed as parameters to a function, the IO clas

ID: 667004 • Letter: C

Question

c++

Question 5

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

b. TRUE

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

b. FALSE

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

b. FALSE

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

b. FALSE

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 is an object and therefore has callable methods driver code can call.

Select one:

a. FALSE

b. TRUE

Question 11

Not yet answered

Marked out of 2.00

Flag question

Question text

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

Select one:

True

False

Question 12

Not yet answered

Marked out of 2.00

Flag question

Question text

The variable named var3 declared above is not an object and therefore has no methods driver code can call.

Select one:

a. FALSE

b. TRUE

Question 13

Not yet answered

Marked out of 2.00

Flag question

Question text

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

Select one:

a. TRUE

b. FALSE

Question 14

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 15

Not yet answered

Marked out of 2.00

Flag question

Question text

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

Select one:

True

False

Question 16

Not yet answered

Marked out of 2.00

Flag question

Question text

In C++, a class is allowed to have more than one constructor.

Select one:

True

False

Question 17

Not yet answered

Marked out of 2.00

Flag question

Question text

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

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 friend in a .h file,

Select one:

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

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

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 link error if C++ programmers mark that class method with the keyword friend 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

The default case is required in the switch selection statement.

Select one:

True

False

Question 20

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 run-time error if C++ programmers mark that class method with the keyword const in the class' .cpp file.

b. None of the choices here are correct.

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

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

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

Question 21

Not yet answered

Marked out of 2.00

Flag question

Question text

In addition to redefining existing operators, C++ allows programmers to create their own new operators.

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. 1 or 2

b. 2

c. 3

d. 1

e. None

Question 23

Not yet answered

Marked out of 2.00

Flag question

Question text

In an infinite while loop, the expression controlling the loop will initially evaluate to false, but after the first iteration it will always evaluate to true.

Select one:

True

False

Question 24

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

b. 3

c. 1 or 2

d. 2

e. None

Question 25

Not yet answered

Marked out of 2.00

Flag question

Question text

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

Select one:

a. this

b. friend

c. class

d. for

e. tryorfail

Question 26

Not yet answered

Marked out of 2.00

Flag question

Question text

Which of the following declarations for a function is valid and legal in C++?

Select one:

a. void foo

b. All of the choices listed are valid C++ function declarations

c. int foo( char x );

d. None of the choices listed is a valid C++ function declaration

e. foo( int a, int b );

Question 27

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

5) false
for pass by parameter no need to pass IO classes and ostream....for pass by referrence
we wil pass

6) TRUE
without constructor object cannot be instantiaited.

7 & 8) TRUE
first it pass through do and then executes once and lastly it checks condition.
syntax do
{
   /* code */ //execiutes minimum once
} while (/* condition */);


9)TRUE
When we write set of expressions to do in try block...if we write catch it will catch exception...using throw

10)TRUE
it is avaiable as globally scope and for object we can call driver methods.


11) TRUE
it stores as 'H' 'E' 'L' 'L' 'O' ' '

12) TRUE
Yes it is array so no callable methods....only object can call

13) FALSE
It is variable and can still call methods.

14) TRUE
for pass by parametrs we can use many variables for pass by reference we can't

15) TRUE
as it shares address.. it will directly change original value

16) TRUE
parameterised and default constructor

17) FALSE
in cpp also we can use

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

19) FALSE
not necessary

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

21) TRUE

22) d. 1
   One parameter is enough..increment operator

23) FALSE
infinite loop means it will execute always.

24) c. 1 or 2

25) e. tryorfail
this keyword not there in c++

26) b. all are valid

27) TRUE

passbyvalue(array);
passByReferrence(&array);

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