Docsity

Troubleshooting and Debugging in Python Programming | Objective Assessment | Questions and, Exams of Cultural Studies

Toggle sidebar
bg1
A+
Troubleshooting and Debugging in Python Programming |
Objective Assessment | Questions and Answers with Verified
Solutions |
Question: Answer:
What does troubleshooting mean? Finding and fixing problems when something breaks or doesn't work right.
Question: Answer:
Give an example of troubleshooting in everyday life. If a phone won't turn on, check if the battery is dead.
Question: Answer:
What is a bug in programming? A mistake or problem in code that makes a program not work correctly.
Question: Answer:
What is debugging? The process of finding and fixing bugs in a program.
Question: Answer:
Why is troubleshooting important? Even one tiny mistake in code can cause problems; good programmers find and
fix these quickly.
Question: Answer:
What is the first step in the basic troubleshooting
process?
Make a hypothesis about what might be wrong.
Question: Answer:
What is a good hypothesis? A statement that is either TRUE or FALSE and can be tested.
Question: Answer:
What should you do if your hypothesis is false? Make a new hypothesis and test it again.
Question: Answer:
What is a test in troubleshooting? An action taken to check if a hypothesis is true or false.
pf3
pf4
pf5
pf8

Partial preview of the text

Download Troubleshooting and Debugging in Python Programming | Objective Assessment | Questions and and more Exams Cultural Studies in PDF only on Docsity!

A+

Troubleshooting and Debugging in Python Programming |

Objective Assessment | Questions and Answers with Verified

Solutions |

Question: Answer:

What does troubleshooting mean? Finding and fixing problems when something breaks or doesn't work right.

Question: Answer:

Give an example of troubleshooting in everyday life. If a phone won't turn on, check if the battery is dead.

Question: Answer:

What is a bug in programming? A mistake or problem in code that makes a program not work correctly.

Question: Answer:

What is debugging? The process of finding and fixing bugs in a program.

Question: Answer:

Why is troubleshooting important? Even one tiny mistake in code can cause problems; good programmers find and fix these quickly.

Question: Answer:

What is the first step in the basic troubleshooting process? Make a hypothesis about what might be wrong.

Question: Answer:

What is a good hypothesis? A statement that is either TRUE or FALSE and can be tested.

Question: Answer:

What should you do if your hypothesis is false? Make a new hypothesis and test it again.

Question: Answer:

What is a test in troubleshooting? An action taken to check if a hypothesis is true or false.

What are the three types of errors in Python? Syntax Errors, Name Errors, and Type Errors.

Question: Answer:

What is a syntax error? Code that doesn't follow Python's rules.

Question: Answer:

How can you fix a syntax error? Read the error message and check for missing quotes, parentheses, or incorrect indentation.

Question: Answer:

What is a name error? Using a variable or function name that doesn't exist.

Question: Answer:

How can you fix a name error? Check the spelling of variable names and ensure they are defined before use.

Question: Answer:

What is a type error? Trying to perform an operation with the wrong type of data.

Question: Answer:

How can you fix a type error? Convert types when needed and remember that input() always gives a string.

Question: Answer:

What is an IDE? A program that helps you write and test code, providing tools to run code and find errors.

Question: Answer:

What is the difference between an IDE and a text editor? An IDE has built-in tools to run code and find bugs, while a text editor only allows you to type code.

Question: Answer:

What is Visual Studio Code (VS Code)? A recommended IDE for programming that provides various tools for writing and debugging code.

Question: Answer:

What is a breakpoint? A line where the program pauses so you can check what is happening during debugging.

Question: Answer:

How do you set a breakpoint in VS Code? Click in the left margin at the line number where you want the program to pause.

What is the benefit of using an IDE for debugging? It helps find errors faster, test small parts of code, and organize code better.

Question: Answer:

What is AI's role in debugging? AI tools can help find and fix bugs, acting like a programming expert.

Question: Answer:

What should you include when describing a problem to an AI tool? What the code should do, what it actually does, and any error messages.

Question: Answer:

What is a good practice when using AI for debugging? Use AI as a helper, not a replacement for thinking.

Question: Answer:

What is a common mistake to avoid when debugging? Ignoring error messages instead of reading them.

Question: Answer:

What is the first step in the troubleshooting process? Make a hypothesis about what's wrong.

