• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/15

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

15 Cards in this Set

  • Front
  • Back
  • 3rd side (hint)

What is logical expression

1 is true


0 is false


Or any bool variables


What are relational operators

==


<


<=


>


>=


!=



What causes syntax error in relational operators

Any spaces between relational operators . Eg.



(= =)


(< =)

What is one way selection

The statement executes if the if statement is true.



And executes the following statement after if.

What is the difference between equality operator and assignment operator ?

Equality operator ( ==) it is a relational operator. It determines whether two expressions are equal


Is used for comparisons and expressions.



Assignment operator (=) is used for formula or assigning values to a variable.


What is a two way selection

If else statement

What are logical operators and give example

! (not)


|| (or)


&& (and )

Int and bool can store what?

Both can store bool variables


True or false and one and zero.

Does an if else and if statement have a logical expression

Yes.

Is this true or false



A sequence of statements enclosed between curly brackets {} is called a compound statement or block of statements. It is treated as a single statement.

True

What control structure is used to handle multiway selection

Switch structure

What is the output of question c

It is A. Because that second cout is not part of the if statement.


The if statement stopped after the semicolon.



Usually the first statement after semicolon is only part of it. The rest is treated as separate statements.


So must put curly brackets to distinguish the other statements and group them together as one.

List the order of precedence for operators

Quick review of selection .

What does break do

It Exits early from loop



Skips the remainder of switch structure.



It stops performing other statements.



It stops one case.



Example:



switch (number)



case 0:


Totalzero++;


case 1:case 3:case 5:case 7:case 9:


Totalodd++;



Without the break before case1, zero will be counted as an odd number then the total odd number will include all zero numbers.



So must include break



case 0:Totalzero++;


break;case 1:case 3:case 5:case 7:case 9:Totalodd++;


break;


...