Question

61. The following program is accepted by the compiler:         int sum( int x, int y...

61. The following program is accepted by the compiler:

        int sum( int x, int y )

        {

            int result;

            result = x + y;   

        }                       

    T__   F__

62. The following implementation is accepted by the compiler:

        void product()

        {

            int a; int b; int c; int result;

            cout << "Enter three integers: ";

            cin >> a >> b >> c;

            result = a * b * c;

            cout << "Result is " << result;

            return result;        

        }                          

                                  

    T__   F__

63. The following program has no error:

    using namespace std;

   

    int main()

    {

        double number1, number2, sum;

        cout << "Enter a number: ";

        cin >> number1;

        cout << "Enter another number: ";

        cin >> number2;

        sum = number1 + number2;

        cout << "The sum of the two numbers is " << sum;

        return 0;     

    }

    T__   F__

64. The following program is syntactically incorrect:

    #include <iostream>

    using namespace std;

    int main()

    {

        const number1, number2, product;     

                                          

        cout << "Enter two numbers and I will multiply\n";

        cout << "them for you.\n";

        cin >> number1 >> number2;        

        product = number1 * number2;       

        cout << product;

    }

    T__ F__

65. The following program is syntactically correct:

    #include <iostream>

    using namespace std;

    int main()

    {

        double number1, number2, sum;

        cout << "Enter a number: ";

        cin >> number1;

        cout << "Enter another number: ";

        cin >> number2;

        number1 + number2 = sum;         

        cout << "The sum of the two numbers is " << sum;

        return 0;

    }

    T__   F__

66. The following is a function prototype:

        CalcTotal();

T__   F__          

67. Parameter names in a prototype are optional.

    T__   F__

68. Overloaded functions:

    A. are a group of functions with the same name and same

       number of arguments.

    B. are a group of functions with the same name and

       different parameter types.        

    C. make life easier for the programmer.

    D. none of the above.

   

69. The following function prototypes

        int increment(char);

      int increment(int);

    are not accepted in C++ because they have the same name.

    T__   F__  

70. The following function prototypes are not accepted by compiler:

        int GetValue();       

        double GetValue();          

    T__   F__

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

61. The following program is accepted by the compiler:

int sum( int x, int y )

{

int result;

result = x + y;   

}   

False, because the method has a return type integer but the method in its defination does not return anything.

62. The following implementation is accepted by the compiler:

void product()

{

int a; int b; int c; int result;

cout << "Enter three integers: ";

cin >> a >> b >> c;

result = a * b * c;

cout << "Result is " << result;

return result;

}

  

False, because the return type is void and we are returning an integer from the function

63. The following program has no error:

using namespace std;

int main()

{

double number1, number2, sum;

cout << "Enter a number: ";

cin >> number1;

cout << "Enter another number: ";

cin >> number2;

sum = number1 + number2;

cout << "The sum of the two numbers is " << sum;

return 0;   

}

True, the program runs without error

64. The following program is syntactically incorrect:

#include <iostream>

using namespace std;

int main()

{

const number1, number2, product;   

  

cout << "Enter two numbers and I will multiply\n";

cout << "them for you.\n";

cin >> number1 >> number2;

product = number1 * number2;   

cout << product;

}

False, as we have not provided a data type to the variables number1,number2,product.

65. The following program is syntactically correct:

#include <iostream>

using namespace std;

int main()

{

double number1, number2, sum;

cout << "Enter a number: ";

cin >> number1;

cout << "Enter another number: ";

cin >> number2;

number1 + number2 = sum;   

cout << "The sum of the two numbers is " << sum;

return 0;

}

False, as expression can be assigned to a variable, a variable can never be assigned to an expression

66. The following is a function prototype:

CalcTotal();

False, it should have a return type.   

67. Parameter names in a prototype are optional.

true, you can have or not have parameters in a function

68. Overloaded functions:

A. are a group of functions with the same name and same

number of arguments.

B. are a group of functions with the same name and

different parameter types.

C. make life easier for the programmer.

D. none of the above.

Overloaded functions are the one with same names but different parameter types.

69. The following function prototypes

int increment(char);

int increment(int);

are not accepted in C++ because they have the same name.

False, they are accepted as they are overloaded functions with different data types.

70. The following function prototypes are not accepted by compiler:

int GetValue();   

double GetValue();

True, as functions overloaded with different return types are not accepted.

if you like the answer please provide a thumbs up.

Add a comment
Know the answer?
Add Answer to:
61. The following program is accepted by the compiler:         int sum( int x, int y...
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
  • 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;        ...

  • 31. The following code segment is syntactically correct:              int number{20};          cout << number <<...

    31. The following code segment is syntactically correct:              int number{20};          cout << number << setbase(16) << " " << number                               << setbase(10) << " " << number                                 << showpos << " " << number << endl;                 T__   F__       32. The following statement wants to determine if ‘count’ is outside the     range of 0 through 100:             if (count < 0 && count > 100)                                             T__   F__ 33. There is...

  • 1. Every C++ program must have:     A. a cout statement    B. function main                C....

    1. Every C++ program must have:     A. a cout statement    B. function main                C. a #include          D. All of the above                 2. main() is a method that is part of the ‘Standard Library’.          T__   F__         3. Inside a ‘Console Application’, a ‘Project’ may implement multiple          ‘Solutions’.                                  T__   F__         4. The C++ source-code files are listed with the extension .sln.     T__   F__           5. It is recommended to start...

  • The program has errors. Identify and make the necessary changes to make the program work. Remember...

    The program has errors. Identify and make the necessary changes to make the program work. Remember to follow the rules of functions and arrays. Here is the expected output Total = 20 Average = 15 Area = 150 Area = 70 Enter a value: 10 Value 1 entered = 10 Enter an integer: 20 Value 2 entered = 20 Enter an integer: 30 Value 3 entered = 30 .................................................................. #include <iostream> using namespace std; void total(int, int, int); double average(int...

  • 41. Executing the "continue" statement from within a loop     causes control to go     A....

    41. Executing the "continue" statement from within a loop     causes control to go     A. to the next line of code     B. out of the loop     C. to the beginning of the loop          D. to check the loop condition for repeating the loop     E. none of the above      42. The 'default' statement inside a 'switch()' is optional.          T__   F__             43. The following 'switch' implementation is legal:              int i = 2;        ...

  • Flow chart of this program #include <iostream> #include <cmath> using namespace std; int mainO double sum=0.0,...

    Flow chart of this program #include <iostream> #include <cmath> using namespace std; int mainO double sum=0.0, ave-ee, int locmx, locmn int n; cout <<"Enter the number of students: "<<endl; cin >> ni double listln]; double max-0; double min-e; for (int i-e ; i<n ;i++) cout<s enter the gpa: "<cendli cin>>listli]; while (listlile i listli1>4) cout<s error,Try again "<cendl; cin>listlil: sun+=list[i]; N1 if (listli]>max) for(int isin itt) max=list [i]; 10cmx=1+1 ; else if (list [i] min) min=list [i]; locmn-i+1; ave sum/n;...

  • #include <iostream> #include <string> using namespace std; int main() { int number; int sum = 0;...

    #include <iostream> #include <string> using namespace std; int main() { int number; int sum = 0; while(true) { cout << "Please enter a number between 1 and 11: "; cin >> number; if (number >= 1 && number <= 11) { cout << number << endl; sum = sum + number; //only add the sum when number is in range: 1-11, so add wthin this if case } else { cout << number << endl; cout << "Out of range;...

  • I am working on this switch program everything seems to be ok but the compiler is...

    I am working on this switch program everything seems to be ok but the compiler is giving me an error on the final closing brace and wanted to know where I am making an error #include <iostream> #include <iomanip> #include <cmath> using namespace std; int main() { int choice; char repeat; double MidTerm = 0; double FinalExam = 0; double Quiz1 = 0; double Quiz2 = 0; double MidTermGrade = 1, FinalExamGrade = 2, Quiz1Grade = 3, Quiz2Grade = 4,...

  • there is a function to create two random numbers between 1 and 25 and a function...

    there is a function to create two random numbers between 1 and 25 and a function to add them together. add the prototypes correctly, call them from main correctly and output the results. The three functions should be subtractNumbers, multiplyNumbers, and divideNumbers. Remember that division won't always yield an integer so be sure to take care of that issue within the function (don't change the variable declarations). Don't change the code that I've given you. Follow the same pattern. #include...

  • Write following program using Switch statement. #include <iostream> using namespace std; int main() int number; cout...

    Write following program using Switch statement. #include <iostream> using namespace std; int main() int number; cout << "Enter an integer cin >> number; if (number > B) cout << You entered a positive integer: " << number << endl; else if (number (8) cout<<"You entered a negative integer: " << number << endl; cout << "You entered e." << endl; cout << "This line is always printed." return 0;

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