Basic operators

Cards (42)

  • What are operators in programming?
    Special characters that perform functions
  • Why is it important to know how operators work in computer science?
    They perform essential functions in programming
  • What type of operators are arithmetic operators?
    Operators that perform mathematical functions
  • What do arithmetic operators take as input?
    Two values to perform a mathematical function
  • What functions do addition, subtraction, multiplication, and division operators perform?
    Basic mathematical operations on numbers
  • What does the exponentiation operator do?
    Raises a number to a power
  • What does the DIV operator return?
    The whole number part of a division
  • What does the MOD operator provide?
    The remainder of a division operation
  • How do arithmetic operators handle integer division?
    They may yield odd results in some languages
  • If you divide 55 by 22 using integer division, what result do you expect?

    22
  • What is the result of 2+2 +8 8 *2 2 using proper operator precedence?

    1818
  • What is the purpose of assignment operators?
    To assign values to constants or variables
  • What does the assignment operator '=' do?
    Assigns a value to a variable
  • How do programming languages typically follow the order of operations?
    By using BODMAS rules for calculations
  • Why is it important to use parentheses in expressions?
    To ensure correct order of operations
  • What will be the result of (2+8)(2 + 8) *2 2?

    2020
  • What types of data do operators work with?
    Integers and real data values
  • What is the significance of using operators correctly in programming?
    To ensure the code performs as intended
  • What are the main types of arithmetic operators?
    • Addition
    • Subtraction
    • Multiplication
    • Division
    • Exponentiation
    • MOD
    • DIV
  • What are the potential issues with using integer division in programming?
    • May yield unexpected results
    • Can lead to loss of precision
    • Requires careful handling of data types
  • How do you ensure your code is performing the intended operations with operators?
    • Use parentheses for clarity
    • Follow BODMAS rules
    • Test with various inputs
  • What is the role of the assignment operator in programming?
    • Assigns values to variables
    • Used to store constants
    • Essential for variable manipulation
  • How do programming languages handle operator precedence?
    • Follow BODMAS rules
    • Prioritize certain operations
    • Use parentheses to override default precedence
  • What is the result of 2+2 +8 8 *2 2?

    18
  • How do you perform the addition in (2+8)(2 + 8) *2 2?

    Calculate 2+2 +8 8 first
  • What is the result of (2+8)(2 + 8) *2 2?

    20
  • What is the purpose of the assignment operator?
    • Assigns values to constants or variables
    • Used to store data for later use
  • What should the name of the constant variable be?
    On total = 25
  • What does the left-hand side of the assignment operator represent?
    It represents the variable receiving the value
  • What does the left-hand side of the assignment operator indicate?
    It indicates the variable name
  • What happens when you assign a value to a variable?
    The variable stores the assigned value
  • How does the assignment operator differ from the comparison operator?
    Assignment assigns values, comparison checks equality
  • What do comparison operators do?
    • Compare two values
    • Return true or false
  • What is the output of a comparison operator?
    True or false
  • What does the comparison operator check?
    It checks if two expressions are equal
  • If a variable "age" is assigned the value 25, what does "age == 25" evaluate to?
    True
  • What does the expression "age < 10" evaluate if age is 25?
    False
  • What is the result of "age > 15" if age is 25?
    True
  • What does "age <= 25" evaluate to if age is 25?
    True
  • What does "age >= 30" evaluate to if age is 25?
    False