PCAP 31 03 PCAP Certified Associate Python Programmer · Free Practice Question Medium

Question 45

Q302 - Operators


What value will be assigned to the x variable?



  • A

    0

  • B

    False

  • C

    True

  • D

    1

Reveal correct answer

Correct answer: C

Explanation

Topics: operators relational operators operator precedence

Try it yourself:

Explanation:

The operators here are from three different groups.

"Comparisons, Identity, Membership operators", "Logical AND", "Logical OR".

The two comparison operators,

greater than operator and less than operator have the highest precedence.

Then the logical and operator has a higher precedence

than the logical or operators

(There are similar questions Q119 and Q241.)


Q302 (Please refer to this number, if you want to write me about this question.)

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need