SlideShare a Scribd company logo
3. Avoid using confusing letters or numbers such as zero and the letter O Examples: One_0, Ph0ne_Num 4. Use underscore (_) in replacement of a space Examples: Class_Num, Birth_date 5. Lessen the number of character of your variable. The shorter the better. Examples: Int_Flight, Loc_Flight.Lbl1 6. In most cases, upper and lowercases are read differently. A and a may hold different data Example: B,b
 
LEARNING OBJECTIVES After the report the students should be able to: Define what constants are Explain the meaning and use of operators Learn and evaluate arithmetic operators properly Learn and use relational opeartors Define and use logical operators
 
CONSTANTS Constants are values that do not change during the execution of the program. Example: Pi=3.1416 X=100
 
OPERATORS An  operator  is a symbol or a character indicating an operation that acts on one or more elements. These elements are refered to as  operands
OPERANDS An operand is the object of a mathematical operation or a computer instruction. The number of operands depends on the programming language you use. For Example: Pascal Programming Language contains constants, data, variables, and other arithmetic expressions .
CLASSIFICATION of OPERATORS Arithmetic Operators Logical Operators Relational Operators Assignment Operators
Arithmetic Operators They are operators that perform mathematical operations or calculations It can involve two or more numeric arguments (operands) These operators are similar to what the 4 fundamental operations
FUNCTION OPERATOR Addition + (plus sign) Subtraction - (minus sign) Multiplication * (asterisk) Division / (slash) Modular Division/ Modulus mod Integer Division div Exponentiation ^ (caret sign) Negation - (minus sign)
+ and - + operators are just the same as addition in real life as well as subtraction Example: 25 + 25 = 50 69 + 1 = 70 50 +70 = 120 - operators are just the same with the real life subtraction Example: 75-5 = 70 100-50=50 70-50= 20
* and / Just like the addition and subtraction operational principle; multiplication is just the same Example: 3*9 = 27 9*9 = 81 Just like the addition and subtraction operational principle division is just the same Example: 25/5 = 5 81/9 = 9
Div It computes ONLY the integral part of the result of dividing its first operand to its second operand An integral part is defined as an integer or whole number such as 1, 10, or 5 2 7 2 3.5 1 7 div 2
Mod Modulus returns the integer remainder of a division. Examples: 7 mod 2 Result:1 6 mod 2 Result:0 2 7 2 3 1 7 div 2 7 mod 2
^ and -  Exponentiation is self explanatory. It only means that a number can be expressed with an exponents Example: 4^5 6^23  Negation makes a number in its negative form Example: - (5) = -5 - (43) = -43
HEIRARCHY of ARITHMETIC OPERATIONS It is also called OPERATOR PRECEDENCE. It refers to the priority of the various operators when more than one is used in an expression. Parenthesis are used as the need arises.
EXPRESSION Expression in programming, is a combination of symbols, identifiers, values and operators that yield a result upon evaluation
NEMDASMo Method 1 st : Negation 2 nd : Exponentiation 3 rd :Multiplication and Division 4 th : Addition and Subtraction 5 th : Modulus
Example: 5+(4*2/2)-3=6 5+(8/2)-3 (5+4)-3 9-3 6
LESSON TERMS Operator Arithmetic Operator Operand Div Mod Integer Expression
Write your answers in a one whole sheet of paper. Copy the given values and variables.
VALUES and VARIABLES A = 2 B = 22 C = 3 D = 23 E = 5 F = 10 G = 20 H = 30
H/C/(E-A) F*H-G*E D+A+C*E-G/F A+B*3 (H+G)/E H+G/E
PLEASE EXCHANGE NOTEBOOKS to YOUR CHEATMATES 30 200 38 68 34 10
Assignment Operators Is used to assign values to variables. You can assign any type of data to a variable, real, integer, char and boolean. The sign for assignment operator is :=
Assignment Statements It always consist of a variable on the left hand side of an assignment operator, and an expression on a right side The expression can be a variable, a number, or any complicated expression made up of variables, numbers and arithmetic operators It instructs the computer to evaluate the expression and assign value of its result to the variable Form: Variable := Expression
Illustrative Example PROD := N1 * N2 VARIABLE EXPRESSION ASSIGNMENT OPERATOR
This statement would assign the product of the expression N1*N2 to the variable PROD. Since the value of a variable can be changed during the program execution, the value of the variable PROD could also change depending on the value stored in any of the two variables N1 and N2
Example NUM1 := 15; FirstLetter := ‘A’; X := 6; Y := X; Z = Y + NUM1
The number 6 there is assigned to the variable X, then in the fourth statement, the variable X is assigned to the variable Y
A variable on the right-hand side of an assignment statement must first be given a value before it can be used in an assignment statement. A variable without an assigned value is called an  uninitialized variable
Relational Operators Operators that are used to compare two values basing on certain conditions. yield a true or false result Form:  value  | relational operator | value The operands of a relational operator must be of the same data type, or one maybe type real and the other type integer
FUNCTION OPERATOR Greater than > Less than < Equal to = Not equal to <> Greater than or Equal to >= Less than or Equal to <=
EXAMPLE RESULT 8>5 True  8<5 False What happened in here was a  type mismatch 8=8 True 8<>5 True 8>=10 False What happened here was a  type mismatch 8<=9 True
Relational operators ALWAYS result to Boolean Values (true or false). There are only two possible values for relational operators and this can only be either the value TRUE, and value FALSE
LESSON TERMS Assignment Operator Assignment Statement Relational Operators Boolean Values
In your notebook
 
