EGR 1400 Exam 2 Oakland University | UPDATED Questions with
100% Verified Answers
Question:
When the location of the original variable is passed as an
argument from the calling method to the called method, we
say that it is...
a. passed by reference
b. copy passed
c. passed by value
d. reference passed
e. none of the above
Answer:
a. passed by reference
Question:
How many times does the message box get executed in a
loop that begins with the following statement?
int I;
for (I = 1; I < 4; I++)
{
MessageBox.Show(I);
}
a. 0
b. 2
c. 3
d. 1
e. none of the above
Answer:
c. 3
Question:
What is the value of the variable I after the loop is finished
executing?
,int I;
for (I = 1; I < 4; I++)
{
MessageBox.Show(I);
}
a. 1
b. 2
c. 3
d. 4
e. none of the above
Answer:
d. 4
Question:
How many locations will there be for an array declared as:
string[ ] Names = new string[4];
a. 4
b. 3
c. 2
d. 1
e. none of the above
Answer:
a. 4
Question:
After the code is finished executing, what is the value of A[1]?
int[ ] A = new int[5];
int[ ] B = new int[3];
int x;
for (x = 0; x < 5; x++)
{
A[x] = x * 2 + 4;
}
, a. 10
b. 8
c. 6
d. 0
e. none of the above
Answer:
c. 6
Question:
What is the maximum index of the array, B?
int[ ] A = new int[5];
int[ ] B = new int[3];
int x;
for (x = 0; x < 5; x++)
{
A[x] = x * 2 + 4;
}
a. 0
b. 2
c. 3
d. 4
e. none of the above
Answer:
b. 2
Question:
Which of the following statements will set RandNum to a value
between 1 and 6 (including 1 and 6)?
a. RandNum = myRand.Next(0,6);
b. RandNum = myRand.Next(0,7);
c. RandNum = myRand.Next(1,7);
d. RandNum = myRand.Next(1,6);
e. RandNum = myRand.Next();
100% Verified Answers
Question:
When the location of the original variable is passed as an
argument from the calling method to the called method, we
say that it is...
a. passed by reference
b. copy passed
c. passed by value
d. reference passed
e. none of the above
Answer:
a. passed by reference
Question:
How many times does the message box get executed in a
loop that begins with the following statement?
int I;
for (I = 1; I < 4; I++)
{
MessageBox.Show(I);
}
a. 0
b. 2
c. 3
d. 1
e. none of the above
Answer:
c. 3
Question:
What is the value of the variable I after the loop is finished
executing?
,int I;
for (I = 1; I < 4; I++)
{
MessageBox.Show(I);
}
a. 1
b. 2
c. 3
d. 4
e. none of the above
Answer:
d. 4
Question:
How many locations will there be for an array declared as:
string[ ] Names = new string[4];
a. 4
b. 3
c. 2
d. 1
e. none of the above
Answer:
a. 4
Question:
After the code is finished executing, what is the value of A[1]?
int[ ] A = new int[5];
int[ ] B = new int[3];
int x;
for (x = 0; x < 5; x++)
{
A[x] = x * 2 + 4;
}
, a. 10
b. 8
c. 6
d. 0
e. none of the above
Answer:
c. 6
Question:
What is the maximum index of the array, B?
int[ ] A = new int[5];
int[ ] B = new int[3];
int x;
for (x = 0; x < 5; x++)
{
A[x] = x * 2 + 4;
}
a. 0
b. 2
c. 3
d. 4
e. none of the above
Answer:
b. 2
Question:
Which of the following statements will set RandNum to a value
between 1 and 6 (including 1 and 6)?
a. RandNum = myRand.Next(0,6);
b. RandNum = myRand.Next(0,7);
c. RandNum = myRand.Next(1,7);
d. RandNum = myRand.Next(1,6);
e. RandNum = myRand.Next();