
































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

































PACK 1 — QUESTIONS 1–
Correct answer: A. Use = to bind a name to a value Rationale: Assignment binds a name to an object; the name can later be referenced or rebound. B — Incorrect: # begins a comment and does not store runtime data. C — Incorrect: == compares values for equality. D — Incorrect: def defines a function, not an ordinary variable.
Correct answer: D. Use = to bind a name to a value Rationale: Assignment binds a name to an object; the name can later be referenced or rebound. A — Incorrect: def defines a function, not an ordinary variable. B — Incorrect: # begins a comment and does not store runtime data. C — Incorrect: == compares values for equality.
Correct answer: C. Use = to bind a name to a value Rationale: Assignment binds a name to an object; the name can later be referenced or rebound. A — Incorrect: == compares values for equality. B — Incorrect: # begins a comment and does not store runtime data. D — Incorrect: def defines a function, not an ordinary variable.
Correct answer: B. Use = to bind a name to a value Rationale: Assignment binds a name to an object; the name can later be referenced or rebound. A — Incorrect: # begins a comment and does not store runtime data. C — Incorrect: == compares values for equality. D — Incorrect: def defines a function, not an ordinary variable.
Correct answer: D. Use = to bind a name to a value Rationale: Assignment binds a name to an object; the name can later be referenced or rebound. A — Incorrect: def defines a function, not an ordinary variable. B — Incorrect: # begins a comment and does not store runtime data. C — Incorrect: == compares values for equality.
Correct answer: C. A name can refer to objects of different types at different times Rationale: Python is dynamically typed: names are bound to objects and can later be rebound to objects of other types. A — Incorrect: Reassignment across types is valid. B — Incorrect: Ordinary Python variables do not require permanent type declarations. D — Incorrect: Python does not automatically stringify every assigned value.
Correct answer: B. A name can refer to objects of different types at different times Rationale: Python is dynamically typed: names are bound to objects and can later be rebound to objects of other types. A — Incorrect: Ordinary Python variables do not require permanent type declarations. C — Incorrect: Reassignment across types is valid. D — Incorrect: Python does not automatically stringify every assigned value.
Correct answer: A. A name can refer to objects of different types at different times Rationale: Python is dynamically typed: names are bound to objects and can later be rebound to objects of other types. B — Incorrect: Ordinary Python variables do not require permanent type declarations. C — Incorrect: Reassignment across types is valid. D — Incorrect: Python does not automatically stringify every assigned value.
Correct answer: D. A name can refer to objects of different types at different times Rationale: Python is dynamically typed: names are bound to objects and can later be rebound to objects of other types. A — Incorrect: Python does not automatically stringify every assigned value. B — Incorrect: Ordinary Python variables do not require permanent type declarations. C — Incorrect: Reassignment across types is valid.
Correct answer: C. A name can refer to objects of different types at different times Rationale: Python is dynamically typed: names are bound to objects and can later be rebound to objects of other types. A — Incorrect: Reassignment across types is valid. B — Incorrect: Ordinary Python variables do not require permanent type declarations. D — Incorrect: Python does not automatically stringify every assigned value.
Correct answer: B. A name can refer to objects of different types at different times Rationale: Python is dynamically typed: names are bound to objects and can later be rebound to objects of other types. A — Incorrect: Ordinary Python variables do not require permanent type declarations. C — Incorrect: Reassignment across types is valid. D — Incorrect: Python does not automatically stringify every assigned value.
Correct answer: A. A name can refer to objects of different types at different times Rationale: Python is dynamically typed: names are bound to objects and can later be rebound to objects of other types. B — Incorrect: Ordinary Python variables do not require permanent type declarations. C — Incorrect: Reassignment across types is valid. D — Incorrect: Python does not automatically stringify every assigned value.
Correct answer: D. A name can refer to objects of different types at different times Rationale: Python is dynamically typed: names are bound to objects and can later be rebound to objects of other types. A — Incorrect: Python does not automatically stringify every assigned value. B — Incorrect: Ordinary Python variables do not require permanent type declarations. C — Incorrect: Reassignment across types is valid.
Correct answer: C. A name can refer to objects of different types at different times Rationale: Python is dynamically typed: names are bound to objects and can later be rebound to objects of other types. A — Incorrect: Reassignment across types is valid. B — Incorrect: Ordinary Python variables do not require permanent type declarations. D — Incorrect: Python does not automatically stringify every assigned value.
Correct answer: A. The str type Rationale: str represents text. B — Incorrect: int represents integers. C — Incorrect: bool represents True or False. D — Incorrect: float represents floating-point numbers.
Correct answer: D. The str type Rationale: str represents text. A — Incorrect: float represents floating-point numbers. B — Incorrect: int represents integers. C — Incorrect: bool represents True or False.
Correct answer: C. The str type Rationale: str represents text. A — Incorrect: bool represents True or False. B — Incorrect: int represents integers. D — Incorrect: float represents floating-point numbers.
Correct answer: B. The str type Rationale: str represents text. A — Incorrect: int represents integers. C — Incorrect: bool represents True or False. D — Incorrect: float represents floating-point numbers.
Correct answer: A. The str type Rationale: str represents text. B — Incorrect: int represents integers. C — Incorrect: bool represents True or False. D — Incorrect: float represents floating-point numbers.
Correct answer: D. The str type Rationale: str represents text. A — Incorrect: float represents floating-point numbers. B — Incorrect: int represents integers. C — Incorrect: bool represents True or False.
Correct answer: C. True and False, with type bool Rationale: Python's Boolean type has the values True and False. A — Incorrect: A non-empty string is truthy but remains a str. B — Incorrect: 0 and 1 are integers, even though they can be used in truth testing. D — Incorrect: A list is a collection, not the Boolean type.
Correct answer: B. True and False, with type bool Rationale: Python's Boolean type has the values True and False. A — Incorrect: 0 and 1 are integers, even though they can be used in truth testing. C — Incorrect: A non-empty string is truthy but remains a str. D — Incorrect: A list is a collection, not the Boolean type.
Correct answer: A. True and False, with type bool Rationale: Python's Boolean type has the values True and False. B — Incorrect: 0 and 1 are integers, even though they can be used in truth testing. C — Incorrect: A non-empty string is truthy but remains a str. D — Incorrect: A list is a collection, not the Boolean type.
Correct answer: D. True and False, with type bool Rationale: Python's Boolean type has the values True and False. A — Incorrect: A list is a collection, not the Boolean type. B — Incorrect: 0 and 1 are integers, even though they can be used in truth testing. C — Incorrect: A non-empty string is truthy but remains a str.
Correct answer: B. True and False, with type bool Rationale: Python's Boolean type has the values True and False. A — Incorrect: 0 and 1 are integers, even though they can be used in truth testing. C — Incorrect: A non-empty string is truthy but remains a str. D — Incorrect: A list is a collection, not the Boolean type.
Correct answer: A. Use == Rationale: == compares two values for equality. B — Incorrect: = performs assignment. C — Incorrect: != tests inequality. D — Incorrect: <= tests less-than-or-equal ordering.
Correct answer: D. Use == Rationale: == compares two values for equality. A — Incorrect: <= tests less-than-or-equal ordering. B — Incorrect: = performs assignment. C — Incorrect: != tests inequality.
Correct answer: C. Use == Rationale: == compares two values for equality. A — Incorrect: != tests inequality. B — Incorrect: = performs assignment. D — Incorrect: <= tests less-than-or-equal ordering.
Correct answer: B. Use == Rationale: == compares two values for equality. A — Incorrect: = performs assignment. C — Incorrect: != tests inequality. D — Incorrect: <= tests less-than-or-equal ordering.
Correct answer: A. Use == Rationale: == compares two values for equality. B — Incorrect: = performs assignment. C — Incorrect: != tests inequality. D — Incorrect: <= tests less-than-or-equal ordering.
Correct answer: D. Use == Rationale: == compares two values for equality. A — Incorrect: <= tests less-than-or-equal ordering. B — Incorrect: = performs assignment. C — Incorrect: != tests inequality.
Correct answer: C. Use == Rationale: == compares two values for equality. A — Incorrect: != tests inequality. B — Incorrect: = performs assignment. D — Incorrect: <= tests less-than-or-equal ordering.
Correct answer: B. Use == Rationale: == compares two values for equality. A — Incorrect: = performs assignment. C — Incorrect: != tests inequality. D — Incorrect: <= tests less-than-or-equal ordering.
Correct answer: A. Use == Rationale: == compares two values for equality. B — Incorrect: = performs assignment. C — Incorrect: != tests inequality. D — Incorrect: <= tests less-than-or-equal ordering.
PACK 2 — QUESTIONS 51–
Correct answer: C. Multiplication is evaluated before addition Rationale: Multiplication has higher precedence than addition unless parentheses change the order. A — Incorrect: Python follows operator precedence, not a universal right-to-left rule. B — Incorrect: Addition has lower precedence than multiplication. D — Incorrect: Assignment is a statement operation, not the first arithmetic step.
Correct answer: B. Multiplication is evaluated before addition Rationale: Multiplication has higher precedence than addition unless parentheses change the order. A — Incorrect: Addition has lower precedence than multiplication. C — Incorrect: Python follows operator precedence, not a universal right-to-left rule. D — Incorrect: Assignment is a statement operation, not the first arithmetic step.
Correct answer: A. Multiplication is evaluated before addition Rationale: Multiplication has higher precedence than addition unless parentheses change the order. B — Incorrect: Addition has lower precedence than multiplication. C — Incorrect: Python follows operator precedence, not a universal right-to-left rule. D — Incorrect: Assignment is a statement operation, not the first arithmetic step.
Correct answer: D. Multiplication is evaluated before addition Rationale: Multiplication has higher precedence than addition unless parentheses change the order. A — Incorrect: Assignment is a statement operation, not the first arithmetic step. B — Incorrect: Addition has lower precedence than multiplication. C — Incorrect: Python follows operator precedence, not a universal right-to-left rule.
Correct answer: C. Multiplication is evaluated before addition Rationale: Multiplication has higher precedence than addition unless parentheses change the order. A — Incorrect: Python follows operator precedence, not a universal right-to-left rule. B — Incorrect: Addition has lower precedence than multiplication. D — Incorrect: Assignment is a statement operation, not the first arithmetic step.
Correct answer: B. Multiplication is evaluated before addition Rationale: Multiplication has higher precedence than addition unless parentheses change the order. A — Incorrect: Addition has lower precedence than multiplication. C — Incorrect: Python follows operator precedence, not a universal right-to-left rule. D — Incorrect: Assignment is a statement operation, not the first arithmetic step.
Correct answer: A. Multiplication is evaluated before addition Rationale: Multiplication has higher precedence than addition unless parentheses change the order. B — Incorrect: Addition has lower precedence than multiplication. C — Incorrect: Python follows operator precedence, not a universal right-to-left rule. D — Incorrect: Assignment is a statement operation, not the first arithmetic step.
Correct answer: D. Multiplication is evaluated before addition Rationale: Multiplication has higher precedence than addition unless parentheses change the order. A — Incorrect: Assignment is a statement operation, not the first arithmetic step. B — Incorrect: Addition has lower precedence than multiplication. C — Incorrect: Python follows operator precedence, not a universal right-to-left rule.
Correct answer: C. Multiplication is evaluated before addition Rationale: Multiplication has higher precedence than addition unless parentheses change the order. A — Incorrect: Python follows operator precedence, not a universal right-to-left rule. B — Incorrect: Addition has lower precedence than multiplication. D — Incorrect: Assignment is a statement operation, not the first arithmetic step.
Correct answer: A. % returns the remainder after division Rationale: % is the modulus operator. B — Incorrect: // performs floor division. C — Incorrect: ** performs exponentiation. D — Incorrect: / performs true division.
Correct answer: D. % returns the remainder after division Rationale: % is the modulus operator. A — Incorrect: / performs true division. B — Incorrect: // performs floor division. C — Incorrect: ** performs exponentiation.
Correct answer: C. % returns the remainder after division Rationale: % is the modulus operator. A — Incorrect: ** performs exponentiation. B — Incorrect: // performs floor division. D — Incorrect: / performs true division.
Correct answer: B. % returns the remainder after division Rationale: % is the modulus operator. A — Incorrect: // performs floor division. C — Incorrect: ** performs exponentiation. D — Incorrect: / performs true division.
Correct answer: A. % returns the remainder after division Rationale: % is the modulus operator. B — Incorrect: // performs floor division. C — Incorrect: ** performs exponentiation. D — Incorrect: / performs true division.
Correct answer: D. % returns the remainder after division Rationale: % is the modulus operator. A — Incorrect: / performs true division. B — Incorrect: // performs floor division. C — Incorrect: ** performs exponentiation.
Correct answer: C. if/elif/else selects a path based on conditions Rationale: Conditional statements execute blocks according to Boolean expressions. A — Incorrect: try/except handles exceptions. B — Incorrect: for and while are loops. D — Incorrect: import/from loads modules or names.
Correct answer: B. if/elif/else selects a path based on conditions Rationale: Conditional statements execute blocks according to Boolean expressions. A — Incorrect: for and while are loops. C — Incorrect: try/except handles exceptions. D — Incorrect: import/from loads modules or names.
Correct answer: A. if/elif/else selects a path based on conditions Rationale: Conditional statements execute blocks according to Boolean expressions. B — Incorrect: for and while are loops. C — Incorrect: try/except handles exceptions. D — Incorrect: import/from loads modules or names.
Correct answer: D. if/elif/else selects a path based on conditions Rationale: Conditional statements execute blocks according to Boolean expressions. A — Incorrect: import/from loads modules or names. B — Incorrect: for and while are loops. C — Incorrect: try/except handles exceptions.
Correct answer: B. if/elif/else selects a path based on conditions Rationale: Conditional statements execute blocks according to Boolean expressions. A — Incorrect: for and while are loops. C — Incorrect: try/except handles exceptions. D — Incorrect: import/from loads modules or names.
Correct answer: A. A for loop iterates over items in an iterable Rationale: for is suited to processing each element in an iterable. B — Incorrect: class defines a class. C — Incorrect: try/except is used for exception handling. D — Incorrect: A loop does not permanently store values by itself.
Correct answer: D. A for loop iterates over items in an iterable Rationale: for is suited to processing each element in an iterable. A — Incorrect: A loop does not permanently store values by itself. B — Incorrect: class defines a class. C — Incorrect: try/except is used for exception handling.
Correct answer: C. A for loop iterates over items in an iterable Rationale: for is suited to processing each element in an iterable. A — Incorrect: try/except is used for exception handling. B — Incorrect: class defines a class. D — Incorrect: A loop does not permanently store values by itself.
Correct answer: B. A for loop iterates over items in an iterable Rationale: for is suited to processing each element in an iterable. A — Incorrect: class defines a class. C — Incorrect: try/except is used for exception handling. D — Incorrect: A loop does not permanently store values by itself.
Correct answer: A. A for loop iterates over items in an iterable Rationale: for is suited to processing each element in an iterable. B — Incorrect: class defines a class. C — Incorrect: try/except is used for exception handling. D — Incorrect: A loop does not permanently store values by itself.
Correct answer: D. A for loop iterates over items in an iterable Rationale: for is suited to processing each element in an iterable. A — Incorrect: A loop does not permanently store values by itself. B — Incorrect: class defines a class. C — Incorrect: try/except is used for exception handling.
Correct answer: C. A for loop iterates over items in an iterable Rationale: for is suited to processing each element in an iterable. A — Incorrect: try/except is used for exception handling. B — Incorrect: class defines a class. D — Incorrect: A loop does not permanently store values by itself.
Correct answer: B. A for loop iterates over items in an iterable Rationale: for is suited to processing each element in an iterable. A — Incorrect: class defines a class. C — Incorrect: try/except is used for exception handling. D — Incorrect: A loop does not permanently store values by itself.
Correct answer: A. A for loop iterates over items in an iterable Rationale: for is suited to processing each element in an iterable. B — Incorrect: class defines a class. C — Incorrect: try/except is used for exception handling. D — Incorrect: A loop does not permanently store values by itself.