Starting out with Visual C# - Chapter 4

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

A(n)_________ Expression has a value of either true or false.

Boolean Expression

how can you read the selected item from a ListBox while preventing an exception from occurring if no item is selected.

By checking the SelectedIndex to see if the value is set to -1 before reading.

How do you get the item that is selected in a ListBox?

By taking its string value from the SelectedItem property.

How do you determine in code whether a RadioButton control or a checkBox Control is selected

CheckSelected property

case statement

Contains cases to test against the testExpression

bool data type

Creates variables which hold true or false values

A__________________ Structure executes a set of statements only under certain conditions

Decision Structure (Selection Structure)

TryParse

Determines whether a string contains a value that can be converted to a specific data type before its actually converted. prevents exceptions from being thrown

You need to test a condition and then execute one set of statements if the condition is true. If the condition is false, you need to execute a different set of statements. What structure will you use

Dual-alternative decision structure

A __________ is a Boolean variable that signals when some condition exists in the program

flag

Dual-alternative decision structure

has two possible paths of execution one for a true Boolean expression and one for a false Boolean expression.

You use a(n) ____________ Statement to write a single-alternative decision structure

if

The _______ operator takes a Boolean expression as its operand and it reverses its logical value.

!

When determining whether a number is inside a range, which logical operator is it best to use?

&&

a compound Boolean expression created with the _______ operator is only true if both sub-expressions are true

&&

a ListBox's index numbering starts at

0

What is meant by the term "Conditionally Executed"

A code is only executed if the right conditions are met

What is a flag and how does it work.

A flag is a Boolean value which tags a piece of code for the programmer to see.

Sequence Structure

A set of statements that execute in the order that they appear.

if-else Statement

A statement which will execute one block of statements if its Boolean expression is true, or another block if its Boolean expression is false

What is a decision structure?

A type of control structure based on If - Then statements

testExpression

A variable or an expression that gives an integer, string or bool value (Cannot be a decimal)

Flag

A variable that signals when some condition exists in the program

What is a Flag Variable

A variable which signals when a condition exists in the program.

Boolean expression

An expression that can be evaluated as either true or false

T/F: a single-alternative decision structure tests a condition and then takes one path if the condition is true and one path if the condition is false

False, A dual-decision structure does this

The text expression i a switch statement can be a double or decimal value

False, it can be anything but those two things

The tryParse method throw an exception if the string argument cannot be converted

False, it tries all conversion methods, one will always work.

if an item is not selected in a ListBox, the control's selectIndex property will be set to 0

False, it will be set to -1

to store items in a ListBox, you add them to the controls text property.

False, you add them to the Item property

T/F: you can write any program using only sequence structures

False, you need other code to make a program work

What types of relationships between numeric values can you test with relational operators?

Greater-than or equal to, Less than or equal to, equal to, or not equal to

Short-Circuit evaluation

If one side of the expression is true in a logical OR operators, the other side is not checked, if either side of a logical And Statement is false, the other side is not checked.

In an if-else statement, under which circumstances do the statements that appear after the else clause execute?

If the Boolean expression stated in the if clause is false.

How do you add items to a ListBox using the properties window?

In the Items property

Switch Statements

Let the value of a variable or an expression determine which path of execution of the program will take.

&&, ||, and ! are __________ operators

Logical

Control Structure

Logical design that controls the order in which a set of statements executes.

A ________ decision structure is written inside another decision structure

Nested

If several RadioButton controls have been crated in the same Group Box, how many of them may be selected at one time?

One

If several __________ controls exist in a GroupBox, only one of them may be selected at a time

RadioButton

the symbols >, <, and == are all _______________ Operators.

Relational

Logical NOT (!) operator

Reverses the truth of a Boolean expression

Decision Structure (Selection Structure)

Specific action is performed only if a certain condition exists. if the condition does not exist, the action is not performed.

Briefly describe how the && operator Works.

The && operator makes a Boolean's logical value true if both subexpressions are also true.

Multiple CheckBox controls in the same GroupBox can be selected at the same time

True

T/F: A decision structure can be nested inside of another decision structure.

True

T/F: The if-else statement is a dual-alternative decision structure

True

What special values can you store in a bool variable?

True & False values

Items Property

Where you add selectable items to a listBox control

What is a single-alternative decision structure?

