Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Chapter 8 : Debugging and Error Handling

Total questions: 20

Worksheet time: 11mins

Name
Class
Date
1.

Which of these best describe the act of Debugging

a)

It refers to the act of developing solutions for a program

b)

It refers to the act of fixing errors in a program

c)

It refers to the act of locating errors in a pgram

d)

It refers to the act of tracing and solving errors in a program

2.

Fix the following code:


dcument.getElemntById("myelement").value = 10;

(a)  

3.

What is wrong with the following code?


function myFunc {

// My Code

a)

No matching braces { }

b)

Misspelt keyword

c)

Functions must have parentheses ( )

d)

Mismatched quotation marks (" ", ' ')

4.

What is a violation of the rules for coding Javascript called?

a)

Logic error

b)

Run-time error

c)

Syntax error

5.

Which of these errors make the program run in an unexpected way?

a)

Syntax error

b)

Run-time error

c)

Logic error

6.

Which errors will stop the execution of the program?

a)

Syntax error

b)

Run-time error

c)

Logic error

7.

What is the act of Tracing in debugging?

a)

The act of finding bugs and resolving them in a program

b)

The act of drawing a line around the code that is causing problems

c)

The examination of error messages and fixing the associated problems

d)

The examination of individual statements in an executing program

8.

What is NOT a common technic for debugging?

a)

Using a software tool to monitor values and resolve bugs

b)

Using windows.alert() function at different points & monitor values

c)

Using break mode to monitor values and trace execution

d)

Using document.write() function at different points & monitor values

e)

Using commenting to comment out problematic lines

9.

What is TRUE about entering Break Mode?

a)

Program will not be able to resume

b)

Program execution is stopped

c)

You can have only one breakpoint

d)

Can only be activated by inserting breakpoints

10.

Which one of the following allows you to skip function calls?

a)

Stepping in / Stepping into

b)

Stepping over

c)

Stepping out

11.

When stepping over, will functions still be executed?

a)

Yes

b)

No

12.

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");

a)

alert("1");

b)

alert("2");

c)

alert("3");

d)

alert("4");

13.

What will stepping out allow you to do?

a)

Exit the current function and stop at the next statement

b)

Execute the rest of the current function, Exit and stop at the next statement

c)

Execute the rest of the current function, Exit and stop program execution

d)

Exit the current function and stop program execution

14.

What is the process of catching and handling errors in your code before they cause run-time errors?

a)

Exception Handling

b)

Problem Handling

c)

Issue Handling

d)

Bug Handling

15.

Which part of a try...catch...finally statement will executed fully regardless of whether an error occurs or not

a)

try

b)

catch

c)

finally

16.

What is the output of the following code?


try

allleerrt("Hello");

alert("A problem has occurred")


catch(e)

alert("There is a problem");

a)

Hello

A problem has occurred

b)

A problem has occurred

c)

There is a problem

d)

Hello

There is a problem

17.

Which part of the try...catch...finally statement will you write code to handle errors that occur?

a)

try

b)

catch

c)

finally

18.

What is a call stack?

a)

A list containing all the errors and bugs encountered during program execution

b)

A list containing functions/methods/events that have not yet finished processing

c)

A list containing functions/methods/events that are contained in the program

d)

A list containing all the messages generated by Javascript during program execution

19.

Each time a new function/method/Event is called, where is it placed inside the call stack?

a)

On top

b)

In the middle

c)

At the bottom

20.

When a function/method/event on the call stack is completed, what happens to it?

a)

It is paused

b)

It is hidden

c)

It is disabled

d)

It is removed