What set of code correctly initializes all elements of the array ar to the value
ID: 3555223 • Letter: W
Question
What set of code correctly initializes all elements of the array ar to the value 0, given the declaration
int ar[3];
ndx = 1;
while (ndx
ndx = 0;
while (ndx < 3)
ar[0] = ndx;
ndx++;
}
ndx = 1;
while (ndx < 3) {
ar[ndx] = 0;
++ndx;
}
ndx = 0;
while (ndx < 3) {
ar[ndx] = 0;
ndx++;
}
5 points
QUESTION 4
What is the value of x[2] after execution of this code fragment?
int x[4] = {3, 6, 9, 5};
x[2] -= x[1] % x[3];
1
2
8
3
5 points
QUESTION 5
Declare an array of integers size 10 called numbers.
ndx = 1;
while (ndx
ndx = 0;
while (ndx < 3)
ar[0] = ndx;
ndx++;
}
ndx = 1;
while (ndx < 3) {
ar[ndx] = 0;
++ndx;
}
ndx = 0;
while (ndx < 3) {
ar[ndx] = 0;
ndx++;
}
Explanation / Answer
1.
Ans:D
ndx = 0;
while (ndx < 3) {
ar[ndx] = 0;
ndx++;
}
4.
X[2]=x[2]-6%5
=9-1=8
ANS:8
5.
int mubers[10];
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.