Lab Quiz 3

\(\boxdot\) General Information

  • First Half: closed resources - Multiple Choice or Short Answer

  • Second Half: allowable resources are RSI Textbook, course web notes, Python Tutor, PyCharm, methods cheat sheet

  • Textbook Sections: Chapter 8 and Chapter 9, Sections 1 - 9

  • 65 minutes

\(\boxdot\) Primary Topics

Selection
  • unary

    if boolean_value:  
         .
         .
  • binary

    if boolean_value:  
         .
         .
    else:  
         .  
         .
  • chained

    if boolean_value1:  
         .
         .  
    elif boolean_value2:  
         .  
         .  
    elif boolean_value3:  
         .  
         .  
    else  (optional)  
         .  
         .  
Iteration
  • for loops (definite)

    • for item in a_list:

    • for i in range(len(a_list)):

  • while loops (indefinite)

    • while boolean_object:

    • sentinal values

Strings - ' ' or " "
  • string traversal

  • string functions, operators and methods:

    • + - concatenation operator

    • * - repetition operator

    • : - slice operator

    • <, ==, <=, >=, != - comparison operators

    • in and not in operators

    • len() function

    • strip() method

    • split() method

    • replace() method

\(\boxdot\) Types of Questions

  • multiple choice and/or short answer:

    • basic mathematics binary operators and precedence

    • for and while loops

    • strings

    • methods, functions and operators for strings

    • accumulator pattern

    • boolean expressions using comparison operators

    • precedence : mathematical operators, relational operators, logical operators

    • selection (if, if - else, if - elif - else)

  • code reading:

    • program flow of execution (main() and other functions)

    • accumulator pattern

    • variable values at certain locations in the code

    • function return values

  • code writing:

    • for and while loops

    • strings

    • random module functions - random() and randrange()

    • accumulator pattern

    • boolean expressions using comparison operators

    • precedence : mathematical operators, relational operators, logical operators

    • selection (if, if - else, if - elif - else)

    • proper indentation

  • not included:

    • image processing

    • Monte Carlo method material

    • 3n + 1 sequence

    • Newton’s method

    • character classification (9.19)