Week 6- Debugging Flashcards

1
Q

What is debugging?

A

Debugging is searching a program’s source-code to find the cause of an error and then correcting the code so that the error is removed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is tracing?

A

Tracing is about discovering the order in which various program statements are carried out while the execution happens.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is watching?

A

Watching is about inspecting the values of various program variables while the execution happens.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can JavaScript alert boxes be used to trace program execution?

A

By placing alert boxes in the program. As the program runs any alert box that does not show up indicates that there has been an error in the coding.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How can the JavaScript alert boxed be used to watch program execution?

A

To do this, devise a statement that will create an alert box with a convenient message that displays the data value or values that you want to see at this point

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the dangers of using JavaScript alert boxes as simple debugging tools?

A

The alert boxes may create code or outcomes that are seen by the end user. And it is also very time consuming, adding in alert boxes at different stages and removing them again.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Why is it important to tidy up source-code after debugging is finished?

A

Removes all the code and alerts that may be left for the end user. This can impact software performance and customer satisfaction.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are two possible ways to tidy up debugging statements?

A
  1. Remove the debugging statements from the code (careful not to remove additional code)
  2. Make the debugging statements non-executable by converting them into comments. For example:

// alert (“DEBUG “ + “inside loop: “ + “counter = “ + counter + “:sum = “ + sum);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are two possible ways to tidy up debugging statements?

A
  1. Remove the debugging statements from the code (careful not to remove additional code)
  2. Make the debugging statements non-executable by converting them into comments. For example:

// alert (“DEBUG “ + “inside loop: “ + “counter = “ + counter + “:sum = “ + sum);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a break point?

A

Breakpoints tell the debugger it should break, or pause code execution, at a certain point. You can set a breakpoint anywhere in your JavaScript code, and the debugger will halt code execution when it reaches the breakpoint.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the three ways to ‘step through’ code?

A

Step Into executes the next line of code. If that line is a function call, the debugger executes the function and halts at the first line of the function.
Step Over, like Step Into, executes the next line of code. If that line is a function, Step Over executes the entire function and halts at the first line outside the function.
Step Out returns to the calling function when you are inside a called function. Step Out resumes the execution of code until the function returns. It then breaks at the return point of the function.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly