3.2 Programming

Subdecks (2)

Cards (42)

  • What is variable assignment?
    Variable assignment is changing the value of a variable.
  • What is initialization in programming?
    Initialization is assigning a variable with its first value.
  • What is a variable?
    A variable is a temporary memory location that holds a value that can change during program execution.
  • What is a constant?
    A constant is a temporary memory location that holds a value that stays the same during program execution.
  • What is selection in programming?
    Selection is choosing the path a program will follow based on a condition (if, elif, else).
  • What is iteration in programming?
    Iteration is repeating a set of instructions, which can be count-controlled (for loop) or condition-controlled (while loop).
  • What is string concatenation?
    String concatenation is joining strings together, e.g., "a" + "b" = "ab".
  • What is string slicing?
    String slicing is cutting a section of a string, e.g., subject = "mathematics" and subject.SubString(2,4) will give "them".
  • What are data structures?
    • Data structures are organized and structured sets of data that can be easily edited and changed.
    • Created using brackets: [ ] for 1D and [ ][ ] for 2D.
  • How does indexing work in data structures?
    Data structures indexing starts at 0 (left to right) and -1 (right to left).
  • How do you iterate through a list of values?
    You must use a loop (for or while), with for loop preferred for knowing the number of values.
  • What is a record in programming?
    A record groups together items of data that are related to each other.
  • What is the comparison between arrays and records?
    • Arrays hold a list of values of the same data type.
    • Records can hold different data types, making them more powerful for storing related information.
  • What are the advantages of using subroutines?
    • Easier to understand the program.
    • Test subroutines in isolation.
    • Develop them independently.
    • Change one without affecting others.
    • Easily debugged for errors.
    • Allows collaborative development.
  • What is a structured approach in programming?
    • Using multiple modularized subroutines.
    • Clear and well-documented interfaces.
    • Local variables and parameters for efficiency.
    • Return values.
  • What is a subroutine?
    A subroutine is a predefined block of code with a unique name that can be called at any time.
  • What are the two types of sub-programs?
    The two types of sub-programs are subroutines (no return value) and functions (has a return value).
  • How do you call a subroutine in Python?
    You call a subroutine by writing its name followed by parentheses, e.g., linearSearch().
  • What are parameters in programming?
    Parameters are input variables needed to create subroutines.
  • What are arguments in programming?
    Arguments are input values passed into already created subroutines.
  • What is a local variable?
    A local variable is only accessible within a section of code or a sub-program.
  • What is a global variable?
    A global variable can be accessed throughout the entire program or multiple sub-programs.
  • How do you write a new subroutine name in Python?
    You write a new subroutine name using def uniqueName(parameter1, parameter2...):.
  • How do you call a subroutine with arguments in Python?
    You call a subroutine with arguments using uniqueName(5, 10...).