Logo/

Python Control Structures and Modules

Log in

Made with ScholarlyMake flashcards like these from your own notes

Python Control Structures and Modules

Questions and answers

34 cards
  1. Question:What is a Control Structure?

    Answer:Controls the flow/order of statements

  2. Question:What is a Sequence Structure?

    Answer:Statements execute in order, top to bottom

  3. Question:What is a Decision Structure?

    Answer:Statements execute based on a condition

  4. Question:What is a Boolean Expression?

    Answer:An expression that evaluates to true or false

  5. Question:Name a Relational Operator supported by Python.

    Answer:>, <, >=, <=, ==, !=

  6. Question:List the six Python relational operators mentioned.

    Answer:>, <, >=, <=, ==, !=

  7. Question:What is a Nested Decision Structure?

    Answer:A decision structure inside another decision structure

  8. Question:What defines a Compound Boolean Expression?

    Answer:Two or more Boolean expressions linked with and, or, not

  9. Question:What is a Logical Operator?

    Answer:Operator used to join Boolean expressions: and, or, not

  10. Question:What is a Unary Operator?

    Answer:An operator with only 1 operand

  11. Question:What is Short-Circuit Evaluation?

    Answer:Interpreter stops evaluating if result will not change

  12. Question:What is a Flag in programming?

    Answer:A Boolean variable indicating some status

  13. Question:What is a Repetition Structure?

    Answer:A loop that causes statements to execute more than once

  14. Question:What is an Iteration in loops?

    Answer:Each execution of the loop body

  15. Question:What is a Conditional Loop?

    Answer:Repeats as long as a condition is true

  16. Question:What is an Infinite Loop?

    Answer:A loop that iterates forever

  17. Question:What is a Counted Loop?

    Answer:A loop that repeats an exact number of times

  18. Question:What is a Step Value in loops?

    Answer:Value used to increase the counter, often 1

  19. Question:What is an Augmented Assignment Operator?

    Answer:A short-hand that combines arithmetic with assignment

  20. Question:What is Input Validation?

    Answer:Checking that user-entered data is valid before use

  21. Question:What is a Trace Table used for?

    Answer:A table that tracks variables and outputs

  22. Question:What is a Nested Loop?

    Answer:A loop inside another loop

  23. Question:What is a Sentinel Value?

    Answer:A special value indicating end of data sequence

  24. Question:What is GIGO?

    Answer:Garbage-In, Garbage-Out; output integrity depends on input

  25. Question:What is a Nested Loop (alternate definition)?

    Answer:A loop within another loop

  26. Question:What is a Trace Table (alternate definition)?

    Answer:A debugging technique to analyze variables and outputs

  27. Question:What is a Standard Library?

    Answer:A collection of commonly used functions installed with a language

  28. Question:What is an API?

    Answer:Application Programming Interface, same as Standard Library

  29. Question:What is a Module?

    Answer:A collection of related functions in a .py file

  30. Question:What is Dot Notation used for in Python?

    Answer:Calling a function from an imported module using moduleName.function

  31. Question:What is a Pseudorandom Number?

    Answer:A fake random number generation based on seed

  32. Question:What is a Seed in random number generation?

    Answer:An integer used to calculate next random number

  33. Question:What is Namespace in Python modules?

    Answer:Module import creates its own namespace requiring dot notation

  34. Question:What is Modularization in programming?

    Answer:Grouping related functions into separate modules