Vidyalelo
C++ Programming · Q685

C++ miscellaneous

Programming · C++ Programming · question 685

Q685

What will be the output of the following C++ code? #include #include using namespace std; int main() Valarray varr = 1, 2, 3, 4, 5 ; for (int &x: varr) cout << x << " "; cout<<endl; varr = varr.shift(-3); for (int &x: varr) cout << x << " "; return 0;

A.
1 2 3 4 5
1 2 0 0 0
B.
1 2 3 4 5
0 0 0 1 2
Answer
C.
1 2 3 4 5
3 4 5 1 2
D.
1 2 3 4 5
1 2 3 4 5

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board