Quiz 4

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/14

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

15 Terms

1
New cards

What is the purpose of a traceback in Flask debugging?

A traceback displays the sequence of function calls that led to an error, including the specific file and line number where the error occurred, helping quickly identify and diagnose problems.

2
New cards

Why should debug=True not be used in production for Flask apps?

Enabling debug=True in production exposes sensitive information, such as code snippets, file paths, and potentially secret variables, which attackers could exploit.

3
New cards

What does app.logger.info() do in a Flask app?

Records informational log messages that help track the application's behavior or specific events, appearing in the terminal for troubleshooting and analysis.

4
New cards

When should you use try/except blocks in Flask applications?

Use try/except blocks around code that may raise exceptions (e.g., database connections, external requests, parsing operations) to handle errors gracefully without crashing the app.

5
New cards

What is server-side validation and why is it important?

Server-side validation verifies submitted data on the server to ensure data integrity and prevent invalid or malicious input. It's essential for security and accurate data handling.

6
New cards

Where does validation typically occur in a Flask route that handles a form submission?

Validation typically occurs within the route function that processes the POST request right after retrieving form data, before database operations or business logic.

7
New cards

What is the role of errorList in Flask form validation logic?

errorList collects all validation error messages. If validation fails, this list is sent back to the template to inform users of all input errors at once.

8
New cards

Which condition correctly validates a position field that must be one of a few valid values?

if position not in ["Lecturer", "Sr. Lecturer", "Asst. Professor", "Professor"]

9
New cards

What does the Flask request.form.get("fName", 0) statement do?

Retrieves the value of the fName input field from a submitted form. If the field is missing, it defaults to 0.

10
New cards

In the test plan, what is the purpose of integration testing?

Integration testing verifies that combined components or units work correctly together by checking interactions and dependencies between modules.

11
New cards

What kind of testing involves simulating real user interactions in a browser?

End-to-End testing involves simulating real user interactions, validating complete user journeys in a real browser environment.

12
New cards

Which types of tests would most likely detect a SQL injection vulnerability?

Security testing and White Box testing, which analyze code for security flaws and vulnerabilities, would likely detect SQL injection vulnerabilities.

13
New cards

Why is regression testing important after new features are added?

Regression testing ensures new code or features haven't negatively impacted existing functionality, confirming the system remains stable.

14
New cards

What would be a correct test step to verify that a student cannot delete a course?

Attempting a delete operation using student credentials and verifying an error message or denial occurs, confirming permissions are enforced.

15
New cards

What components are typically tested during unit testing in a Flask application?

Individual functions, routes, database queries, helper methods, and logic units within the Flask app are tested to ensure isolated components function correctly.