Quiz
Review
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (30)
1Entering about:blank in the address bar of your browser will:
- Aopen a tab with information about your browser.
- Bclear all inputs on the current page.
- Cgenerate a page with information about the browser’s status.
- Dgenerate and load a minimal blank HTML page into the current tab.
2Analyze the following code:
let id = "100";
{
let id = 200;
id = id + 1;
console.log(id);
}- A1001
- B101
- C201
- D200
3Select a set of data types, containing only complex types:
- AObject, String
- BBoolean, Number, Bigint
- CArray, Object
- DArray, Object, String
4We can replace the declaration let x = 3e-3; with:
- Alet x = 3000;
- Blet x = 0.003;
- Clet x = 0.0003;
- Dlet x = 0.333;
5Using the string interpolation technique, we can create the string:
"I do not like travelling by plane"- Alet means = "plane";
let msg = 'I do not like travelling by \{ means \}'; - Blet means = "plane";
let msg = "I do not like travelling by ${ means }"; - Clet means = "plane";
let msg = `I do not like travelling by ${means}`; - Dlet means = "plane";
let msg = `I do not like travelling by {means}`;
- Alet means = "plane";
6We declare a movie object, with two fields: title and year:
let movie = {
title: "Life",
year: 1999
To change the value of the title field to "Matrix" we need to perform:- Amovie[title] = "Matrix";
- Bmovie.title = "Matrix";
- Cmovie{title} = "Matrix";
- Dtitle->movie = "Matrix";
7You declare the following array of animals: let animals = ["canary", "dog", "cat"];. Then, you call the method animals.push("hamster");. What will the animals array look like after calling the method?
- A["canary", "dog", "cat", "hamster"]
- B["hamster"]
- C["hamster", "canary", "dog", "cat"]
- D["canary", "dog", "cat"]
8A JavaScript code includes the console.log("http://somethingNew.org"); command. Its execution will:
- Adisplay on the console information about the progress of the http://somethingNew.org page loading.
- Bcause the page http://somethingNew.org to be loaded into the browser.
- Csend a log with information about the currently executed script to the indicated address http://somethingNew.org.
- Ddisplay the following message on the console: "http://somethingNew.org".
9Analyze the code snippet:
let winter = ["December", "January", "February"]; let index = winter.indexOf("February");
What value will the index variable have?- A"February"
- B2
- C3
- D1
10In the daysOfWeek variable, you place an array with the names of the days of the week. Which method will you call to reverse the order of the array elements.
- AdaysOfWeek.invert();
- BdaysOfWeek = reverse(daysOfWeek);
- CdaysOfWeek.reverse();
- DdaysOfWeek.order(-1);
11Review the following code:
let msg1 = 'hello';
let msg2 = msg1.slice(-1);
console.log(msg2 ? msg2 : msg2 + msg1);
What will appear on the console as a result?- Ao
- Bohello
- Chello
- Dh
12Analyze the following code:
let test = prompt("Run", "code");
What value will the test variable have if, after running the code, we immediately press the OK button on the newly created dialog?- Atrue
- BOK
- Ccode
- DRun
13Analyze the following code:
let x = false || true;
let y = "true" && "false";
let z = false && true;
console.log(`${x} ${y} ${z}`);
What will appear in the console as a result of its execution?- Afalse true true
- Bfalse false false
- Cfalse false true
- Dtrue false false
14Analyze the following code:
let a = true && 20;
let b = 0 || 20
let c = 0 && 20;
console.log(`${a} ${b} ${c}`);
What will appear in the console as a result of its execution?- Atrue 20 0
- B1 1 0
- Ctrue true false
- D20 20 0
15Examine the following code:
let a = 20 + "10";
let b = 20 + +"10";
let c = 20 + -"10" + "10";
let d = "10" - "10" + "100";
let e = "A" - "B" + 0xA;
console.log(`${a}, ${b}, ${c}, ${d}, ${e}`);
What will appear on the console as a result?- A30, 30, 20, 100, 2
- B30, 31, 39, 100, NaN
- C2010, 2010, 20-1010, 0100, NaN
- D2010, 30, 1010, 0100, NaN
16Which of the following loop instructions checks the loop continuation condition only after the iteration has been completed?
- Afor ... in
- Bwhile
- Cfor
- Ddo ... while
17The following function using a function expression has been defined:
let sum = function (a, b) {
return (a + b);
}
What could the definition of the corresponding arrow function look like?- Alet sum = function (a, b) => {
return (a + b); } - Blet sum = (a, b) => a + b;
- Clet sum = (a, b) => { a + b; };
- Dlet sum = (a, b)-- > a + b;
- Alet sum = function (a, b) => {
18The temp array contains air temperature data measured over a period of time. You want to display the minimal temperature using the following code:
temp.forEach(e => min = min > e ? e : min);
console.log(min);
What should the declaration of the min variable look like?- Alet min;
- BIt’s not necessary, as it will be declared automatically on first use.
- Clet min = temp[0];
- Dlet min = 0;
19Examine the following code:
let x = [10, 20, 30, 40];
let y = [50, 60];
x.reverse().push(y);
console.log(x.length);
What will appear on the console as a result?- A6
- B4
- C5
- D2
20Analyze the following code:
for(let a=1; a<10; a+=2) {
console.log(a);
};
Which statement can replace the for from the example?- Alet counter = 1;
while (counter++ < 10) console.log(counter++); - Blet counter = 0;
while (counter < 9) console.log(counter++); - Clet counter = 0;
while (counter++ < 10) console.log(counter++); - Dlet counter = 0;
while (counter < 10) console.log(counter++);
- Alet counter = 1;
21Analyze the following code:
let colors = ['red', 'green', 'blue'];
for (let c of colors) console.log(c);
What will appear on the console as a result?- A['red', 'green', 'blue']
- Bred
green
blue - C0
1
2 - D3
22Analyze the following code:
let route = {distance: 131, elevation: 1.4};
for (let k in route) console.log(k);
What will appear on the console as a result?- A131
1.4 - Bdistance
- Cdistance
elevation - D2
- A131
23Examine the following code:
let a = (n) => {
return n > 2 ? n * a(n - 1) : 2
}
console.log(a(6));
What will appear on the console as a result?- A120
- B720
- C6
- D4
24Examine the following code:
let x = mult(2)(10);
console.log(x); // -> 20
What should the mult function declaration look like if the execution of this code results in a value of 20 in the console?- Alet mult = function (a) {
return function (b) {
return a * b;
}
} - BThere is an error in the code and it is not possible to declare such a function correctly.
- Clet mult = function (a, b) {
return a * b;
} - Dlet mult = function (a, b) {
return b ? mult(b) : mult(a);
}
- Alet mult = function (a) {
25Analyze the code snippet:
let counter = 0;
let userName = "John";
After declaring the counter variable, we want to add a short comment with information about what the variable is used for. To do this, we modify the line with the declaration to the form:- A// let counter = 0; user visit counter
- Blet counter = 0; // user visit counter
- Clet counter = 0; ;;user visit counter
- Dlet counter = 0; /* user visit counter
26Examine the following code:
x = [40, 10, 30, 20, 50];
x.sort(cmp);
How should the function cmp be declared if, after the code execution, the elements of the array x are sorted in ascending order?- Alet cmp = (a, b) => b < a;
- Blet cmp = (a, b) => a - b;
- Clet cmp = (a, b) => b > a;
- Dlet cmp = (a, b) => b - a;
27Analyze the following code, which is missing one line:
let counter = 2;
let interval = setInterval(() => {
console.log(counter);
// Insert missing line here.
}, 1000);
What should the missing line look like if the execution of this code results in the console displaying the values 2, 1, and 0 in sequence?- Aif (counter-- >= 0) clearInterval(interval);
- Bif (counter-- <= 0) clearInterval(interval);
- Cwhile (counter-- >= 0) clearInterval(interval);
- DclearInterval(interval);
28Analyze the following code:
function execute(todo, a, b) {
return todo(a, b);
}
console.log(execute(power, 3, 2));
Before declaring the function, we should add one more line of code. Which one, if the execution of the completed code will result in the console displaying the value 9?- Alet power = () => a ** b;
- Blet power = 9;
- Clet power = (x,y) => x * y;
- Dlet power = (x, y) => x ** y;
29Analyze the following code:
const a = "hello";
console.log(a.toUpperCase());
}
} catch (error) {
console.log(a)
} finally {
console.log(a);
}
What will happen as a result of its execution?- AThe following words will appear in the console on subsequent lines: HELLO, hello, and hello.
- BThe following words will appear in the console on subsequent lines: HELLO and hello.
- CThe following words will appear in the console on subsequent lines: hello and hello.
- DThe following word will appear in the console: HELLO.
30Placing a debugger; statement in the program code will:
- Astop the program without the ability to continue, as long as the execution environment supports “debugging functionality”.
- Bpause the program with the ability to continue, as long as the execution environment supports “debugging functionality”.
- Cput the interpreter into report mode, which will cause the console to print out all sequentially executed commands.
- Dcause the console to display the completion status of the statement preceding the debugger.
Information
- Description
- Quiz on Review, created by Jio Serrano on 20/09/2024.
- Author
- Jio Serrano
- Language
- English
- Views
- 14
- Rating
- No ratings yet Rate this quiz