Write the correct statement for the following values to the given variables Assign the value 250 to DailyRate Assign the product of 100 and 200 to the variable Product Assign the value of X to MyValue Assign the total of the product of X and Y and W and Z to Total Assign the value of Total (No.4) to the values of ExtremeTotality
Determine the Boolean Value If A = 100 If B = 200 If C = 300 If D = 400 If E = 500 (B*C) > (C*B) ((A*C)+D) = ((A*D)+C) E < 500 A + D <= E (A + B + C + D + E) >= 15000
PLEASE EXCHANGE NOTEBOOKS to YOUR CHEATMATES DailyRate := 250 100*200 := Product MyValue := X X*Y*W*Z := Total X*Y*W*Z := Total := ExtremeTotality  or  Total := ExtremeTotality
PLEASE EXCHANGE NOTEBOOKS to YOUR CHEATMATES (60,000) > (60, 000)  FALSE 30,400 = 40,300   FALSE 500 < 500  FALSE 500 <= 500    TRUE 1500 >= 15000   FALSE
Logical Operators They are also called as Boolean Operators Boolean operators are operators that evaluate expressions and determine whether the conditions specified by the expressions are either true or false Requires boolean operators
KINDS OF BOOLEAN OPERATOR The AND Operator The OR Operator The NOT Operator
The AND Operator The and operator  evaluates to  true , only if both its operands (or expressions) are true.
(X  > 75) and (Y  >  75)
If both expressions (X > 75) and (Y >75) include in the statement evaluate to true  (if both X and Y values are greater than 75), then the above statement will evaluate to  true , otherwise, the statement will evaluate to  false .
AND Operator Operand / Expression 1 Operand/ Expression 2 Decision True True True True False False False True False False False False
ILLUSTRATIVE EXAMPLE TRUE - TRUE TRUE - FALSE (34 <> 23) (12 <> 23) True (97  > 32) (24 <> 24) False
ILLUSTRATIVE EXAMPLE FALSE - TRUE FALSE -  FALSE (12 <> 23) (14 <= 23) False (12 <> 23) (23 < 23) False
The OR Operator The OR Operator determines whether one or both of its operands (or expressions) are true  or  false .
(X = 1) or (X = 3)
If one of the expressions in the statement is true, the statement evaluates to  true . This means that if X is equal to either 1 or 3, then the statement is true. For example if, X=4 then the statement above returns the value  false
OR Operator Operand / Expression 1 Operand/ Expression 2 Decision True True True True False True False True True False False False
ILLUSTRATIVE EXAMPLE TRUE - TRUE TRUE - FALSE (4=4) (5=5) True (E=5) (5 <>5) True
ILLUSTRATIVE EXAMPLE FALSE- TRUE FALSE-FALSE (45>56) (12 <> 23) True (9  >= 32) (24 <> 24) False
The NOT Operator The NOT Operator has a single operand which it evaluates  to either true or false. It returns the opposite of the value returned by the variable
If passed is true, then not passed is false If passed is false, then not passed is true
NOT Operator Operand / Expression 1 Operand / Expression 2 Operand / Expression 1 Decision Operand / Expression 2 Decision True True False False True False False True False  True True False False False True True
OPERATOR PRECEDENCE OPERATOR PRECEDENCE Not *, /, div, mod, and + , -, or <, <=, =, <>, >=, > Highest (evaluated first) Lowest (evaluated last)
LESSON TERMS Boolean Operator And Or Not Operator Precedence
In your notebook
Determine the Boolean values returned by the following operators with the given values X: 100 Y: 50 A: 200 B: 75 Condition: true Flag: false (X>105) or (B>50) (X=75) and (X>75) (A<>B) or (X = Y) (not condition) and (not flag) Not flag ((X*2)=200) and (X=100) (X<75) or (Y<75) ((A+B)>250) or ((X+Y)>150) (not condition) (B<50) and (A=200)
Answers: True False True False True True True True False False
GET THE TOTAL NUMBER of SCORE Number Topic Items 1 Arithmetic Operators 5 2 A Assignment Operators 5 2 B Relational Operators 5 3 Boolean/ Logical Operators 10 25
By Group 4

More Related Content

PPT
Project in TLE
PPT
Expressions in c++
PPTX
Operators and Expressions
PDF
Chap 5 c++
PDF
Chap 4 c++
PPTX
Variables, Data Types, Operator & Expression in c in detail
PPTX
Operator.ppt
PPTX
Expression and Operartor In C Programming
Project in TLE
Expressions in c++
Operators and Expressions
Chap 5 c++
Chap 4 c++
Variables, Data Types, Operator & Expression in c in detail
Operator.ppt
Expression and Operartor In C Programming

What's hot (18)

PPTX
Operators and expressions in C++
DOCX
C – operators and expressions
PDF
Lecture03(c expressions & operators)
PPT
Operator & Expression in c++
PDF
Programming for Problem Solving
PPTX
Dti2143 chapter 3 arithmatic relation-logicalexpression
DOCX
Programming Fundamentals lecture 7
PPTX
Basic c operators
PPT
C operator and expression
PPT
PPT
6 operators-in-c
PPT
Types of operators in C
PDF
ICP - Lecture 7 and 8
PDF
[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence
PDF
Python : basic operators
PPT
C Prog. - Operators and Expressions
PPTX
c++ programming Unit 4 operators
DOC
C programming operators
Operators and expressions in C++
C – operators and expressions
Lecture03(c expressions & operators)
Operator & Expression in c++
Programming for Problem Solving
Dti2143 chapter 3 arithmatic relation-logicalexpression
Programming Fundamentals lecture 7
Basic c operators
C operator and expression
6 operators-in-c
Types of operators in C
ICP - Lecture 7 and 8
[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence
Python : basic operators
C Prog. - Operators and Expressions
c++ programming Unit 4 operators
C programming operators
Ad

Viewers also liked (20)

PPT
Classroom Management 1&2
DOCX
Leadership project
PPTX
Evaluation 3
PDF
Islamhudaa video2
PPT
UK rules
PPT
Lastinger Inquiry Project Sarah J
PDF
Islamhudaa fatwa2
PPTX
Reservation - Hesti Romadhoni SMK N 2 WONOGIRI :)
PPTX
Ch. 2 1_thru_2_3_review_questions
PPT
My Lists - Encore Catalog
PDF
Parents as partners mohua bose and shilpa solanki
PPT
Pluar nouns
PPTX
The Marketing Plan Game - Wide Screen
PPTX
1 4angles
PPT
2010 06 20 7 may alam ako sa bible!
PPT
Factories
PPTX
Learning material
KEY
DOC
Conversational english2
PPT
Jeopady vocab_matter unit
Classroom Management 1&2
Leadership project
Evaluation 3
Islamhudaa video2
UK rules
Lastinger Inquiry Project Sarah J
Islamhudaa fatwa2
Reservation - Hesti Romadhoni SMK N 2 WONOGIRI :)
Ch. 2 1_thru_2_3_review_questions
My Lists - Encore Catalog
Parents as partners mohua bose and shilpa solanki
Pluar nouns
The Marketing Plan Game - Wide Screen
1 4angles
2010 06 20 7 may alam ako sa bible!
Factories
Learning material
Conversational english2
Jeopady vocab_matter unit
Ad

Similar to Report Group 4 Constants and Variables (20)

PPT
Reportgroup4 111016004939-phpapp01
PPT
FP 201 Unit 2 - Part 3
PPT
Cprogrammingoperator
PPT
cprogrammingoperator.ppt
PPT
class noteson operetors in c programming .ppt
PPTX
operatorsincprogramming-190221094522.pptx
PPTX
C PRESENTATION.pptx
PDF
Operators in c programming
PPT
C Sharp Jn (2)
PPT
C Sharp Jn (2)
PPT
Operators
PDF
Types of Operators in C programming .pdf
PPTX
This slide contains information about Operators in C.pptx
PPT
Operators and Expressions in C++
PPT
Fundamentals of Programming Chapter 5
PDF
C++ Expressions Notes
PPTX
DOCX
PPS 2.2.OPERATORS ARITHMETIC EXPRESSIONS/ARITHMETIC OPERATORS/RELATIONAL OPER...
PPTX
operators.pptx
PPT
operators and expressions in c++
Reportgroup4 111016004939-phpapp01
FP 201 Unit 2 - Part 3
Cprogrammingoperator
cprogrammingoperator.ppt
class noteson operetors in c programming .ppt
operatorsincprogramming-190221094522.pptx
C PRESENTATION.pptx
Operators in c programming
C Sharp Jn (2)
C Sharp Jn (2)
Operators
Types of Operators in C programming .pdf
This slide contains information about Operators in C.pptx
Operators and Expressions in C++
Fundamentals of Programming Chapter 5
C++ Expressions Notes
PPS 2.2.OPERATORS ARITHMETIC EXPRESSIONS/ARITHMETIC OPERATORS/RELATIONAL OPER...
operators.pptx
operators and expressions in c++

Recently uploaded (20)

PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
GDM (1) (1).pptx small presentation for students
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
Pharma ospi slides which help in ospi learning
PDF
Computing-Curriculum for Schools in Ghana
PDF
Classroom Observation Tools for Teachers
PDF
RMMM.pdf make it easy to upload and study
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
Cell Structure & Organelles in detailed.
PPTX
master seminar digital applications in india
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
O7-L3 Supply Chain Operations - ICLT Program
GDM (1) (1).pptx small presentation for students
FourierSeries-QuestionsWithAnswers(Part-A).pdf
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Pharma ospi slides which help in ospi learning
Computing-Curriculum for Schools in Ghana
Classroom Observation Tools for Teachers
RMMM.pdf make it easy to upload and study
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPH.pptx obstetrics and gynecology in nursing
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Cell Structure & Organelles in detailed.
master seminar digital applications in india
Module 4: Burden of Disease Tutorial Slides S2 2025
Microbial disease of the cardiovascular and lymphatic systems
Supply Chain Operations Speaking Notes -ICLT Program
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx

