Constants and variables

Cards (90)

  • What are constants and variables in programming?
    Constants remain the same; variables can change
  • How do constants and variables differ in programming?
    Constants do not change, while variables do
  • Can data values be constants or variables?
    Yes, data values can be either
  • What is linked to the name of a constant or variable?
    It is linked to a memory location
  • What does the size of the memory location depend on?
    It depends on the data type
  • What is a constant in programming?
    A constant is a fixed data value
  • What happens if you try to change a constant's value?
    An error will be returned by the compiler
  • How are constants assigned in programming?
    Using the "c" command
  • How do variables differ from constants in terms of value?
    Variables can change values; constants cannot
  • What is required when using data types in some languages?
    Data types must be declared
  • What is the significance of naming conventions for constants and variables?
    They make code easier to read and follow
  • What is the naming convention for the first letter of constants?
    It is in lowercase
  • What follows the first letter in naming conventions?
    A mixture of letters, numbers, and underscores
  • What happens if variables are not declared in certain languages?
    You will receive a syntax error
  • What is the purpose of standard naming conventions?
    To make code easier to understand
  • What is the result of not declaring variables in a required language?
    You will encounter a syntax error
  • How do naming conventions affect programming?
    They enhance code clarity and maintainability
  • What is the data type for 'pressure' in programming?
    It is an integer data type
  • What is the data type for 'temperature' in programming?
    It is a decimal data type
  • What must be declared before using data types?
    Data types must be declared beforehand
  • What is the consequence of not declaring variables?
    You will receive a syntax error
  • What is the purpose of declaring data types?
    To ensure proper data handling in code
  • How do programming languages handle undeclared variables?
    They return a syntax error
  • What is the significance of declaring variables in programming?
    It prevents errors during code execution
  • What happens if you don't declare variables in a required language?
    You will encounter a syntax error
  • What is the naming convention for the first letter of variables?
    It is in lowercase
  • Why are naming conventions important in programming?
    They improve code readability and maintenance
  • How do naming conventions affect the clarity of code?
    They enhance clarity and understanding
  • What is the data type for 'pressure' in programming?
    It is an integer data type
  • What is the consequence of not declaring variables in a required language?
    You will receive a syntax error
  • What type of error is mentioned in the study material?
    Syntax error
  • Why do programmers follow standard naming conventions?
    To make code easier to follow
  • What is the recommended case for the first letter of variable names?
    Lowercase
  • What should variable names not contain according to the study material?
    Spaces or start with a number
  • What are the rules for naming variables in programming?
    • Start with a letter or underscore
    • No spaces allowed
    • Cannot start with a number
    • Use lowercase for the first letter
    • Avoid special characters
  • How many points do athletes get for winning an event?
    5 points
  • How many points do athletes get for coming second?
    2 points
  • What happens if athletes do not win or come second?
    They receive 0 points
  • What does the program calculate regarding points?
    The total number of points awarded
  • What is the input for the number of first places in the program?
    "Number of 1st places."