Vidyalelo
C++ Programming · Q834

C++ miscellaneous

Programming · C++ Programming · question 834

Q834

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.cshift(-3); for (int &x: varr) cout << x << " "; return 0;

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

Answer: Option C

Solution

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