Question: Question 1 (1 point) try { adddlert(Welcome JavaScript!); } catch(err) { document.getElementById(WEBT2300).innerHTML = err.message; } What is the output of the above code? Question 1
Question 1 (1 point)
What is the output of the above code?
Question 1 options:
|
|
Welcome JavaScript!
|
|
|
adddlert is not defined
|
|
|
WEBT2300
|
|
|
Welcome JavaScript! WEBT2300
|
Question 2 (1 point)
var num = 1;
try {
num.toPrecision(50);
}
catch(err) {
document.getElementById("demo").innerHTML = err.name;
}
Assume that the above is in a script of an html file.
What is the output of the above?
Question 2 options:
|
|
1
|
|
|
rangeError
|
|
|
50
|
|
|
no output
|
Question 3 (1 point)
var x=1; var y=1;
try {
x = y * x;
}
catch(err) {
document.getElementById("WEBT2300").innerHTML = err.name;
}
Assume that the above is in the script of an html code.
Question 3 options:
|
|
1
|
|
|
ReferenceError
|
|
|
nothing
|
|
|
0
|
Question 4 (1 point)
Will:
console.log(String.fromCharCode(65))
'A'
Question 4 options:
| True | |
| False |
Question 5 (1 point)
Assume that:
var x = new String("John"); var y = new String("John");
What would be the result of :
(x == y)
var x1 = "John"; var y1 = "John";
What would be the result of :
(x1 == y1)
Question 5 options:
|
|
true true
|
|
|
false true
|
|
|
false false
|
|
|
true false
|
Question 6 (1 point)
var x=0;
try {
x = y + 1;
}
catch(err) {
document.getElementById("WEBT2300").innerHTML = err.name;
}
What is the output of the above code?
Question 6 options:
|
|
nothing
|
|
|
NaN
|
|
|
ReferenceError
|
|
|
0
|
Question 7 (1 point)
try {
eval("alert('JavaScript)");
}
catch(err) {
document.getElementById("WEBT2300").innerHTML = err.name;
}
What is the output of the above script.
Question 7 options:
|
|
nothing
|
|
|
ReferenceError
|
|
|
0
|
|
|
SyntaxError
|
|
|
JavaScript
|
Question 8 (1 point)
what is the return value of
"SELECT".substring(0, 5)?
Question 8 options:
|
|
"SELEC"
|
|
|
"SELE"
|
|
|
"ELECT"
|
|
|
"SELECT"
|
Question 9 (1 point)
var num = 100;
try {
num.toUpperCase();
}
catch(err) {
document.getElementById("WEBT2300").innerHTML = err.name;
}
what is the output of the above script?
Question 9 options:
|
|
SyntaxError
|
|
|
Illegal expression
|
|
|
100
|
|
|
TypeError
|
|
|
ReferenceError
|
Question 10 (1 point)
try {
decodeURI("%&%");
}
catch(err) {
document.getElementById("WEBT2300").innerHTML = err.name;
}
Question 10 options:
|
|
SyntaxError
|
|
|
TypeError
|
|
|
ReferenceError
|
|
|
URIError
|
Question 11 (1 point)
"unhappy".substring(2)
returns
'happy'
Question 11 options:
|
|
True
|
|
|
False
|
Question 12 (1 point)
We want to examine the input we read. If the value is wrong, an exception (err) is thrown. The exception (err) is caught by the catch statement and a custom error message is displayed according to:
a- If the value entered is a number throw 'not a character" b- if the value read smaller than e return 'smaller than e'. c- if the value read greater than m return 'greater than m'.
Replace a-,b-,c- with the below statements.
Please input a letter between 'e' and 'm':
Question 12 options:
|
| if(isNaN(x)) throw "not a character"; if(x > 'd') throw "too low"; if(x < 'm') throw "too high"; |
|
| if(Number(x)) throw "not a character"; if(x < 'd') throw "too low"; if(x > 'm') throw "too high"; |
|
| if(!Number(x)) throw "not a character"; if(x > 'd') throw "too low"; if(x < 'm') throw "too high"; |
|
| if(!isNaN(x)) throw "not a character"; if(x < 'd') throw "too low"; if(x > 'm') throw "too high"; |
Question 13 (1 point)
My First Web Page
We want to activate the debugger in the browser to get an output.
Give the actual steps to get an output and the actual output.
Question 13 options:
|
|
debugging error
|
|
|
30
|
|
| F12 error |
|
| F12 Console 30 |
Question 14 (1 point)
Provide the output of the code
var Y = 19*3+2;
debugger;
document.getElementById("WEBT2300").innerHTML = Y;
Question 14 options:
|
|
59
|
|
|
debugging error
|
|
|
nothing
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