Question: Answer:

What should you do if your hypothesis fails? Make a new hypothesis and run a new test.

Question: Answer:

What is the purpose of using print() statements in debugging? To check what values variables have during execution.

Question: Answer:

What should you check if your program runs but gives the wrong answer? Add print() statements to see variable values and trace through the logic.

Question: Answer:

What is a common cause for a program to stop unexpectedly? Infinite loops or dividing by zero.

Question: Answer:

What should you do if your program appears to do nothing? Check if output is being shown or if the program is waiting for input.

What is the hypothesis/test troubleshooting loop? A systematic process to identify and fix bugs by making hypotheses and testing them.

Question: Answer:

What types of Python errors should you be aware of? Syntax, name, and type errors.

Question: Answer:

What is the significance of reading error messages? They provide clues about what went wrong and where to look for mistakes.

Question: Answer:

What should you do before trusting an AI's suggested fix? Always test the AI's suggestion in your IDE.

Question: Answer:

What is a good question to ask AI when debugging? Why does this give the wrong answer?

Question: Answer:

What is a common debugging scenario when the program runs but gives a wrong answer? Add print() statements to see variable values and check logic.

Question: Answer:

What should you do if you encounter an error message? Read the error message carefully and check the indicated line for mistakes.

Question: Answer:

What is the importance of testing multiple scenarios in debugging? To ensure that the fix works under different conditions and inputs.

Question: Answer:

What should you do if you make changes to your code? Verify that the changes are correct and understand why they work.

Question: Answer:

What is a computer program? A set of instructions that tells a computer what to do, similar to a recipe.

Question: Answer:

What are the three basic parts of a program? Input, Process, and Output.

Question: Answer:

What does 'Input' refer to in programming? Getting information into the program, such as typing on a keyboard or reading from a file.

Why is it important to test your algorithm with different inputs? To ensure it works correctly under various scenarios and edge cases.

Question: Answer:

What is an example of an inefficient way to search for a phone number? Checking every person in the list one by one until you find them.

Question: Answer:

What is an efficient way to search for a phone number in a sorted list? Skipping to the right letter based on the name, reducing the number of checks needed.

Question: Answer:

What is the role of 'Input' in problem-solving with algorithms? It refers to the data or information you start with to solve a problem.

Question: Answer:

What does 'Output' signify in an algorithm? The final result or answer that is produced after processing the input.

Question: Answer:

What is the first step in solving a problem algorithmically? Understanding what information you have and what you need to find.

Question: Answer:

What does it mean for an algorithm to be 'doable'? Every step must be something that can actually be performed, not hypothetical.

Question: Answer:

What is an example of a clear algorithm? Instructions for making a peanut butter sandwich, which anyone can follow.

Question: Answer:

What are the steps to make a sandwich in pseudocode? Get two pieces of bread, spread peanut butter on the first piece, spread jelly on the second piece, put pieces together, eat.

Question: Answer:

What is the algorithm to find if a number is in a list? Get the list and the number to find, go through each item in the list, if the item equals the number, say 'Found it!', otherwise say 'Not found'.

Question: Answer:

How do you calculate the total cost in pseudocode? Start with total = 0, for each item in shopping list, add the price to total, show the total.

What is the first step in algorithm design? Understand what you need: identify inputs, the goal, and outputs.

Question: Answer:

What is the second step in algorithm design? Break it into smaller pieces; do not try to solve everything at once.

Question: Answer:

What is the purpose of testing pseudocode? To ensure the steps work correctly with real data.

Question: Answer:

What is the goal of the example problem about calculating the average? To find the average of five test scores.

Question: Answer:

What is a programming language? A way to write instructions that a computer understands, with specific rules.

Question: Answer:

Name a few popular programming languages. Python, Java, JavaScript, C++.

Question: Answer:

Why was Python chosen for this course? Because it has simple, readable syntax and fewer confusing symbols.

Question: Answer:

What is the difference between compiled and interpreted languages? Compiled languages translate code all at once before running, while interpreted languages translate code line by line as it runs.

Question: Answer:

What is the primary programming paradigm used in Python? Procedural programming, where steps are written in order.

Question: Answer:

What are the basic data types in Python? Numbers (integers and floats), text (strings), and Boolean (True/False).