Programming Fundamentals

Cards (32)

  • What are the three programming constructs?
    Sequence, Selection, Iteration
  • What does the sequence construct do in programming?
    It structures code in logical order
  • How does the selection construct function in programming?
    It uses if statements for decision making
  • What is the purpose of the iteration construct?
    To repeat code using loops
  • What is the role of variables in programming?
    To store data in programs
  • What are the two parts of a variable?
    Data value and identifier
  • Why should variable names be sensible?
    To clarify their purpose in the program
  • What is an example of a sensible variable name?
    First_Name
  • What are local variables?
    Declared within a specific subroutine
  • What are global variables?
    Used anywhere in the whole program
  • What is an advantage of local variables?
    They save memory when not in use
  • Why are local variables easier to debug?
    They can only be changed in one subroutine
  • What is an advantage of global variables?
    They can be used in multiple subroutines
  • What is a constant in programming?
    Data that does not change in value
  • Give an example of a constant.
    Pi (3.14159)
  • What are comparison operators used for?
    To compare two data values
  • What are arithmetic operators used for?
    To mathematically manipulate values
  • What is the addition operator symbol?
    +
  • What is the subtraction operator symbol?


  • What is the multiplication operator symbol?
    *
  • What is the division operator symbol?
    /
  • What does modulo division do?
    Reveals the remainder from division
  • What does integer division reveal?
    The whole number of times a number divides
  • What does the symbol ^ represent?

    Exponentiation in some programming languages
  • What does Python use for exponentiation?
    **
  • What are logical operators used for?
    To work with TRUE and FALSE values
  • What is the term for TRUE and FALSE values?
    Boolean
  • What are the three programming constructs and their functions?
    • Sequence: Structures code in logical order
    • Selection: Uses if statements for decision making
    • Iteration: Repeats code using loops
  • What are the differences between local and global variables?
    • Local Variables:
    • Declared within a specific subroutine
    • Used only within that subroutine
    • Global Variables:
    • Used anywhere in the program
    • Declared once for the entire program
  • What are the advantages of local and global variables?
    • Local Variables:
    • Save memory when not in use
    • Easier to debug
    • Global Variables:
    • Used in multiple subroutines
    • Easier maintenance
  • What is the difference between variables and constants?
    • Variables: Data that can change value
    • Constants: Data that remains fixed in value
  • What are the types of operators in programming?
    • Comparison Operators: Compare two data values
    • Arithmetic Operators: Mathematically manipulate values
    • Logical Operators: Work with TRUE and FALSE values