adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    #include <stdarg.h>
    using namespace std;
    float avg( int Count, ... )
    {
        va_list Numbers;
        va_start(Numbers, Count);
        int Sum = 0;
        for (int i = 0; i < Count; ++i )
            Sum += va_arg(Numbers, int);
        va_end(Numbers);
        return (Sum/Count);
    }
    int main()
    {
        float Average = avg(10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
        cout << "Average of first 10 whole numbers : " << Average;
        return 0;
    }

a.

4

b.

5

c.

6

d.

7

Answer: (a).4

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?

Similar Questions

Discover Related MCQs

Q. What is the maximum number of arguments or parameters that can be

Q. Which header file should you include if you are to develop a function that can accept variable number of arguments?

Q. What will initialize the list of arguments in stdarg.h header file?

Q. To which does the function pointer point to?

Q. What we will not do with function pointers?

Q. What is the default calling convention for a compiler in c++?

Q. What are the mandatory part to present in function pointers?

Q. which of the following can be passed in function pointers?

Q. What is meaning of following declaration?
int(*ptr[5])();

Q. Which keyword is used to define the macros in c++?

Q. Which symbol is used to declare the preprocessor directives?

Q. How many types of macros are there in c++?

Q. What is the mandatory preprosessor directive for c++?

Q. What is the other name of the macro?

Q. Which of the following is used to implement the c++ interfaces?

Q. What is the ability to group some lines of code that can be included

Q. How many types does functions fall depends on modularization?

Q. How many types of modularization are there in c++?

Q. What does the client module import?

Q. Identify the correct statement.