a control structure which provides only one alternative decision.

What is a control structure?

a logical system of controlling the order in which statements execute

Listbox Index

a number that identifies the item's position in the list box, which is stored in the Items property

Output Variable

a variable that is passed as an argument to a method, and when the method is finished, a value is stored in the variable

Conditionally executed

action performed only when a certain condition is true

Logical AND (&&) OR (||) operators

allow you to connect multiple Boolean expressions to create a compound expression.

SelectedIndex property

allows you to see the index of selected items and if index is set to -1 prevent a no item selected error.

Multiple-alternative decision structure

allows you to test the value of a variable or an expression and then use that value to determine which statement or set of statements to execute.

What is a Boolean Expression?

an expression evaluated as either true or false

What is a compound Boolean expression?

an expression which uses more than one Boolean expressions at one time

If several CheckBox controls have been created in the same GroupBox, how many of them may be selected at one time?

as many as you want

Describe how dual-alternative decision structures work.

by providing two pathways for execution. one for a true Boolean expression, and one for a false Boolean expression

In code, how do you determine whether a RadioButton or a checkbox control has been selected

by seeing the checked property and whether it is set to true of

how do you add items to a listBox control using the properties window?

by adding them to the items property

Checked-Changed event

causes an action to immediately take place when you check a check box

ListBox Control

creates a list box on an applications form that allows users to select one or more items from the list.

Nested decision structures

decision structures which appear inside other decision structures. commonly done when a program needs to test more than one condition.

The _______________ section of a switch statement is branched to if none of the case values match the test expression

default

relational operator

determines whether a specific relationship exists between two values, comparative operator

Checked property

determines whether the control is selected or deselected

A ______________ Structure tests a condition and then takes one path if the condition is true and another path if the condition is false

dual-alternative decision

Write an if statement that determines whether the variable sales is greater than or equal to 10,000. if it is, assign 0.2 to the variable commisionRate.

if (sales >= 10000) { commissionRate = 0.2; }

Write an if-else statement that works like this: If the sales variable is greater than or equal to 50,000, the commissionRate Variable should be assigned the value 0.2. otherwise, the commissionRate variable should be assigned the value 0.1.

if (sales >= 50,000) { commissionRate = 0.2; } else { commissionRate = 0.1; }

Write an if statement that determines whether the variable y is equal to 20. If it is assign 0 to the variable X.

if (y == 20) { x = 0; }

How can you determine whether an item has been selected in a ListBox

if the selectedIndex is not equal to -1

you use a(n) ______________ statement to write a dual alternative decision structure.

if-else

Input Validation

input is inspected by the program before it is processed and if it is invalid it is discarded and the user is prompted to enter correct data.

selectItem property

property where selected items in a listBox are stored

single-alternative decision structure

provides only one alternative path of execution

you can use the __________________ property to determine whether an item is selected in a listBox

selectedIndex

The ________ property holds the item that is selected in a listBox control.

selectedItem

A __________________ Structure provides one alternative path of execution.

single-alternative decision

Check box

small box which works similar to radio buttons but they are not mutually exclusive

Out keyword

specifies that the target variable is an output variable

What are the two arguments that you pass to a TryParse Method

string and data type

You use the ___________ statement to create a multiple alternative decision structure.

switch

Briefly describe how the || operator works.

the || operator makes a boolean's logical value true if atleast one of the subexpressions are also true.

A compound Boolean expression can be created with the && operator is true only when both sub-expressions are true

true

The ________________ family of methods can be used to convert a string to a specific data type without throwing an exception

tryParse

Radio Buttons

used if you want the user to select one choice from several possible choices

Logical operators

used to create complex Boolean statements

Mutually exclusive selection

when selecting something automatically deselects any other similar objects in the same group

Default statement

where the testExpression doesn't match any of the cases

a compound Boolean expression created with the ______ operator is true if either of its sub-expressions are true

||


संबंधित स्टडी सेट्स

2.7 Structure and origin of mitochondria

View Set

Reconstruction 1865-1877 - Time4Learning Social Studies - 5th grade

View Set

ECO 2517 : Introduction au développement économique

View Set

Words ending in IVE in english ends with IF/IVE in french

View Set

ECON 2314 Graded Homework with Graphing Questions - Chapter 1

View Set