profile image

Andrew Ledger

Software Programmer

Contact Me

Hard Coded Quiz

  1. After the following code, what is the message displayed to the user?

    let firstName = null;

    let lastName = null;

    let nickName = "Supercoder";

    alert(firstName ?? lastName ?? nickName ?? "Anonymous");




    Check Q1
  2. After the following code, what will be the value of 'tallEnough'?

    let height = 0;

    tallEnough = (height || 100);




    Check Q2
  3. After the following code, what will be the value of 'words'?

    var words = (a() && b())

    function a(){return "hello";}

    function b(){return "world";}




    Check Q3
  4. What is the correct way to rewrite the following function using arrow functions?

    let sum = function(a, b) {

    return a + b;

    };




    Check Q4
  5. After the following code, what will be the value of 'd'?

    let logicAnd = (a, b) => a && b;

    let logicValid = (a, b) => a ?? b;

    let logicOr = (a, b) => a || b;

    function maths(a, b, c) {

    return (logicOR(a, b) + logicAnd(a, b) + logicValid(c, b));

    }

    let a = 1;

    let b = 2;

    let c = 0;

    let d = maths(a, b, c);




    Check Q5
  6. Which of the following is NOT valid?




    Check Q6