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
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.