NEW
Font size
WorksheetsFST Class 2023- Quiz 8
Total questions: 10
Worksheet time: 6mins
Which JavaScript object provides mathematical functions and constants?
`Math`
`Calc`
`Arithmetic`
`Number`
What is the value of `Math.PI` in JavaScript?
Approximately 3.14
Approximately 2.71
Approximately 1.61
Exactly 3
To find the nearest integer greater than or equal to a given number `x`, you can use:
`Math.ceil(x)`
`Math.floor(x)`
`Math.round(x)`
`Math.min(x)`
Which `Math` method is used to calculate the square root of a number?
`Math.sqrt(x)`
`Math.squareRoot(x)`
`Math.pow(x, 0.5)`
`Math.square(x)`
How can you generate a random integer between 1 and 100 (inclusive) in JavaScript using the `Math` object?
`Math.random(1, 100)`
`Math.floor(Math.random() * 100) + 1`
`Math.random() * 100 + 1`
`Math.ceil(Math.random() * 100)`
What does the JavaScript `Date` object represent?
A specific time and date
Mathematical calculations
A string of characters
A conditional statement
To get the month (0-11) from a `Date` object, you can use the method:
`getMonth()`
`month()`
`getMonthIndex()`
`date.getMonth()`
How do you set the year of a `Date` object to 2022?
`date.setYear(2022)`
`date.year = 2022`
`date.setFullYear(2022)`
`date.year(2022)`
Which `Date` method is used to retrieve the day of the week (0-6) from a `Date` object?
`getDate()`
`getDay()`
`dayOfWeek()`
`date.getDay()`
