A
Here, you will find a collection of MCQ questions on C++. Go through these questions to enhance your preparation for upcoming examinations and interviews.
To check the correct answer, simply click the View Answer button provided for each question.
Have your own questions to contribute? Click the button below to share your MCQs with others!
+ Add QuestionA
A
#include #include using namespace std; void function(std::string message, ...); int main() { function("UdayMCQBuddy", 5, 7, 10, 8, 9); return 0; } void function(std::string message, ...) { va_list ptr; int number; va_start(ptr, message); number = va_arg(ptr, int); number = va_arg(ptr, int); cout << number; }
A
A
#include #include using namespace std; void List(int, ...); int main() { List(2, 5, 10); List(3, 6, 9, 7); return 0; } void List(int num, ...) { va_list a; int k; va_start(a, num); while (num-->0) { k = va_arg(a, int); cout << k; } va_end(a); }
A
#include #include using namespace std; int Addition(int number, ...) { int sum = 0; va_list args; va_start (args,number); for (int i = 0; i < number; i++) { int number = va_arg (args,int); sum += number; } va_end (args); return sum; } int main (void) { int Result = Addition(1, 10, 9, -1, 13, 23, -2, 9, 17); cout << "The result is " << Result; return 0; }
A
A
#include #include using namespace std; float avg( int Count, ... ) { va_list num; va_start(num, Count); int Sum = 0; for (int i = 0; i < Count; ++i ) Sum += va_arg(num, int); va_end(num); return (Sum/Count); } int main() { float AVG = avg(5, 0, 1, 2, 3, 4); cout << "Average of first 5 whole numbers : " << AVG; return 0; }
A
A
A
#include using namespace std; int function(int p = 12, int q) { int s; s = p + q; return s; } int main() { cout << function(15); return 0; }
If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.
Share Your MCQ