WorksheetsChapter 8 : Debugging and Error Handling
Total questions: 20
Worksheet time: 11mins
Which of these best describe the act of Debugging
It refers to the act of developing solutions for a program
It refers to the act of fixing errors in a program
It refers to the act of locating errors in a pgram
It refers to the act of tracing and solving errors in a program
Fix the following code:
dcument.getElemntById("myelement").value = 10;
(a)
What is wrong with the following code?
function myFunc {
// My Code
No matching braces { }
Misspelt keyword
Functions must have parentheses ( )
Mismatched quotation marks (" ", ' ')
What is a violation of the rules for coding Javascript called?
Logic error
Run-time error
Syntax error
Which of these errors make the program run in an unexpected way?
Syntax error
Run-time error
Logic error
Which errors will stop the execution of the program?
Syntax error
Run-time error
Logic error
What is the act of Tracing in debugging?
The act of finding bugs and resolving them in a program
The act of drawing a line around the code that is causing problems
The examination of error messages and fixing the associated problems
The examination of individual statements in an executing program
What is NOT a common technic for debugging?
Using a software tool to monitor values and resolve bugs
Using windows.alert() function at different points & monitor values
Using break mode to monitor values and trace execution
Using document.write() function at different points & monitor values
Using commenting to comment out problematic lines
What is TRUE about entering Break Mode?
Program will not be able to resume
Program execution is stopped
You can have only one breakpoint
Can only be activated by inserting breakpoints
Which one of the following allows you to skip function calls?
Stepping in / Stepping into
Stepping over
Stepping out
When stepping over, will functions still be executed?
Yes
No
A breakpoint has been placed below, which line will be executed next when you step over?
function myfunction() {
alert("1");
alert("2"); }
(* breakpoint) myfunction(); <-- paused here
alert("3");
alert("4");
alert("1");
alert("2");
alert("3");
alert("4");
What will stepping out allow you to do?
Exit the current function and stop at the next statement
Execute the rest of the current function, Exit and stop at the next statement
Execute the rest of the current function, Exit and stop program execution
Exit the current function and stop program execution
What is the process of catching and handling errors in your code before they cause run-time errors?
Exception Handling
Problem Handling
Issue Handling
Bug Handling
Which part of a try...catch...finally statement will executed fully regardless of whether an error occurs or not
try
catch
finally
What is the output of the following code?
try
allleerrt("Hello");
alert("A problem has occurred")
catch(e)
alert("There is a problem");
Hello
A problem has occurred
A problem has occurred
There is a problem
Hello
There is a problem
Which part of the try...catch...finally statement will you write code to handle errors that occur?
try
catch
finally
What is a call stack?
A list containing all the errors and bugs encountered during program execution
A list containing functions/methods/events that have not yet finished processing
A list containing functions/methods/events that are contained in the program
A list containing all the messages generated by Javascript during program execution
Each time a new function/method/Event is called, where is it placed inside the call stack?
On top
In the middle
At the bottom
When a function/method/event on the call stack is completed, what happens to it?
It is paused
It is hidden
It is disabled
It is removed
