Save
SEMESTER 01
PLATFORM DEV THEORY
PD1: Chapter 4: Selections
Save
Share
Learn
Content
Leaderboard
Share
Learn
Created by
Soeroe
Visit profile
Cards (77)
What is the Boolean datatype based on?
Mathematics
View source
What does Boolean algebra describe?
The mathematics of reasoning about
true
and
false
propositions
View source
What are the two values of the Boolean datatype?
true
and
false
View source
How must Boolean values be written in C#?
In
lowercase
View source
How does the Boolean datatype in C# differ from C regarding truth values?
In C#,
numerical
values cannot be used as Boolean values
View source
What is the keyword for the Boolean datatype in C#?
bool
View source
How are Boolean values generated in C#?
By comparing two numeric or char values using
comparison operators
View source
What operator is used for equality testing in C#?
==
View source
What does the inequality operator != do in C#?
Tests if two values are
not equal
View source
Which operators are used for comparison in C#?
<
,
<=
,
>
,
>=
View source
What is the result of the expression 3 < 2.7f in C#?
false
View source
What does the expression 3 == 3.0f yield in C#?
true
View source
Can comparison operators be used to compare String values in C#?
No
View source
How can one compare String values in C#?
Using the
CompareTo
method
View source
What does CompareTo return if the executing string is equal to the argument?
0
View source
What does CompareTo return if the executing string is alphabetically less than the argument?
A value
less than zero
View source
What does CompareTo return if the executing string is alphabetically more than the argument?
A value
greater than zero
View source
Why can't CompareTo return a Boolean value?
Because there are three possible
outcomes
View source
What are the three Boolean operators in C#?
not
,
and
, or
View source
What does the not operator do in C#?
It negates a
Boolean
value
View source
How is the and operator represented in C#?
With two
ampersands
(&&)
View source
What is the behavior of the and operator (&&) in C#?
It yields true if both
operands
are true
View source
What is the behavior of the or operator (||) in C#?
It yields true if at least one
operand
is true
View source
What
is a Boolean expression?

An expression that yields a Boolean result
View source
What is an example of a Boolean expression?
Testing for equality using the ==
operator
View source
What does the ternary conditional operator do?
It takes three
operands
and returns one based on a
Boolean
condition
View source
When is the ternary conditional operator useful?
To avoid writing an
if-else statement
View source
What happens if the first operand of the ternary operator is true?
The
result
is
the
second
operand
View source
What happens if the first operand of the ternary operator is false?
The result is the
third
operand
View source
What is the significance of the order of nested if statements?
The outcome of the
program
changes if the order changes
View source
What does the switch command allow for in C#?
Faster execution compared to
nested if else
statements
View source
What is the output of the DisplayMeasurement function when measurement is less than 0.0?
"
Measured value is {measurement}
;
too low.
"
View source
What is the output of the DisplayMeasurement function when measurement is greater than 15.0?
"
Measured value is {measurement}
;
too high.
"
View source
What is the output of the DisplayMeasurement function when measurement is NaN?
"
Failed measurement
."
View source
What is the purpose of the break statement in a switch case?
To
exit
the switch statement
View source
What does the case statement do in a switch?
It defines a specific condition to match
View source
What is the syntax for a switch statement in C#?
switch
(
expression
)
{
case value: statement;
}
View source
What is the role of the Console.WriteLine method in the DisplayMeasurement function?
To
output
the measured
value
to the console
View source
What is the significance of the curly braces in an if statement?
They define a
block of code
to be executed
View source
What does the else statement do in an if-else structure?
It executes a block of code if the if condition is
false
View source
See all 77 cards