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

Calling Void Functions without Parameters Question Answer 1. Given the following

ID: 3531969 • Letter: C

Question

Calling Void Functions without Parameters

Question

Answer

1.      Given the following prototype:

void pageHeading ();

The following statement is valid in the main function:

pageHeading ();

2.      Using the same prototype given in Exercise 1, the following statement is valid in the main function:

cout << pageHeading() << endl;

3.      Although void functions without parameters are legal in C++, they are not very useful since they do not communicate data between functions.

4.      In C++, void is a reserved word.

5.      Void functions with no parameters are very useful for writing reports.

6.      Functions with no parameters still require parenthesis signifying a parameter list.

Lab 7.2 Calling Void Functions with Value Parameters

Question

Answer
(Circle the correct answer)

1.      Given the following function:

void increment (int x)

{

      x++;

}

and the following code in the main function:

int x = 5;

increment (x);

cout << x << endl;

The output is:

a.        5

b.       6

c.        7

d.       a compiler error occurs

2.      Using the increment function given in Exercise 1, and the following code in the main function:

const int x = 5;

increment(x);

cout << x << endl;

The output is:

a.        5

b.       6

c.        7

d.       a compiler error occurs

3.      Using the increment function given in Exercise 1, and the following code in the main function:

int x = 5;

increment(x + 1);

cout << x << endl;

The output is:

a.        5

b.       6

c.        7

d.       a compiler error occurs

4.      Given the following function:

void displayData (int x, char l)

{

      cout <<

Question

Answer

1.      Given the following prototype:

void pageHeading ();

The following statement is valid in the main function:

pageHeading ();

2.      Using the same prototype given in Exercise 1, the following statement is valid in the main function:

cout << pageHeading() << endl;

3.      Although void functions without parameters are legal in C++, they are not very useful since they do not communicate data between functions.

4.      In C++, void is a reserved word.

5.      Void functions with no parameters are very useful for writing reports.

6.      Functions with no parameters still require parenthesis signifying a parameter list.

Explanation / Answer

Please Rate !! :D Can cntact me if you have any doubts !! :D :D

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