Question

Three of these function overloads are considered identical by the compiler and would conflict with each...

  1. Three of these function overloads are considered identical by the compiler and would conflict with each other. The other would be considered different- choose the one that is considered different from others.
  1. Int foo ( int x, double y ) ;
  2. Int foo ( double x, int y ) ;
  3. Void foo ( int x, double y ) ;
  4. Int foo ( int day, double temp ) ;

  1. Consider the following incomplete code:

Int f ( int number )

}

………………………. ;

{

Int main()

{

Int x = 5

Cout << f (x) << endl;

Return 0;

}

What should be the missing line be ?

  1. Cout << x << endl
  2. Return number
  3. Return X
  4. Cout << number << endl
  1. Which of the following is NOT an advantage of using functions.
  1. Using functions makes program run faster
  2. Using functions makes reusing code easier.
  3. Using functions makes programs easier to read.
  4. Using functions abstracts away from detailed implementation.

  1. //print grade for the score

……….printGrade (double score) {

If ( score >=90.0)

Cout << ‘A’;

Else If ( score >=80.0)

Cout << ‘B’;

Else If ( score >=70.0)

Cout << ‘C’;

Else If ( score >=60.0)

Cout << ‘D’;

Else

Cout << ‘F’;

{

  1. Int
  2. Void
  3. Bool
  4. Char
  5. Double

  1. The following program invokes p() three times. What is the output from the last call of p()?

Void p() {

Int I = 5 ;

Static int j = 5;

I++

J++

Cout << “ I is “ << I << “ j is “ << j << endl;

}

Int main () {

P();                      

P();

P();

  1. I is 6 j is 6
  2. I is 8 j is 6
  3. I is 6 j is 8
  4. I is 8 j is 8

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Dear Student ,

As per requirement submitted above kindly find below solution.

Question 1:

Answer :B.int foo ( double x, int y ) {}

Explanation :The function int foo ( double x, int y ) {} will not conflict because this is considered as new function.

*******************************

Question 2:

Answer :B.Return number

Explanation :Below screen shows the output

*******************************

Question 3:

Answer :A.Using functions makes program run faster

Explanation :Using function program may not run faster , function is used for reusability.

*******************************

Question 4:

Answer :B.Void

Explanation :Function printGrade() does not anything hence return type is void.

*******************************

Question 5:

Answer :I is 6 j is 8

Explanation :Below screen shows the output

*******************************

NOTE :PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.

Add a comment
Know the answer?
Add Answer to:
Three of these function overloads are considered identical by the compiler and would conflict with each...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Am I getting this error because i declared 'n' as an int, and then asking it...

    Am I getting this error because i declared 'n' as an int, and then asking it to make it a double? This is the coude: #include "stdafx.h" #include <iostream> #include <fstream> #include <string> #include <algorithm> #include <vector> using namespace std; void sort(double grades[], int size); char calGrade(double); int main() {    int n;    double avg, sum = 0;;    string in_file, out_file;    cout << "Please enter the name of the input file: ";    cin >> in_file;   ...

  • 81. The following function call doesn’t agree with its prototype:              cout << BoxVolume( 10, 5...

    81. The following function call doesn’t agree with its prototype:              cout << BoxVolume( 10, 5 );                    int BoxVolume(int length = {1}, int width = {1}, int height = {1});                                                     T__   F__                                                                     82. The following function is implemented to swap in memory the          argument-values passed to it:         void swap(int a, int b)                   {           int temp;             temp = a;             a = b;             b = temp;        ...

  • Consider the following program: # include <iostream> int x = 3, y = 5; void foo(void)...

    Consider the following program: # include <iostream> int x = 3, y = 5; void foo(void) { x = x + 2; y = y + 4; } void bar(void) { int x = 10; y = y + 3; foo( ); cout << x << endl; cout << y << endl; } void baz(void) { int y = 7; bar( ); cout << y << endl; } void main( ) { baz( ); } What output does this program...

  • I know the right answers by using a compiler. However, can you please explain each step...

    I know the right answers by using a compiler. However, can you please explain each step and how you get the correct answer. Thank you in advance. Output: E = 1 F = 7 G = 11 H = 14 W = 5 X = 6 Problem 7 #include <iostream> #include <cmath> using namespace std; void F1(int,int,int,int&); void F2(int,int&,int&,int&); int main ( void ) { int E=1,F=2,G=3,H=4,W=5,X=6;    F1(E,F,G,H);    F2(E,F,G,H);    cout << "E = " << E <<...

  • howthe   output   of   the   following   4   program segments (a)    const int SIZE=8;    int values[SIZE]...

    howthe   output   of   the   following   4   program segments (a)    const int SIZE=8;    int values[SIZE] = {10, 10, 14, 16, 6, 25, 5, 8};    int index;    index=0;    res = values[index];    for (int j=1; j<SIZE; j++)    {        if (values[j] > res)        {            res = values[j];            index = j;        cout << index << res << endl;        }    }    cout <<...

  • How to turn this file into a main.cpp, a header which contains the function declaration, and...

    How to turn this file into a main.cpp, a header which contains the function declaration, and a implementation fiel containing the function definition ? #include<iostream> #include<string> #include<iomanip> using namespace std; #define NUM 1 #define MULT 4 void getPi(int iter); int main() {    int it;    cout << "Enter the number of iterations needed to find PI: ";    cin >> it;    while (it < 1) {        cout << "Error!!! Iteration input should be positive." << endl;...

  • I know I'm on the right path, but don't know where to continue from here. This is a C++ assignmen...

    I know I'm on the right path, but don't know where to continue from here. This is a C++ assignment Your job is to write that will display a calendar for any given month of a given year. The user will need to type the number of the month as an integer from 1 to 12 (1 is for January, etc.), and the year as a 4-digit integer. This assignment simply requires that your program make use of more than...

  • C++ Time the sequential search and the binary search methods several times each for randomly generated...

    C++ Time the sequential search and the binary search methods several times each for randomly generated values, then record the results in a table. Do not time individual searches, but groups of them. For example, time 100 searches together or 1,000 searches together. Compare the running times of these two search methods that are obtained during the experiment. Regarding the efficiency of both search methods, what conclusion can be reached from this experiment? Both the table and your conclusions should...

  • I have 2 issues with the C++ code below. The biggest concern is that the wrong...

    I have 2 issues with the C++ code below. The biggest concern is that the wrong file name input does not give out the "file cannot be opened!!" message that it is coded to do. What am I missing for this to happen correctly? The second is that the range outputs are right except the last one is bigger than the rest so it will not output 175-200, it outputs 175-199. What can be done about it? #include <iostream> #include...

  • please help me fix the error in here #include<iostream> #include <string> using namespace std; string getStudentName();...

    please help me fix the error in here #include<iostream> #include <string> using namespace std; string getStudentName(); double getNumberExams(); double getScoresAndCalculateTotal(double E); double calculateAverage(double n, double t); char determineLetterGrade(); void displayAverageGrade(); int main() { string StudentName; double NumberExam, Average, ScoresAndCalculateTotal; char LetterGrade; StudentName = getStudentName(); NumberExam = getNumberExams(); ScoresAndCalculateTotal= getScoresAndCalculateTotal(NumberExam); Average = calculateAverage(NumberExam, ScoresAndCalculateTotal); return 0; } string getStudentName() { string StudentName; cout << "\n\nEnter Student Name:"; getline(cin, StudentName); return StudentName; } double getNumberExams() { double NumberExam; cout << "\n\n Enter...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT