Year 11 Exam  >  Year 11 Notes  >  Computer for GCSE/IGCSE  >  Arithmetic, Logical & Boolean Operators

Arithmetic, Logical & Boolean Operators | Computer for GCSE/IGCSE - Year 11 PDF Download

Arithmetic Operators

  • Addition ( + ): Combines two values to give a sum. For example, 3 + 5 equals 8.
  • Subtraction ( - ): Finds the difference between two values. If you have 7 - 4, the result is 3.
  • Division ( / ): Divides one value by another. When you divide 10 by 2, the result is 5.
  • Multiplication ( * ): Multiplies two values together. For instance, 4 * 6 equals 24.
  • Exponentiation ( ^ ): Raises a number to a certain power. If you have 2^3, it means 2 raised to the power of 3, which equals 8.
  • Modulo ( MOD ): Returns the remainder after division. When you divide 10 by 3, the remainder is 1.
  • Integer Division ( DIV ): Provides the whole number part of a division. For example, 11 DIV 3 equals 3.

Pseudocode example:

a ← 5
b ← 3
c ← a + b
d ← a - b
e ← a * b
f ← a / b
g ← a MOD b
h ← a ^ b
i ← a DIV b

Python example:

a = 5
b = 3
c = a + b
d = a - b
e = a * b
f = a / b
g = a % b
h = a ** b
i = a // b

Java example:

int a = 5;
int b = 3;
int c = a + b;
int d = a - b;
int e = a * b;
double f = (double) a / b;
int g = a % b;
double h = Math.pow(a, b);
int i = a / b;

Visual Basic example:

Dim a As Integer = 5
Dim b As Integer = 3
Dim c As Integer = a + b
Dim d As Integer = a - b
Dim e As Integer = a * b
Dim f As Double = a / b
Dim g As Integer = a Mod b
Dim h As Double = Math.Pow(a, b)
Dim i As Integer = a \ b

Logical Operators

  • Equal to (=): Evaluates to true if two values are equal.
  • Less than (<): Yields true if the first value is less than the second value.
  • Less than or equal to (<=): Results in true if the first value is less than or equal to the second value.
  • Greater than (>): Indicates true if the first value is greater than the second value.
  • Greater than or equal to (>=): Indicates true if the first value is greater than or equal to the second value.
  • Not equal to (<>): Returns true if the two values are not equal.

Pseudocode example:

a ← 5
b ← 3
c ← (a = b)
d ← (a < b)
e ← (a <= b)
f ← (a > b)
g ← (a >= b)
h ← (a <> b)

Python example:

a = 5
b = 3
c = (a == b)
d = (a < b)
e = (a <= b)
f = (a > b)
g = (a >= b)
h = (a != b)

Java example:

int a = 5;
int b = 3;
boolean c = (a == b);
boolean d = (a < b);
boolean e = (a <= b);
boolean f = (a > b);
boolean g = (a >= b);
boolean h = (a != b);

Visual Basic example:

Dim a As Integer = 5
Dim b As Integer = 3
Dim c As Boolean = (a = b)
Dim d As Boolean = (a < b)
Dim e As Boolean = (a <= b)
Dim f As Boolean = (a > b)
Dim g As Boolean = (a >= b)
Dim h As Boolean = (a <> b)

Boolean Operators

Boolean operators are logical operators employed to compare two or more values, yielding a Boolean outcome (True or False) contingent on the comparison. Here are the three essential operators:

  • AND: Yields True only if both conditions are True.
  • OR: Generates True if at least one condition is True, or if both conditions are True.
  • NOT: Produces the inverse of the condition, resulting in True if the condition is False, and False if the condition is True.

Boolean Operators in Pseudocode:

IF (condition1 AND condition2) THEN
// code to execute if both conditions are True
END IF
IF (condition1 OR condition2) THEN
// code to execute if one or both conditions are True
END IF
IF NOT(condition) THEN
// code to execute if the condition is False
END IF

Boolean Operators in Python:

if condition1 and condition2:
# code to execute if both conditions are True
if condition1 or condition2:
# code to execute if one or both conditions are True
if not condition:
# code to execute if the condition is False

Boolean Operators in Java:

if (condition1 && condition2) {
// code to execute if both conditions are True
}
if (condition1 || condition2) {
// code to execute if one or both conditions are True
}
if (!condition) {
// code to execute if the condition is False
}

Boolean Operators in Visual Basic:

If condition1 And condition2 Then
' code to execute if both conditions are True
End If
If condition1 Or condition2 Then
' code to execute if one or both conditions are True
End If
If Not condition Then
' code to execute if the condition is False
End If

The document Arithmetic, Logical & Boolean Operators | Computer for GCSE/IGCSE - Year 11 is a part of the Year 11 Course Computer for GCSE/IGCSE.
All you need of Year 11 at this link: Year 11
92 docs|30 tests

Top Courses for Year 11

FAQs on Arithmetic, Logical & Boolean Operators - Computer for GCSE/IGCSE - Year 11

1. What are arithmetic operators in programming?
Ans. Arithmetic operators in programming are used to perform mathematical calculations such as addition, subtraction, multiplication, and division on numerical values.
2. How do logical operators work in programming?
Ans. Logical operators in programming are used to combine multiple conditions to determine the truth value of an overall expression. Common logical operators include AND, OR, and NOT.
3. What are variable declarations in Visual Basic programming?
Ans. Variable declarations in Visual Basic involve specifying the data type and name of a variable before using it in the program. This informs the compiler about the type of data the variable will hold.
4. What is the significance of conditional statements in Visual Basic programming?
Ans. Conditional statements in Visual Basic allow programmers to control the flow of their program based on certain conditions. This helps in making decisions and executing specific blocks of code accordingly.
5. How are boolean operators used in Visual Basic conditions?
Ans. Boolean operators in Visual Basic conditions are used to compare values and determine the truth or falsehood of a statement. Common boolean operators include = (equal to), <> (not equal to), < (less than), > (greater than), etc.
92 docs|30 tests
Download as PDF
Explore Courses for Year 11 exam

Top Courses for Year 11

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

practice quizzes

,

study material

,

Arithmetic

,

pdf

,

video lectures

,

ppt

,

Sample Paper

,

Free

,

past year papers

,

Logical & Boolean Operators | Computer for GCSE/IGCSE - Year 11

,

Viva Questions

,

Important questions

,

Summary

,

Previous Year Questions with Solutions

,

Logical & Boolean Operators | Computer for GCSE/IGCSE - Year 11

,

Objective type Questions

,

Extra Questions

,

Arithmetic

,

Logical & Boolean Operators | Computer for GCSE/IGCSE - Year 11

,

MCQs

,

mock tests for examination

,

Semester Notes

,

shortcuts and tricks

,

Arithmetic

,

Exam

;