Exam in
52 questions
When a user views a page containing a JavaScript program, which machine executes the script?
Which of the following lines of JavaScript code will change the HTML inside of an element with the attribute id="myElement" to "CS 105"?
If the function print() has been defined that prints the value passed in as the parameter to it, how many times is "Hello" printed?
If the initial value of x (set on Line #1) is now 5 instead of 20, how many times is "Hello" printed?
Based on its usage in the function, what type of variable x be?
Which of the following statements are true about this code?
In the JavaScript, which one of the following is not considered as an error:
In JavaScript, the statement "40" + 6 will return
To determine if an object contains a certain property, we can use the _______ operator.
What is the correct JavaScript syntax to change the content of the HTML element <P id="demo">This is a demonstration.</p>
What is the output of the following JavaScript snippet?
var writeMe="console.log('document.writeln(x);')"
var x=13
eval(writeMe);
x="20"
y=10
document.writeln(x+y, x-y)
x = "20";
Y = 10;
document.writeln(x + y, x - y);
If you have the following JavaScript statement: const f = (a,b)=>a+b+5;
The first console.log statement (line 4), will output:
The second console.log statement (line 8), will output:
The last console.log statement (lines 10, 11), will output:
If we called func(1, "1"); it will log:
If we called func("1"); it will log:
If we called func("A", "2", "Ali", "Z"); it will log:
If we called func(); it will log:
Line 2 in this code will (ignoring lines from 3- to the end):
Assume Lines from 1 to 3 in this code are removed, then line 5 will:
Assume Lines from 1 to 3 in this code are removed, and line 6 is removed too, code is only lines (4, 5 and 7), line 7 will output:
Assume Line 2 in this code is removed, then line 3 in this code will (ignoring lines from 4- to the end):
Assume Lines 2, 4, and 5 in this code are removed, line 6 will output:
JavaScript is a statically typed language.
var a=200; var b="200"; a===b will return true while a==b will return false?
isNaN("Hello") returns true while isNaN(undefined) returns false?
var colors = (1:"red", 2:"green", 3:"blue") is one of the ways of defining an array in JavaScript?
var colors = (1:"red", 2:"green", 3:"blue") is one of the ways of defining an array in JavaScript.
Which of the following statement(s) is true about the JavaScript?
Which is the correct syntax to call an external JavaScript file in the current HTML document?
Which JavaScript method is used to write on browser's console?
Which JavaScript method is used to write into an alert box?
Which is the correct syntax to declare a constant in JavaScript?
What will be the output of this code?
const VALUE=10;
VALUE=20;
Can we use a function as a variable value?
What will be the value of X printed?
var X=10;
function myfunc() {
let x=20;
document.write(X);
}
What is the output of the following JavaScript code?
var a = 10 + 20 + "5";
document.getElementById("demo").innerHTML = a;
What will be the output of the following JavaScript code?
var x = 12.34;
document.getElementById("test").innerHTML = typeof(x);
Which is the correct syntax to access an object property in JavaScript?
let x = 10;
let y = 20;
let text = "x * y";
let result = eval(text);
document.getElementById("demo").innerHTML = result;
var x;
for(x = 0; x < 5; x++) {
document.write(x);
If you have the following JavaScript statement: const f = (a, b) a + b + 5;
To determine the type of an object, we can use the "typeof" function in JavaScript.
Which of the following is true about JavaScript syntax?
What is the purpose of the prototype property in JavaScript objects?
What will the following JavaScript code log?
const obj = {a: 1, b: 2 };
delete obj.a;
console.log(obj)
How many ways are there with which we can declare a variable in javascript?
What will be the output of the following Java Script code snippet?
function test(...args) {
document.write(typeof(args));
test(12);
Which method can be used to combine two arrays in JavaScript?