Home / MCQ Bank / Computer
Computer Functions And Procedures In C Plus Plus

What will be the output of the following C++ code? #include <iostream> using namespace std; void Sum(int a, int b, int & c) { a = b + c; b = a + c; c = a + b; } int main() { int x = 2, y =3; Sum(x, y, y); cout << x << " " << y; return 0; }

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option C • 2 15

Related Computer Questions

Consider the following code snippet to find the smallest element in a linked list: struct Node { int val; struct Node* next; }*head; int get_min() { struct Node* temp = head->next; int min_num = temp->val; while(temp != 0) { if(_________) min_num = temp->val; temp = temp->next; } return min_num; } Which of the following lines should be inserted to complete the above code? What does the 'gets' method do in Ruby? The java package structure has changed from com.yahoo.zookeeper* to ______ Salary comes under ________ Head You have to find the sum of digits of a number given that the number is always greater than 0. Which of the following base cases can replace the base case for the below code? #include<stdio.h> int recursive_sum_of_digits(int n) { if(n == 0) return 0; return n % 10 + recursive_sum_of_digits(n/10); } int main() { int n = 1201; int ans = recursive_sum_of_digits(n); printf("%d",ans); return 0; }