Question: What is output by the code below? int tRay [ ] = { 2 , 1 2 , 1 1 , 4 5 , 5

What is output by the code below?
int tRay[]={2,12,11,45,52,36,1,0,-279};
int big =-999;
for(int i =0; i<9; i++)
if(tRay[i]>big)
big = tRay[i];
cout << big;
Question 1 options:
a)
45
b)
-279
c)
52
d)
11
Question 2(15 points)
What operation is being performed by the method doTask()?
int doTask(int array[], int length)
{
int z=0;
for(int i=0; i 10)
z++;
}
return z;
}
Question 2 options:
a)
counting the numbers less than ten in array
b)
counting all odd numbers in array
c)
counting the numbers greater than ten in array
d)
counting all even numbers in array
Question 3(14 points)
The array index can be any positive integer less than or equal to the array size.
Question 3 options:
True
False
Question 4(14 points)
The base address of an array is the address (that is, the memory location) of the last array element.
Question 4 options:
True
False
Question 5(14 points)
Suppose that sales is an array of 50 components of type double. Which of the following correctly initializes the array sales?
Question 5 options:
a)
for (int j =1; j <=50; j++)
sales[j]=0;
b)
for (int j =0; j <=49; j++)
sales[j]=0.0;
c)
for (int 1=1; j <=49; j++)
sales[j]=0;
d)
for (int j =0; j <=50; j++)
sales[j]=0.0;
Question 6(14 points)
When you pass an array as a parameter, the base address of the actual array is passed to the formal parameter.
Question 6 options:
True
False
Question 7(14 points)
The statement int list[25]; declares list to be an array of 26 components, since the array index starts at 0.
Question 7 options:
True
False

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!