NAU ISM 220 BBLearn Exam #2 – Flashcards

Unlock all answers in this set

Unlock answers
question
The C# syntax for 'is not equal to' is ________.
answer
!=
question
if (amount > 1000) result = 1; else if (amount > 500) result = 2; else if (amount > 100) result = 3; else result = 4; What is stored in result when amount is equal to 12000?
answer
1
question
The equality operator in C# is ____.
answer
==
question
Two equal symbol characters == are used as the assignment operator.
answer
False
question
What will the console display after this code is executed? string college = "NAU"; if (college = "NAU") { Console.WriteLine("Go Jacks!"); } else { Console.WriteLine("Go Team!"); }
answer
The code will produce a syntax error
question
if (examScore > 89) grade = 'A'; Console.WriteLine("Excellent"); Using the code snippet above, when does Excellent get displayed?
answer
every time the program is run
question
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; What is stored in result when a, b and c are equal to 200?
answer
1
question
The ternary operator ( ? : ) provides another way to express a simple if...else selection statement.
answer
True
question
The , = are called the logical operators of the language.
answer
False
question
An exclamation point followed by a single equal symbol (!=) represents not equal in C#.
answer
True
question
An interpretation of the while statement is "while the condition is true, perform statement(s)".
answer
True
question
int sum = 0; int number = 1; while (number < 100) { sum = sum + number; } The program statements above produce an infinite loop.
answer
True
question
The ________ keyword exits a loop.
answer
Break
question
int loopVariable = 0; do { Console.WriteLine("Count = {0:}", ++loopVariable); }while (loopVariable < 5); What will be printed during the first iteration through the loop?
answer
1
question
for (int i = 0; i < 5; i++) Console.Write(i + "t"); Given the code snippet above, how many times will the loop body be executed?
answer
5
question
The item that is tested in a while loop is called the _______.
answer
Expression
question
With nested loops, the outermost loop is always totally completed before the innermost loop is executed.
answer
False
question
int sum = 0; int number = 0; while (number < 10) { sum = sum + number; Console.WriteLine(sum); } The statement above prints the values of 0 through 9 on separate lines.
answer
False
question
Multi-dimensional arrays are called ________ in mathematics.
answer
Matrices
question
To declare and instantiate memory for 4 exam scores that range in value from 0 to 100, the following declaration could be made ____.
answer
int [ ] examScore = new examScore[4];
question
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?
answer
foreach(int val in anotherArray) total += val;
question
If you do not know how many entries will be stored with the array, you could dimension it ____.
answer
large enough to hold the maximum number of entries
question
int [ ] anArray = new int [10]; int [ ] anotherArray = {6, 7, 4, 5, 6, 2, 3, 5, 9, 1}; 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?
answer
45
question
int [ ] score = {86, 66, 76, 92, 95, 88}; for (int i = score.Length-1; i > -1; i--) { total += score[i]; } Using the declaration above for score, what is added to total during the first iteration?
answer
88
question
You can declare an array without dimensioning its size, but the size must be determined before you can access it.
answer
True
question
double [ ] price = new double [ ] {3, 2.2, 4.7, 6.1, 4}; Looking above, the value of price.Length is 5.
answer
True
question
double [ ] price = new double [ ] {3, 2.2, 4.7, 6.1, 4}; With the declaration above, price[5] generates a runtime error.
answer
True
question
The type used in the foreach expression must match the array type.
answer
True
Get an explanation on any task
Get unstuck with the help of our AI assistant in seconds
New