Advanced JavaScript: Strings, Numbers, and Dates Quiz Quiz

Challenge your expertise on JavaScript string, number, and date methods, including edge cases and tricky behaviors. This quiz is designed for those wanting to validate their deep understanding of these core JavaScript concepts.

  1. String Immutability and Methods

    Given const str = 'abc'; what will be the new value of str after performing str.toUpperCase(); ?

    1. null
    2. 'abc'
    3. 'Abc'
    4. undefined
    5. 'ABC'
  2. Template Literals and Expression Evaluation

    What is the output of the following code? const x = 5; const y = 10; console.log(`Sum: ${x + y}`);

    1. Sum: 510
    2. Sum: x + y
    3. Sum: 5 + 10
    4. Sum: 15
    5. `Sum: 15`
  3. Number Object: isNaN and Edge Cases

    What will Number.isNaN('NaN') evaluate to in JavaScript?

    1. undefined
    2. TypeError
    3. true
    4. null
    5. false
  4. Math Object Randomization

    What is the possible range of values (inclusive or exclusive) returned by Math.random() in standard JavaScript?

    1. [0, 1)
    2. (0, 1]
    3. [0.1, 1)
    4. [0, 1]
    5. (0, 1)
  5. Split and Limits in String Methods

    What will be the output of 'banana,apple,pear'.split(',', 2)?

    1. ['banana', 'applepear']
    2. ['banana']
    3. ['banana', 'apple', 'pear']
    4. ['banana', 'apple']
    5. ['banana,apple']
  6. Comparing Numbers: Precision Issues

    What is the result of 0.1 + 0.2 === 0.3 in JavaScript?

    1. true
    2. false
    3. TypeError
    4. null
    5. undefined
  7. Date Object: UTC and Local Time

    If you create a date object as new Date(Date.UTC(2020, 0, 1)), what will date.getUTCFullYear() return?

    1. 0
    2. 2021
    3. 2019
    4. 2020
    5. January
  8. String Search Methods: lastIndexOf

    For the string 'abracadabra', what is the result of str.lastIndexOf('a', 5)?

    1. 0
    2. 10
    3. 5
    4. 3
    5. 7
  9. Math Object: Math.ceil Edge

    What does Math.ceil(-2.3) return?

    1. -3
    2. 0
    3. 3
    4. -2
    5. 2
  10. Converting Dates to ISO Strings

    What is the output type of date.toISOString() when date is a valid Date object?

    1. Number
    2. Array
    3. Date
    4. Object
    5. String
  11. String padStart and padEnd

    What is the result of '7'.padStart(3, '0').padEnd(5, '8')?

    1. '00788'
    2. '70088'
    3. '78008'
    4. '00778'
    5. '07888'
  12. Parsing Integers with parseInt

    What value is returned by parseInt('09', 8) in JavaScript?

    1. 1
    2. NaN
    3. 8
    4. 9
    5. 0
  13. Date Methods: getDay vs getDate

    For new Date('2024-06-13'), what does date.getDay() return if June 13, 2024, is a Thursday?

    1. 13
    2. 6
    3. 3
    4. 5
    5. 4
  14. Identifying Infinite Numbers

    What does Number.isFinite(Infinity) return?

    1. NaN
    2. null
    3. false
    4. true
    5. undefined
  15. String.replace and Regular Expressions

    What will be the result of 'test-test'.replace(/t/g, 's')?

    1. 'sesl-sesl'
    2. 'ses-ses'
    3. 'sest-sest'
    4. 'tess-tess'
    5. 'sess-sess'