Report Group 4 Constants and Variables

  • 1. 3. Avoid using confusing letters or numbers such as zero and the letter O Examples: One_0, Ph0ne_Num 4. Use underscore (_) in replacement of a space Examples: Class_Num, Birth_date 5. Lessen the number of character of your variable. The shorter the better. Examples: Int_Flight, Loc_Flight.Lbl1 6. In most cases, upper and lowercases are read differently. A and a may hold different data Example: B,b
  • 2.  
  • 3. LEARNING OBJECTIVES After the report the students should be able to: Define what constants are Explain the meaning and use of operators Learn and evaluate arithmetic operators properly Learn and use relational opeartors Define and use logical operators
  • 4.  
  • 5. CONSTANTS Constants are values that do not change during the execution of the program. Example: Pi=3.1416 X=100
  • 6.  
  • 7. OPERATORS An operator is a symbol or a character indicating an operation that acts on one or more elements. These elements are refered to as operands
  • 8. OPERANDS An operand is the object of a mathematical operation or a computer instruction. The number of operands depends on the programming language you use. For Example: Pascal Programming Language contains constants, data, variables, and other arithmetic expressions .
  • 9. CLASSIFICATION of OPERATORS Arithmetic Operators Logical Operators Relational Operators Assignment Operators
  • 10. Arithmetic Operators They are operators that perform mathematical operations or calculations It can involve two or more numeric arguments (operands) These operators are similar to what the 4 fundamental operations
  • 11. FUNCTION OPERATOR Addition + (plus sign) Subtraction - (minus sign) Multiplication * (asterisk) Division / (slash) Modular Division/ Modulus mod Integer Division div Exponentiation ^ (caret sign) Negation - (minus sign)
  • 12. + and - + operators are just the same as addition in real life as well as subtraction Example: 25 + 25 = 50 69 + 1 = 70 50 +70 = 120 - operators are just the same with the real life subtraction Example: 75-5 = 70 100-50=50 70-50= 20
  • 13. * and / Just like the addition and subtraction operational principle; multiplication is just the same Example: 3*9 = 27 9*9 = 81 Just like the addition and subtraction operational principle division is just the same Example: 25/5 = 5 81/9 = 9
  • 14. Div It computes ONLY the integral part of the result of dividing its first operand to its second operand An integral part is defined as an integer or whole number such as 1, 10, or 5 2 7 2 3.5 1 7 div 2
  • 15. Mod Modulus returns the integer remainder of a division. Examples: 7 mod 2 Result:1 6 mod 2 Result:0 2 7 2 3 1 7 div 2 7 mod 2
  • 16. ^ and - Exponentiation is self explanatory. It only means that a number can be expressed with an exponents Example: 4^5 6^23 Negation makes a number in its negative form Example: - (5) = -5 - (43) = -43
  • 17. HEIRARCHY of ARITHMETIC OPERATIONS It is also called OPERATOR PRECEDENCE. It refers to the priority of the various operators when more than one is used in an expression. Parenthesis are used as the need arises.
  • 18. EXPRESSION Expression in programming, is a combination of symbols, identifiers, values and operators that yield a result upon evaluation
  • 19. NEMDASMo Method 1 st : Negation 2 nd : Exponentiation 3 rd :Multiplication and Division 4 th : Addition and Subtraction 5 th : Modulus
  • 21. LESSON TERMS Operator Arithmetic Operator Operand Div Mod Integer Expression
  • 22. Write your answers in a one whole sheet of paper. Copy the given values and variables.
  • 23. VALUES and VARIABLES A = 2 B = 22 C = 3 D = 23 E = 5 F = 10 G = 20 H = 30
  • 24. H/C/(E-A) F*H-G*E D+A+C*E-G/F A+B*3 (H+G)/E H+G/E
  • 25. PLEASE EXCHANGE NOTEBOOKS to YOUR CHEATMATES 30 200 38 68 34 10
  • 26. Assignment Operators Is used to assign values to variables. You can assign any type of data to a variable, real, integer, char and boolean. The sign for assignment operator is :=
  • 27. Assignment Statements It always consist of a variable on the left hand side of an assignment operator, and an expression on a right side The expression can be a variable, a number, or any complicated expression made up of variables, numbers and arithmetic operators It instructs the computer to evaluate the expression and assign value of its result to the variable Form: Variable := Expression
  • 28. Illustrative Example PROD := N1 * N2 VARIABLE EXPRESSION ASSIGNMENT OPERATOR
  • 29. This statement would assign the product of the expression N1*N2 to the variable PROD. Since the value of a variable can be changed during the program execution, the value of the variable PROD could also change depending on the value stored in any of the two variables N1 and N2
  • 30. Example NUM1 := 15; FirstLetter := ‘A’; X := 6; Y := X; Z = Y + NUM1
  • 31. The number 6 there is assigned to the variable X, then in the fourth statement, the variable X is assigned to the variable Y
  • 32. A variable on the right-hand side of an assignment statement must first be given a value before it can be used in an assignment statement. A variable without an assigned value is called an uninitialized variable
  • 33. Relational Operators Operators that are used to compare two values basing on certain conditions. yield a true or false result Form: value | relational operator | value The operands of a relational operator must be of the same data type, or one maybe type real and the other type integer
  • 34. FUNCTION OPERATOR Greater than > Less than < Equal to = Not equal to <> Greater than or Equal to >= Less than or Equal to <=
  • 35. EXAMPLE RESULT 8>5 True 8<5 False What happened in here was a type mismatch 8=8 True 8<>5 True 8>=10 False What happened here was a type mismatch 8<=9 True
  • 36. Relational operators ALWAYS result to Boolean Values (true or false). There are only two possible values for relational operators and this can only be either the value TRUE, and value FALSE
  • 37. LESSON TERMS Assignment Operator Assignment Statement Relational Operators Boolean Values
  • 39.  
  • 40. Write the correct statement for the following values to the given variables Assign the value 250 to DailyRate Assign the product of 100 and 200 to the variable Product Assign the value of X to MyValue Assign the total of the product of X and Y and W and Z to Total Assign the value of Total (No.4) to the values of ExtremeTotality
  • 41. Determine the Boolean Value If A = 100 If B = 200 If C = 300 If D = 400 If E = 500 (B*C) > (C*B) ((A*C)+D) = ((A*D)+C) E < 500 A + D <= E (A + B + C + D + E) >= 15000
  • 42. PLEASE EXCHANGE NOTEBOOKS to YOUR CHEATMATES DailyRate := 250 100*200 := Product MyValue := X X*Y*W*Z := Total X*Y*W*Z := Total := ExtremeTotality or Total := ExtremeTotality
  • 43. PLEASE EXCHANGE NOTEBOOKS to YOUR CHEATMATES (60,000) > (60, 000) FALSE 30,400 = 40,300 FALSE 500 < 500 FALSE 500 <= 500 TRUE 1500 >= 15000 FALSE
  • 44. Logical Operators They are also called as Boolean Operators Boolean operators are operators that evaluate expressions and determine whether the conditions specified by the expressions are either true or false Requires boolean operators
  • 45. KINDS OF BOOLEAN OPERATOR The AND Operator The OR Operator The NOT Operator
  • 46. The AND Operator The and operator evaluates to true , only if both its operands (or expressions) are true.
  • 47. (X > 75) and (Y > 75)
  • 48. If both expressions (X > 75) and (Y >75) include in the statement evaluate to true (if both X and Y values are greater than 75), then the above statement will evaluate to true , otherwise, the statement will evaluate to false .
  • 49. AND Operator Operand / Expression 1 Operand/ Expression 2 Decision True True True True False False False True False False False False
  • 50. ILLUSTRATIVE EXAMPLE TRUE - TRUE TRUE - FALSE (34 <> 23) (12 <> 23) True (97 > 32) (24 <> 24) False
  • 51. ILLUSTRATIVE EXAMPLE FALSE - TRUE FALSE - FALSE (12 <> 23) (14 <= 23) False (12 <> 23) (23 < 23) False
  • 52. The OR Operator The OR Operator determines whether one or both of its operands (or expressions) are true or false .
  • 53. (X = 1) or (X = 3)
  • 54. If one of the expressions in the statement is true, the statement evaluates to true . This means that if X is equal to either 1 or 3, then the statement is true. For example if, X=4 then the statement above returns the value false
  • 55. OR Operator Operand / Expression 1 Operand/ Expression 2 Decision True True True True False True False True True False False False
  • 56. ILLUSTRATIVE EXAMPLE TRUE - TRUE TRUE - FALSE (4=4) (5=5) True (E=5) (5 <>5) True
  • 57. ILLUSTRATIVE EXAMPLE FALSE- TRUE FALSE-FALSE (45>56) (12 <> 23) True (9 >= 32) (24 <> 24) False
  • 58. The NOT Operator The NOT Operator has a single operand which it evaluates to either true or false. It returns the opposite of the value returned by the variable
  • 59. If passed is true, then not passed is false If passed is false, then not passed is true
  • 60. NOT Operator Operand / Expression 1 Operand / Expression 2 Operand / Expression 1 Decision Operand / Expression 2 Decision True True False False True False False True False True True False False False True True
  • 61. OPERATOR PRECEDENCE OPERATOR PRECEDENCE Not *, /, div, mod, and + , -, or <, <=, =, <>, >=, > Highest (evaluated first) Lowest (evaluated last)
  • 62. LESSON TERMS Boolean Operator And Or Not Operator Precedence
  • 64. Determine the Boolean values returned by the following operators with the given values X: 100 Y: 50 A: 200 B: 75 Condition: true Flag: false (X>105) or (B>50) (X=75) and (X>75) (A<>B) or (X = Y) (not condition) and (not flag) Not flag ((X*2)=200) and (X=100) (X<75) or (Y<75) ((A+B)>250) or ((X+Y)>150) (not condition) (B<50) and (A=200)
  • 65. Answers: True False True False True True True True False False
  • 66. GET THE TOTAL NUMBER of SCORE Number Topic Items 1 Arithmetic Operators 5 2 A Assignment Operators 5 2 B Relational Operators 5 3 Boolean/ Logical Operators 10 25