Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1try { risky(); } catch (e) { ... } | Ae | |
| 2catch (e) { console.log(e); } | BRuns this block only if an error occurred in try | |
| 3Prevents a program from crashing when an error occurs | Ctry { risky(); } catch (e) {} | |
| 4Holds information about the error inside catch | DWrong - 'try' must be lowercase | |
| 5Try { console.log(x); } catch (e) {} | ERuns the try block, and if it errors, runs catch | |
| 6try { console.log(x); } Catch (e) {} | FWrong - 'catch' must be lowercase |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
try...catch — Runs code in a try block, and if an error occurs, runs the catch block instead of crashing.try {
console.log(risky);
} catch (e) {
}try {
doSomething();
} catch (e) {
console.log(e);
}try {
parseData();
} catch (err) {
}try {
loadFile();
} catch (problem) {
}try {
connect();
} catch (problem) {
console.log(problem);
}