Week 03 - C++ Operators: Relational, Logical, and Ternary

¡Supera tus tareas y exámenes ahora con Quizwiz!

What does !(a != b) mean?

Is a unequal to b? Reverse.

What is the following operator? ==

Is equal to?

What is the following operator? !=

Is not equal to?

In C++, what is the syntax for a ternary operator?

The syntax for a ternary operator is: variable = (condition)? [if condition is true, assign this value to the variable] : [if the condition is not true, assign this value to the variable]

What values do operators return?

True, false, or any number

What are the relational operators?

< , > , <=, >= , != , ==

What is the symbol for the "is equal to?" operator?

==

What is the symbol for the "not equal to" operator?

!=

Between the && operator and the || operator, which one has precedence?

&&

What are the logical operators?

&& , || , !

What number is the value "false" tied to?

0

What is a compound statement?

A statement with more than one line

What is a simple statement?

A statement with one line

What is a unary operator?

An operator that has one operand

What is a ternary operator?

An operator that has three operands

What is a binary operator?

An operator that has two operands

What number is the value "true" tied to?

Any number beside 0

Does a simple or a compound statement require curly brackets?

Compound

What values should never be used in an if-statement?

Constants or constant literals

What is the following operator? >

Greater than

What is the following operator? >=

Greater than or equal to

What is the following operator? <

Less than

What is the following operator? <=

Less than or equal to

What type of operators are the following? && , || , !

Logical

What type of operators are the following? < , > , <=, >= , != , ==

Relational

Why should constants and constant literals never be used in if-statements?

The if-statement will always be true or always be false.

Why is it dangerous to use the following setup? F && (T || F)

The program will not reach the second logical operator if the first operand is false.

What are operands?

The values or variables that an operator is dealing with.

When using the == operator, where should you position the variable? Where should you position the value being assigned to the variable?

When using the == operator, you should position the variable after the == operator. You should position the value being assigned to the variable before the == operator.


Conjuntos de estudio relacionados

AP English Language + Composition - MCQ

View Set

Chapter 21: Carbohydrate Metabolism Quiz

View Set

AP CSP Unit 3: Decisions and Algorithms

View Set

Business Law chapter 18 Application Test

View Set

Psychology Exam 4 - Chapters 11,12,14 (Multiple Choice Quizzes)

View Set

Azija-Podnebje,rastlinstvo,reke.

View Set

Final Exam Biomechnics KIN 3309 U of H

View Set