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

Question 18 What is the output of the following program segment? int main() { fl

ID: 3780908 • Letter: Q

Question

Question 18

What is the output of the following program segment?
int main()
{
float hours = 8;
float payRate = 5.5; // per hour
float grossPay = 0.0;
grossPay = calcGrossPay (hours, payRate);
displayGrossPay(grossPay);
return 0;
}
float calcGrossPay(float hrs, float payRt)
{
return hrs * payRt;
}
void displayGrossPay(float gPay)
{
cout <<"Gross Pay is "<< gPay << endl;
}
      
44
      
Gross Pay is 44
      
Gross Pay is gPay
      
All of the above


--------------------------------------------------------------
Question 19

Assume a program uses the statement name = getFirstName(); to call the getFirstName function. (name is a string variable). Which of the following is a valid function header for the getFirstName function?
      
void getFirstName(string firstName)
      
string getFirstName(string firstName)
      
string getFirstName()
      
void getFirstName()


--------------------------------------------------------------
Question 20

How many parameters does the function calcGrossPay require?
int main()
{
float hours = 8;
float payRate = 5.5; // per hour
float grossPay = 0.0;
grossPay = calcGrossPay (hours, payRate);
displayGrossPay(grossPay);
return 0;
}
float calcGrossPay(float hrs, float payRt)
{ return hrs * payRt;
}
void displayGrossPay(float gPay)
{
cout <<"Gross Pay is "<< gPay << endl;
}
      
0 parameters
      
1 parameter
      
2 parameter
      
3 parameter


--------------------------------------------------------------
Question 21

The cout<< sales[0] + sales[1]; statement will __________.
Use the following 5 element array, named sales, to answer this question.

10000 12000 900 500 20000

      
display 22000
      
display 10000 + 12000
      
display sales[0] + sales[1]
      
result in an error

Explanation / Answer

Answers:

Question 18

What is the output of the following program segment?

I have excecuted the program succesfully, got output

the solution is Gross Pay is 44

Question 19

Assume a program uses the statement name = getFirstName(); to call the getFirstName function. (name is a string variable). Which of the following is a valid function header for the getFirstName function?

the solution is :void getFirstName(string firstName)

Question 20

How many parameters does the function calcGrossPay require?

the solution is 2 parameter

Question 21

The cout<< sales[0] + sales[1]; statement will __________.
Use the following 5 element array, named sales, to answer this question.

10000 12000 900 500 20000

the solution is  display 22000

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