Skip to content

Punjab (PTB) · Chapter test · Free

2nd Year Computer Chapter 5 TestCODE TESTING AND DEBUGGING

30 marks · 40 minutes · 21 questions. Covers: CHAP 5: CODE TESTING AND DEBUGGING.

Your school name

2nd Year Computer Chapter 5 Test

2nd Year · Computer · Punjab (PTB)

Name: ____________Roll No: ________Class/Section: ________Date: ________Total marks: 30Time: 40 minutes

Q1. Multiple choice questions (Attempt all · 10 × 1 = 10)

  1. What are breakpoints and watches used for in software development?

    1. To compile source code into machine code

    2. To analyze program behavior and examine data at specific points

    3. To format Python source code automatically

    4. To speed up the execution of loops

  2. What are breakpoints defined as in IDEs like PyCharm or VS Code?

    1. Keywords that stop program compilation

    2. Variables that store error logs

    3. Markers that pause program execution at a chosen line of code

    4. Functions that return calculated values

  3. Which step-by-step debugging action allows you to go inside a function to see how it is working?

    1. Step Over

    2. Step Into

    3. Continue

    4. Pause

  4. What feeds directly into the Tuning stage?

    1. Collecting configuration and refining tunings

    2. Deleting database records

    3. Generating syntax errors

    4. Creating breakpoints

  5. Testing is essential for reliable applications because it helps to:

    1. Optimise code performance

    2. Identify and fix bugs

    3. Reduce the program size

    4. Make code run faster

  6. What is a key benefit of handling multiple exception types effectively?

    1. It speeds up network download rates

    2. It prevents unexpected crashes and ensures proper error recovery

    3. It removes the need to write unit tests

    4. It automatically deletes corrupted files

  7. What type of error occurs when code fails to follow the grammatical rules of the programming language?

    1. Logic error

    2. Syntax error

    3. Runtime error

    4. Resource leak

  8. What do profiling tools track in a program?

    1. Syntax errors and indentation issues

    2. Execution time and memory usage of different functions

    3. Variable naming conventions

    4. HTML rendering speed

  9. What does profiling help identify?

    1. Syntax errors

    2. Slow parts of a program so they can be improved for better performance

    3. Unused variable names

    4. Missing semicolons

  10. Profiling in programming is used to:

    1. Improve the user interface design

    2. Measure performance and identify bottlenecks

    3. Optimise memory usage only

    4. Test for security vulnerabilities

Q2. Short questions (Attempt any 6 of 8 · 6 × 2 = 12)

  1. What are two primary benefits of performing unit testing?

  2. What are three optimization techniques used to fix performance bottlenecks?

  3. What is a performance bottleneck in programming?

  4. What is testing?

  5. What tools can be used for profiling and measuring performance in Python?

  6. What are breakpoints in IDEs like PyCharm or VS Code?

  7. What is the purpose of writing and executing test cases?

  8. Define breakpoints and watches in debugging.

Q3. Long questions (Attempt any 2 of 3 · 2 × 4 = 8)

  1. Discuss in detail the importance of testing and debugging techniques in software development, highlighting how they improve performance, user confidence, and future maintenance.

  2. Why is testing essential for reliable applications, and what role does it play in ensuring program stability?

  3. What is step-by-step debugging, and how does it help in identifying and fixing bugs in Python programs?