- Structured Programming
- Selection Control Structures
- Code Blocks
- Condition Examples: Temperature Conversion Pseudocode
- Condition Examples: Python Code
- Structured Quiz 5 questions
- If and If-else Statement
- If and If-else Quiz 5 questions
- Chained Decisions
- Chained Decisions Quiz 5 questions
- Nested Decision
- Nested Decision Quiz 5 questions
- Conditional Expressions
- Conditional Expressions Quiz 5 questions
Quiz Question 1 of 5
In a software system, user permissions are determined using the following conditional expression:
access_level = "Admin" if is_admin else "User" if is_user else "Guest"
Considering a scenario where is_admin = False, is_user = True
, and the system requires users to have "Admin" access to change settings, what will happen if the user attempts to change settings, and how is access_level
determined?
Choose the correct answer below:
-
A
The
access_level
defaults to "Guest" becauseis_admin
is False, and the user cannot change settings. -
B
The
access_level
is set to "User", but the user is denied permission to change settings because "Admin" access is required. -
C
The system grants "Admin" access since
is_user
is True, allowing the user to change settings. -
D
The system does not evaluate the
is_user
condition becauseis_admin
is False, soaccess_level
is set to "Guest".