Ovido
Taal
  • Engels
  • Spaans
  • Frans
  • Portugees
  • Duits
  • Italiaans
  • Nederlands
  • Zweeds
Tekst
  • Hoofdletters

Gebruiker

  • Inloggen
  • Account aanmaken
  • Upgrade naar Premium
Ovido
  • Startpagina
  • Inloggen
  • Account aanmaken

c# chapter 5 part 2

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 12000?

1

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 14?

4

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 876?

2

The expression, (5 > 57 % 8), evaluates to ____?

True

if (aValue < largest )
result = aValue;

else

result = largest;


What happens when aValue is equal to largest in the program segment above?

result is assigned largest

Placing a semicolon onto the end of the conditional one-way if statement ____?

produces a null empty bodied true statement

When you place an if statement within another if statement, ____?

you create a nested if statement

The equality operator in C# is ____?

==

Which of the following is NOT one of the basic programming constructs?

event

The logical operators in C# are ____?

&& and ||

The short-circuiting logical operators ____?

enable doing as little as is needed to produce the final result

What is the rule for lining up, or matching, elses?

Else goes with the closest previous if that does not have its own else.

A company issues $5,000.00 bonuses at the end of the year to all employees who earn less than $100,000. Salary and bonus are both defined as double data types. Which of the following selection statements would assign the correct amount to bonus?

if (salary < 100000) bonus = 5000;

How can the compound conditional expression ((average > 79 && average <= 89)) be written to eliminate the logical operator - without changing the logic?

remove the && and create a nested if statement

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, b and c are equal to 200?

1

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 is equal to zero, b and c are equal to 100?

5

____ perform differently based on their operands?

overloaded operators

if (examScore > 89);
grade = 'A';


Using the code snippet above, when does grade get assigned a value of 'A'?

every time the program is run, one-way if statement

The switch statement also goes by the name ____________?

case statement

The ____________ method will convert a string value sent as an argument to its equivalent numeric value, but it doesn't throw an exception when the conversion fails?

TryParse()

These categories are referred to as the basic programming constructs are simple sequence, iteration and ____________?

selection

The ternary operator ( ? : ) provides another way to express a simple if...else selection statement?
True or False

True

A comparison to determine whether the uppercase character S is less than the uppercase character W produces false?
True or False?

False

if (examScore is less than 50)
display message "Do better on next exam"



In the statement above, the entry inside the parentheses is called the ____?

conditional expression

if (examScore is less than 50)
display message "Do better on next exam"

The result of the expression above is ____?

answer is boolean:true of false

When a single variable may need to be tested for five different values, the most readable solution would be a(n) ____?

switch statement

if (value1 > value2)
largestOne = value1;

else

if (value1 < value2)

largestOne = value2;

else

largestOne = -(value1);


Using the nested if program statements, assuming value1 is 100 and value2 is 100, what is stored in largestOne above?

-(value1)

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?

a syntax error is generated

Looking at the example above, when phoneDigit has a value of 'Q', what value is stored in num?

0

The switch statement case value can evaluate to all of the following EXCEPT ____?

double

if (examScore > 89)
grade = 'A';

Console.WriteLine("Excellent");


Using the code snippet above, when does Excellent get displayed?

every time the program is run

You cannot use the ____________ statement to test for a range of values?

switch or case

The equality operator in C# is represented by ____________?

==

By properly ____________ the else clauses with their corresponding if clauses, you encounter fewer logic errors that necessitate debugging?

lining up

With a two-way if statement, either the true statement(s) is (are) executed or the false statement(s), or both?
True or False?

False?

Quiz
c# chapter 5 part 1
c# chapter 6 part 2
c# chapter 6 part 1
java chapter 14 part 3
java chapter 14 part 2
angie
java chapter 14 part 1
java chapter 13 part 2
java chapter 13 part 1
java chapter 12 part 2
java chapter 12 part 1
java 2 chapter 11 part 2
java 2 chapter 11 part 1
21st Reviewer
ANAT actions + trajet
UE4
UE4
UE4
Tyska glosor
Elektromagnatism begrepp
prov kapitel 1!
Avicultura
pompeo e crasso
interrogativos
concetti fondamentali del codice civile
Diritto privato
christmas memory verse.
PSP, Les Anxiolytiques
surfer girl
Kemins grunder
PR2 REVIEWER
ue3
Clara
Duits Schritt 50
UCSP REVIEWER
Ausiàs March
russo 1
Verbi
statistica
german 32
IWBRS
GW
Lengua temas 3 y 13
respiratory system
Ordi Pedia
Guess That Quote!
IPHP REVIEWER
salud 2 periosod2
so
brunelleschi