isys 3393 exam 2 review

Write the statement to declare a string variable that can be used in multiple methods/forms and that will hold the name My Company Name.

const string COMPANY_NAME = "My Company Name";

Items can be added to a list during run time using the _ method.
AddLists
Lists
ItemsAdd
Items.Add

Items.Add

int [, ] score = {{88, 66, 76, 92, 95} {67, 88, 45, 99, 80}};
int total = 0;
foreach (int val in score)
total += val;
using the code shown above, what is added to total during the first iteration?
0
86, 66, 76, 92 and 95
unknown, because val is not initia

88

given: priceDecimal = 100, taxDecimal = 0.1, stateNameString = "Arkansas", cityNameString = "Rogers"
What is the value of AdjustedPriceDecimal when the following statements are executed?
Switch (stateNameString)
{
Case "Arkansas":
adjustedPriceDecimal = p

110

int [ , , ] anArray = new [4, 3, 5] allows _ elements to be stored.
15
12
60
4

60

for (int i = 1; i < 10; i++)
Console.Write(i + "\t");
Given the code snippet above, how many times will the loop body be executed?
9
10
11
1

9

if (a > 10)
if (b > 10)
if (c > 10)
result = 1;
else
if (b > 100)
result = 2;
else
result = 3;
else
result = 4;
else
result = 5;
Using the above code segment, what is stored in result when a = 1, b = 1 and c = 100?
5
3
2
4

5

int [ ] anArray = new int [10];
int [ ] anArray = {8, 7, 4, 5, 10, 2, 3, 5, 1, 2};
foreach (int val in anotherArray)
total += val;
Using the above declaration along with the foreach loop, what is stored in total after the program statements are executed?

47

int inner;
for (int outer = 0; outer < 5; outer++)
{
for (inner = 1; inner < 2; inner++)
Console.WriteLine("Outer: {0}\tInner: {1}", outer, inner);
}
The nested for statement above displays how many lines out output?
7
5
0
1

5

int [ , ] points = {{300, 100, 200, 400, 600}, {550, 700, 900, 800, 100}};
For the above declaration, the statement points [1, 3] = points [1, 3] + 10; will:
replace the 300 amount with 310 and 900 with 910
replace the 800 amount with 810
replace the 500

replace the 800 amount with 810

string [ , ] name = new string [2, 3] {{"Alex", "Ben", "Cay"}, {"Jose", "Tyne", "Yin"}};
Looking above, what does name[1, 2] reference?
tyne
yin
ben
alex

yin

int [ ] anArray = new int [5];
int [ ] anotherArray = {2, 3, 5, 9, 1};
anotherArray.Length returns _.
5
10
6
10

5

if (amount > 1000)
result = 1;
else
if (amount > 500)
result = 2;
else
if (amount > 100)
result = 3;
else
result = 4;
Using the above code segment, what is stored in result when amount is equal to 126?
4
1
3
2

3

int [ ] anArray = new int [5];
int [ ] anotherArray = {6, 7, 4, 5, 6, 10};
for (int i = 0; i < anotherArray.Length; i++)
{
total +=i;
}
Using the above declaration along with the for loop, what is stored in total after the program statements are executed?

15

The logical operators in C# are _.
==, =, and !=
!= and ==
>, <, >=, <=
&& and ||

&& and ||

What is the statement that closes the form?

This.Close();

int counter = 0;
while (counter < 100)
{
Console.WriteLine(counter);
counter++;
}
Looking above, if the loop body was changed from counter++; to counter+= 10;, how many times would the loop body be executed?
100
10
20
5

10

double [ , ] price = new double [2, 5] {{1.1, 1.2, 1.3, 1.5, 1.4} {2.1, 2.2, 2.3, 2.5, 2.4}};
With the declaration above, price[0] refers to 1.1
true
false

false

int [ ] anArray = new int [10];
int [ ] anotherArray = {6, 7, 4, 5, 6, 2, 3, 5, 9, 1};
How could all values of anotherArray be totaled?
foreach(int val in anotherArray) total += val;
all of the above
for (int i = 0; i < anotherArray.Length; i++) total +=

foreach(int val in anotherArray) total += val;

The loop control structure used to move through a collection that does not require you to increment a loop control variable or test the expression to determine when all data has been processed is the _ statement.
while
do...while
for
foreach

foreach

int counter = 0;
while (counter < 100)
{
Console.WriteLine(counter);
counter++;
}
The last value printed with the program segment above is _.
0
100
101
99

99

if (int.TryParse(inStringValue, out integerValue) == false) Console.WriteLine("Invalid input - 0 recorded for end value");
If a character such as "b" is entered by the user and stored in inStringValue, TryParse() returns _.
false
true
0
1

false

switch(phoneDigit)
{
case 1: num = 1;
break;
case 2: num = 2;
break;
case 3: num = 3;
break;
case 4: num = 4;
break;
default: num = 0;
break;
}
Looking at the example above, when phoneDigit has a value of 3, what value is stored in num?
0
not enough infor

3

what will display in MessageLabel when the following statements are executed? Assume that countInteger = 15
string message = "Hello world!";
If (count <= 10)
messageLabel.Text = message.ToLower();
else if (count > 20 Then messageLabel.Text = message.ToUpp

Hello world!

The Show method of a MessageBox returns a _ object that you can check to see which button the user clicked.
Show
ShowMe
Selected
DialogResult

DialogResult

int loopVariable = 0;
do
{
Console.WriteLine("Count = {0}", ++loopVariable);
} while (loopVariable <5);
What will be printed during the first iteration through the loop?
Count = 1
Count = 0
0
Count = 15

Count = 1

if an array named num is dimensioned to hold 10 values in 5 rows and 2 columns, how would you store 50 in the first physical row and second physical column?
num[2] = 50;
nnum[0, 0] = 50;
num[0, 1] = 50;
num[1, 1] = 50;

num[0, 1] = 50;

if(value1 > value2)
largestOne = value1;
else
if (value1 < value2)
largestOne = value2;
else
largestOne = -(value1);
using the nested if program statements, assuming value1 is 50 and value2 is 75, what is stored in largestOne above?
-(value1)
not enough i

value2

how many times will the statements inside this for/next loop be executed?
for(int i = 0; i < 5; i++)
{
listbox1.Items.Add(i);
}
1
4
6
5

5

which of the following is the correct syntax for the MessageBox()?
MessageBox.Show(string, string, MessageBoxButtons, MessageBoxIcon);
MessageBox.Display(string, string, MessageBoxButtons, MessageBoxIcon);
MessageBox.Show(string, string, MessageBoxIcon, M

MessageBox.Show(string, string, MessageBoxButtons, MessageBoxIcon);

one of the special properties in the Array class is Length. it returns _.
an int representing the number of values currently stored in the array
the length of an individual element of the array
an int representing the size the array was dimensioned
how mu

an int representing the size the array was dimensioned

given: priceDecimal = 20, taxDecimal = 0.05, stateNameString = "California", cityNameString = "Sacramento"
what is the value of adjustedPriceDecimal when the following statements are executed?
If (stateNameString = "California")
If (cityNameString = "Los

20

switch(phoneDigit)
{
case 1: num = 1;
break;
case 2: num = 2;
break;
case 3: num = 3;
break;
case 4: num = 4;
break;
default: num = 0;
break;
}
looking at the example above, what happens if the break is omitted?
num is assigned 1
num is always assigned 0

a syntax error is generated

if(examScore < 89);
grade = 'B';
using the code snippet above, when does grade get assigned a value of 'B'?
never, a syntax error is generated
when the score is less than or equal to 89
whenever the score is greater than 89
every time the program is run

every time the program is run

int [ ] score = {86, 66, 76, 92, 95, 88};
for(int i = 1; i < score.Length; i++)
{
int total = 0;
total += score[i];
}
using the declaration above for score, what is added to total during the first iteration?
88
86
76
66

66

if(aValue < largest)
result = aValue;
else
result = largest;
what happens when largest is more than aValue in the program segment above?
result is assigned largest
result is assigned aValue
nothing, neither assignment statement is executed
an error is rep

result is assigned aValue