Question: Question 1 ( 1 2 points ) What is output by the code below? int gRay [ 1 0 ] ; gRay [ 0 ]
Question points
What is output by the code below?
int gRay;
gRay;
gRay;
gRay;
gRay;
gRay;
cout gRay.length;
Question options:
a
b
c
error
d
e
Question points
Which of the following lines would correctly fill
code in function getIt
method getIt should return the sum of all numbers in array
int getItint array int length
int z;
forint spot; spot length; spot
code
return z;
Question options:
a
z z arrayspot;
b
z z arrayspot;
c
z z arrayspot;
d
z z spot;
Question points
What will be printed?
void changeArray int a int len
for int i ; i len; i
ai ai;
back in the main method
int arr ;
int len ;
changeArrayarrlen;
cout arr;
Your Answer:
Question options:
Answer
Question points
What is the value of alpha after the following code executes?
int alpha;
int j;
for j ; j ; j
alphaj j ;
Question options:
a
b
c
d
Question points
The word const is used before the array declaration in a function heading to allow the function to modify the array.
Question options:
True
False
Question points
Suppose that list is an array of components of type int. Which of the following codes correctly outputs all the elements of list?
Question options:
a
for int j ; j ; j
cout listj;
cout endl;
b
for int j ; j ; j
cout listj;
cout endl;
c
for int j ; j ; j
cout listj;
cout endl;
d
for int j ; j ; j
cout listj;
cout endl;
Question points
Suppose that gamma is an array of components of type int and j is an int variable. Which of the following for loops sets the index of gamma out of bounds?
Question options:
a
for j ; j ; j
cout gammaj;
b
for j ; j ; j
cout gammaj;
c
for j ; j ; j
cout gammaj;
d
for j ; j ; j
cout gammaj;
Question points
Suppose list is a one dimensional array of size wherein each component is of type int. Further, suppose that sum is an int variable. The following for loop correctly finds the sum of the elements of list.
sum ;
for int i ; i ; i
sum sum list;
Question options:
True
False
Question points
Given two arrays of integers arr & arr with identical lengths, the following if statement will determine if the arrays have the same values.
if arr arr
Question options:
True
False
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
