JSE1: Module 3 Test Answers (JavaScript Essentials 1)

JavaScript Essentials 1 – JSE1: Module 3 Test Answers

1. The result of the operation !(true && false || true) will be:

  • false
  • 1
  • true
  • null

2. The result of the comparison “abcd” > “Abcd” will be:

  • 1
  • false
  • true
  • “abcd”

3. Analyze the code snippet:

let nr = "1";
let x = (nr === 1);
let y = (nr == 1);
let z = (nr = 1);

After its execution, the variables x, y, and z will have the values:

  • x: true, y: false, z: 1
  • x: 1, y: 1, z: 1
  • x: false, y: true, z: 1
  • x: null, y: null, z: 1

4. The result of the operation 3 * 4 > 20 – 15 will be:

  • true
  • -14
  • NaN
  • false

5. Analyze the code snippet:

let n = 10;
let m = ++n;

Its execution will result in the following values in the variables n and m:

  • n: 10, m: 11
  • n: 11, m: 10
  • n: 11, m: 11
  • n: 10, m: 10

6. The confirm method allows you to create a dialog box. What value does this method return when the user closes the window?

  • The string entered by the user.
  • Always true.
  • It depends on the option selected by the user.
  • Always false.

7. Which operator do we use if we want to check if two variables store the same values of exactly the same type?

  • =
  • !==
  • ==
  • ===

8. The result of the operation false || “false” will be:

  • true
  • 0
  • false
  • “false”

9. The number 2 is stored in the variable n (let n = 2;). The command n = n*n*n is then called. This last command can be replaced by:

  • n ***= n;
  • n *= 3;
  • n **= 3;
  • n **= n;

10. Analyze the following code:

let test = prompt("Hello", "World");

What value will the test variable have if, after running the code, we immediately press the OK button on the newly created dialog?

  • “OK”
  • “World”
  • true
  • “Hello”

11. The result of the operation 20 || 5 will be:

  • 20
  • 5
  • true
  • 25

12. Analyze the code snippet:

let n = 2 * 3 ** 3 - 1;

The result stored in the variable n is:

  • 53
  • 215
  • 18
  • 36

13. The methods window.alert, window.confirm, and window.prompt are methods of the window object. Which of the following is not true?

  • The window object represents the window in which the HTML document containing the JavaScript code currently being executed is open.
  • The alert, confirm, and prompt methods display information in modal windows that block access to the page until they are closed.
  • You can call window methods, such as window.alert, without including the name window, so calling alert(“abc”) would be correct.
  • The alert, confirm, and prompt methods require an argument specifying the position of the dialog box in which the information will be displayed.

14. The string “12” has been written into the str variable: (let str = “12”;). Then the operation str = +str is performed. As a result, the variable str will contain:

  • “+12”
  • 12
  • “12”
  • NaN

Leave a Reply

Your email address will not be published. Required fields are marked *