Previous QuestionNext QuestionSubmit Quiz
//Question1
//Define Variables
var onex1, onex2, onec1, onex1pow, onex2pow
//Assigns Random Integers
do {
onex1 = Math.floor(Math.random()*11) - Math.floor(Math.random()*11);
onex2 = Math.floor(Math.random()*11) - Math.floor(Math.random()*11);
onec1 = Math.floor(Math.random()*11) - Math.floor(Math.random()*11);
}
while ( onex1 ==0 || onex1 == -1 || onex2 == 0 || onec1 == 0 || onex1 == 1 || onex2 == 1 || onex2 == -1);
do {
onex1pow = Math.floor(Math.random()*6)+1;
onex2pow = Math.floor(Math.random()*6)+1;
}
while (onex1pow <= onex2pow || onex1pow ==1);
//Answer Choices
//Correct Answer
if (onex2pow == 1 && (onex2pow*onex2 > 0)) {
onecorrectanswer = (onex1pow*onex1).toString() + "x^" + (onex1pow-1).toString() + "+" + (onex2pow*onex2).toString();
}
else if (onex2pow == 1 && (onex2pow*onex2 < 0)){
onecorrectanswer = (onex1pow*onex1).toString() + "x^" + (onex1pow-1).toString() + (onex2pow*onex2).toString();
}
else if (onex2pow-1 == 1 && (onex2pow*onex2 > 0)) {
onecorrectanswer = (onex1pow*onex1).toString() + "x^" + (onex1pow-1).toString() + "+" + (onex2pow*onex2).toString() + "x";
}
else if (onex2pow-1 == 1 && onex2pow*onex2 < 0) {
onecorrectanswer = (onex1pow*onex1).toString() + "x^" + (onex1pow-1).toString() + (onex2pow*onex2).toString() + "x"
}
else if (onex2pow-1 > 1 && onex2pow*onex2 > 0) {
onecorrectanswer = (onex1pow*onex1).toString() + "x^" + (onex1pow-1).toString() + "+" + (onex2pow*onex2).toString() + "x^" + (onex2pow-1).toString();
}
else {onecorrectanswer = (onex1pow*onex1).toString() + "x^" + (onex1pow-1).toString() + (onex2pow*onex2).toString() + "x^" + (onex2pow-1).toString();}
//Answer1
if (onex2pow == 1 && (onex2pow*onex2 > 0)) {
oneanswer1 = (onex1pow*onex1).toString() + "x^" + (onex1pow).toString() + "+" + (onex2pow*onex2).toString() + "x";
}
else if (onex2pow == 1 && onex2pow*onex2 < 0) {
oneanswer1 = (onex1pow*onex1).toString() + "x^" + (onex1pow).toString() + (onex2pow*onex2).toString() + "x"
}
else if (onex2pow > 1 && onex2pow*onex2 > 0) {
oneanswer1 = (onex1pow*onex1).toString() + "x^" + (onex1pow).toString() + "+" + (onex2pow*onex2).toString() + "x^" + (onex2pow).toString();
}
else {
oneanswer1 = (onex1pow*onex1).toString() + "x^" + (onex1pow).toString() + (onex2pow*onex2).toString() + "x^" + (onex2pow).toString();
}
oneanswer3 = (onex1pow*onex1).toString() + "x^" + (onex1pow+1).toString() + "+" + (onex2pow*onex2).toString() + "x^" + (onex2pow+1).toString();
//Answer2
if (onex2pow == 1 && onex2 > 0) {
oneanswer2 = onex1.toString() + "x^" + (onex1pow-1).toString() + "+" + onex2.toString();
}
else if (onex2pow == 1 && onex2 < 0){
oneanswer2 = onex1.toString() + "x^" + (onex1pow-1).toString() + onex2.toString();
}
else if (onex2pow-1 == 1 && onex2 > 0) {
oneanswer2 = onex1.toString() + "x^" + (onex1pow-1).toString() + "+" + onex2.toString() + "x";
}
else if (onex2pow-1 == 1 && onex2 < 0) {
oneanswer2 = onex1.toString() + "x^" + (onex1pow-1).toString() + onex2.toString() + "x"
}
else if (onex2pow-1 > 1 && onex2 > 0) {
oneanswer2 = onex1.toString() + "x^" + (onex1pow-1).toString() + "+" + onex2.toString() + "x^" + (onex2pow-1).toString();
}
else {
oneanswer2 = onex1.toString() + "x^" + (onex1pow-1).toString() + onex2.toString() + "x^" + (onex2pow-1).toString();
}
//Answer3
if (onex2pow+1 == 1 && onex2pow*onex2 > 0 && onec1 > 0) {
onecorrectanswer = (onex1pow*onex1).toString() + "x^" + (onex1pow+1).toString() + "+" + (onex2pow*onex2).toString() + "x+" + onec1.toString() + "x";
}
else if (onex2pow+1 == 1 && onex2pow*onex2 < 0 && onec1 > 0) {
onecorrectanswer = (onex1pow*onex1).toString() + "x^" + (onex1pow+1).toString() + (onex2pow*onex2).toString() + "x+" + onec1.toString() + "+" + onec1.toString() + "x";
}
else if (onex2pow+1 == 1 && onex2pow*onex2 < 0 && onec1 < 0) {
onecorrectanswer = (onex1pow*onex1).toString() + "x^" + (onex1pow+1).toString() + (onex2pow*onex2).toString() + "x+" + onec1.toString() + onec1.toString() + "x";
}
else if (onex2pow+1 >= 1 && onex2pow*onex2 > 0 && onec1 > 0) {
onecorrectanswer = (onex1pow*onex1).toString() + "x^" + (onex1pow+1).toString() + "+" + (onex2pow*onex2).toString() + "x^" + (onex2pow+1).toString() + "+" + onec1.toString() + "x";
}
else if (onex2pow+1 >= 1 && onex2pow*onex2 > 0 && onec1 < 0) {
onecorrectanswer = (onex1pow*onex1).toString() + "x^" + (onex1pow+1).toString() + "+" + (onex2pow*onex2).toString() + "x^" + (onex2pow+1).toString() + onec1.toString() + "x";
}
else {
onecorrectanswer = (onex1pow*onex1).toString() + "x^" + (onex1pow+1).toString() + (onex2pow*onex2).toString() + "x^" + (onex2pow+1).toString()+ "+" + onec1.toString() + "x";
}
//Place Answer Choices into Array
oneanswerchoices = [oneanswer1, oneanswer2, oneanswer3, onecorrectanswer];
//Randomize Answer Choices
do {
var indexa = Math.floor(Math.random()*oneanswerchoices.length);
var indexb = Math.floor(Math.random()*oneanswerchoices.length);
}
while (indexb == indexa);
do {
var indexc = Math.floor(Math.random()*oneanswerchoices.length);
}
while (indexc == indexa || indexc == indexb);
do {
var indexd = Math.floor(Math.random()*oneanswerchoices.length);
}
while (indexd == indexa || indexd == indexb ||
indexd == indexc);
onea = oneanswerchoices[indexa];
oneb = oneanswerchoices[indexb];
onec = oneanswerchoices[indexc];
oned = oneanswerchoices[indexd];
if (indexa == 3) {
onecorrectchoice = "a"
}
if (indexb == 3) {
onecorrectchoice = "b"
}
if (indexc == 3) {
onecorrectchoice = "c"
}
if (indexd == 3) {
onecorrectchoice = "d"
}
//Question 1 Question
if (onex2pow == 1 && onex2 > 0 && onec1 > 0) {
question1 = "1. What is the first derivative of the curve y = " + onex1.toString() + "x^" + onex1pow.toString() + " + " + onex2.toString() + "x + " + onec1.toString() + "?"
}
else if (onex2pow == 1 && onex2 < 0 && onec1 > 0){
question1 = "1. What is the first derivative of the curve y = " + onex1.toString() + "x^" + onex1pow.toString() + " " + onex2.toString() + "x + " + onec1.toString() + "?"
}
else if (onex2pow == 1 && onex2 < 0 && onec1 < 0){
question1 = "1. What is the first derivative of the curve y = " + onex1.toString() + "x^" + onex1pow.toString() + " " + onex2.toString() + "x " + onec1.toString() + "?"
}
else if (onex2 > 0 && onec1 > 0) {
question1 = "1. What is the first derivative of the curve y = " + onex1.toString() + "x^" + onex1pow.toString() + " + " + onex2.toString() + "x^" + onex2pow.toString() + " + " + onec1.toString() + "?"
}
else if (onex2 < 0 && onec1 > 0) {
question1 = "1. What is the first derivative of the curve y = " + onex1.toString() + "x^" + onex1pow.toString() + " " + onex2.toString() + "x^" + onex2pow.toString() + " + " + onec1.toString() + "?"
}
else if (onex2 < 0 && onec1 < 0) {
question1 = "1. What is the first derivative of the curve y = " + onex1.toString() + "x^" + onex1pow.toString() + " " + onex2.toString() + "x^" + onex2pow.toString() + " " + onec1.toString() + "?"
}
//Question2
//Define Variables
var twox1, twox2, twoc1
//Assigns Random Integers
do {
twox1 = Math.floor(Math.random()*11) - Math.floor(Math.random()*11);
twox2 = Math.floor(Math.random()*11) - Math.floor(Math.random()*11);
twoc1 = Math.floor(Math.random()*11) - Math.floor(Math.random()*11);
}
while (twox1 == 1 || twox2 == 1 || twox1 == -1 || twox2 == -1 || twox1 == 0 || twox2 == 0 || twoc1 == 0);
//find max/min
twocrit = -twox2/(2*twox1);
//Answer Choices
//Correct Answer
if (twox1 > 0) {
twocorrectanswer = twocrit.toFixed(3).replace(/\.?0+$/,"").toString() + ", min"
}
else {
twocorrectanswer = twocrit.toFixed(3).replace(/\.?0+$/,"").toString() + ", max"
}
//Answer1
if (twox1 < 0) {
twoanswer1 = twocrit.toFixed(3).replace(/\.?0+$/,"").toString() + ", min"
}
else {
twoanswer1 = twocrit.toFixed(3).replace(/\.?0+$/,"").toString() + ", max"
}
//Answer2
if (twox1 < 0) {
twoanswer2 = (-twocrit).toFixed(3).replace(/\.?0+$/,"").toString() + ", min"
}
else {
twoanswer2 = (-twocrit).toFixed(3).replace(/\.?0+$/,"").toString() + ", max"
}
//Answer3
if (twox1 > 0) {
twoanswer3 = (-twocrit).toFixed(3).replace(/\.?0+$/,"").toString() + ", min"
}
else {
twoanswer3 = (-twocrit).toFixed(3).replace(/\.?0+$/,"").toString() + ", max"
}
//Place Answer Choices into Array
twoanswerchoices = [twoanswer1, twoanswer2, twoanswer3, twocorrectanswer];
//Randomize Answer Choices
do {
var indexa = Math.floor(Math.random()*twoanswerchoices.length);
var indexb = Math.floor(Math.random()*twoanswerchoices.length);
}
while (indexb == indexa);
do {
var indexc = Math.floor(Math.random()*twoanswerchoices.length);
}
while (indexc == indexa || indexc == indexb);
do {
var indexd = Math.floor(Math.random()*twoanswerchoices.length);
}
while (indexd == indexa || indexd == indexb ||
indexd == indexc);
twoa = twoanswerchoices[indexa];
twob = twoanswerchoices[indexb];
twoc = twoanswerchoices[indexc];
twod = twoanswerchoices[indexd];
if (indexa == 3) {
twocorrectchoice = "a"
}
if (indexb == 3) {
twocorrectchoice = "b"
}
if (indexc == 3) {
twocorrectchoice = "c"
}
if (indexd == 3) {
twocorrectchoice = "d"
}
//Question 2 Question
if (twox2 > 0 && twoc1 > 0) {
question2 = "2. Find the minimum or maximum of y=" + twox1.toString() + "x^2+" + twox2.toString() + "x+" + twoc1.toString() + " and identify if the function has a minimum or maximum."
}
else if (twox2 < 0 && twoc1 > 0)
question2 = "2. Find the minimum or maximum of y=" + twox1.toString() + "x^2" + twox2.toString() + "x+" + twoc1.toString() + " and identify if the function has a minimum or maximum."
else if (twox2 < 0 && twoc1 < 0)
question2 = "2. Find the minimum or maximum of y=" + twox1.toString() + "x^2" + twox2.toString() + "x" + twoc1.toString() + " and identify if the function has a minimum or maximum."
else {
question2 = "2. Find the minimum or maximum of y=" + twox1.toString() + "x^2+" + twox2.toString() + "x" + twoc1.toString() + " and identify if the function has a minimum or maximum."
}
//Question3
//define variables
var threec1, threexpow1, threeypow1
//Assign Random Integers
do {
threec1 = Math.floor(Math.random()*11+1)
}
while (threec1 == 0 || threec1 == 1 || threec1 == -1);
do {
threexpow1 = Math.floor(Math.random()*6+2)
threeypow1 = Math.floor(Math.random()*6+2)
}
while (threexpow1 == threeypow1)
//Answer Choices
//Correct Answer
threecorrectanswer = (threexpow1*threec1).toString() + " * x^" + (threexpow1-1).toString() + " * y^" + threeypow1.toString();
threeanswer1 = (threexpow1*threec1).toString() + " * x^" + (threexpow1).toString() + " * y^" + threeypow1.toString();
threeanswer2 = (threexpow1*threec1*threeypow1).toString() + " * x^" + (threexpow1-1).toString() + " * y^" + (threeypow1-1).toString();
threeanswer3 = (threec1).toString() + " * x^" + (threexpow1-1).toString() + " * y^" + threeypow1.toString();
//Place Answer Choices into Array
threeanswerchoices = [threeanswer1, threeanswer2, threeanswer3, threecorrectanswer];
//Randomize Answer Choices
do {
var indexa = Math.floor(Math.random()*threeanswerchoices.length);
var indexb = Math.floor(Math.random()*threeanswerchoices.length);
}
while (indexb == indexa);
do {
var indexc = Math.floor(Math.random()*threeanswerchoices.length);
}
while (indexc == indexa || indexc == indexb);
do {
var indexd = Math.floor(Math.random()*threeanswerchoices.length);
}
while (indexd == indexa || indexd == indexb ||
indexd == indexc);
threea = threeanswerchoices[indexa];
threeb = threeanswerchoices[indexb];
threec = threeanswerchoices[indexc];
threed = threeanswerchoices[indexd];
if (indexa == 3) {
threecorrectchoice = "a"
}
if (indexb == 3) {
threecorrectchoice = "b"
}
if (indexc == 3) {
threecorrectchoice = "c"
}
if (indexd == 3) {
threecorrectchoice = "d"
}
//Question 3 Question
question3 = "3. Find the partial derivative with respect to x of z = " + threec1.toString() + " * x^" + threexpow1.toString() + " * y^" + threeypow1.toString();
//Qestion4
//define variables
var fourc1, fourc2, fourpow
//Assign Random Integers
fourc1 = Math.floor(Math.random()*11+2);
fourc2 = Math.floor(Math.random()*11+2);
fourpow = Math.floor(Math.random()*6+2);
//Answer Choices
fourcorrectanswer = fourc1.toString() + "/" + fourc2.toString();
fouranswer1 = undefined;
fouranswer2 = 0;
fouranswer3 = fourc2.toString() + "/" + fourc1.toString();
//Place Answer Choices into Array
fouranswerchoices = [fouranswer1, fouranswer2, fouranswer3, fourcorrectanswer];
//Randomize Answer Choices
do {
var indexa = Math.floor(Math.random()*fouranswerchoices.length);
var indexb = Math.floor(Math.random()*fouranswerchoices.length);
}
while (indexb == indexa);
do {
var indexc = Math.floor(Math.random()*fouranswerchoices.length);
}
while (indexc == indexa || indexc == indexb);
do {
var indexd = Math.floor(Math.random()*fouranswerchoices.length);
}
while (indexd == indexa || indexd == indexb ||
indexd == indexc);
foura = fouranswerchoices[indexa];
fourb = fouranswerchoices[indexb];
fourc = fouranswerchoices[indexc];
fourd = fouranswerchoices[indexd];
if (indexa == 3) {
fourcorrectchoice = "a"
}
if (indexb == 3) {
fourcorrectchoice = "b"
}
if (indexc == 3) {
fourcorrectchoice = "c"
}
if (indexd == 3) {
fourcorrectchoice = "d"
}
//Qeustion 4 Question
question4 = "4. Find the limit as x approaches 0 of (" + fourc1.toString() + "x^" + fourpow.toString() + ")/(" + fourc2.toString() + "x^" + fourpow.toString() + ")"
//Question5
//define variables
var fivec1, fivepow1, fivec2, fivelim1, fivelim2
//Get Random Integers
do {
fivec1 = Math.floor(Math.random()*11) - Math.floor(Math.random()*11);
fivec2 = Math.floor(Math.random()*11) - Math.floor(Math.random()*11);
}
while (fivec1 == 1 || fivec2 == 1 || fivec1 == 0 || fivec2 == 0 || fivec1 == -1 || fivec2 == -1);
fivepow1 = Math.floor(Math.random()*6+2);
do {
fivelim1 = Math.floor(Math.random()*11) - Math.floor(Math.random()*11);
fivelim2 = Math.floor(Math.random()*11) - Math.floor(Math.random()*11);
}
while (fivelim1 < fivelim2);
//Answer Choices
fivecorrectanswer = ((((fivec1/(fivepow1+1))*Math.pow(fivelim1,fivepow1+1))+(fivec2*fivelim1))-(((fivec1/(fivepow1+1))*Math.pow(fivelim2,fivepow1+1))+(fivec2*fivelim2))).toFixed(3).replace(/\.?0+$/,"").toString();
fiveanswer1 = ((((fivec1/(fivepow1))*Math.pow(fivelim1,fivepow1))+(fivec2*fivelim1))-(((fivec1/(fivepow1))*Math.pow(fivelim2,fivepow1))+(fivec2*fivelim2))).toFixed(3).replace(/\.?0+$/,"").toString();
fiveanswer2 = (((fivec1*Math.pow(fivelim1,fivepow1+1))+(fivec2*fivelim1))-((fivec1*Math.pow(fivelim2,fivepow1+1))+(fivec2*fivelim2))).toFixed(3).replace(/\.?0+$/,"").toString();
fiveanswer3 = ((((fivec1/(fivepow1-1))*Math.pow(fivelim1,fivepow1-1))+(fivec2*fivelim1))-(((fivec1/(fivepow1-1))*Math.pow(fivelim2,fivepow1-1))+(fivec2*fivelim2))).toFixed(3).replace(/\.?0+$/,"").toString();
//Place Answers into Array
fiveanswerchoices = [fiveanswer1, fiveanswer2,fiveanswer3, fivecorrectanswer];
//Randomize Answer Choices
do {
var indexa = Math.floor(Math.random()*fiveanswerchoices.length);
var indexb = Math.floor(Math.random()*fiveanswerchoices.length);
}
while (indexb == indexa);
do {
var indexc = Math.floor(Math.random()*fiveanswerchoices.length);
}
while (indexc == indexa || indexc == indexb);
do {
var indexd = Math.floor(Math.random()*fiveanswerchoices.length);
}
while (indexd == indexa || indexd == indexb ||
indexd == indexc);
fivea = fiveanswerchoices[indexa];
fiveb = fiveanswerchoices[indexb];
fivec = fiveanswerchoices[indexc];
fived = fiveanswerchoices[indexd];
if (indexa == 3) {
fivecorrectchoice = "a"
}
if (indexb == 3) {
fivecorrectchoice = "b"
}
if (indexc == 3) {
fivecorrectchoice = "c"
}
if (indexd == 3) {
fivecorrectchoice = "d"
}
//Question 5 Question
if (fivec2 > 0){
question5 = "5. Find the area under the curve of y =" + fivec1.toString() + "x^" + fivepow1.toString() + "+" + fivec2.toString() + " between x=" + fivelim2.toString() + " and x=" + fivelim1.toString();
}
else {
question5 = "5. Find the area under the curve of y =" + fivec1.toString() + "x^" + fivepow1.toString() + fivec2.toString() + " between x=" + fivelim2.toString() + " and x=" + fivelim1.toString();
}
//Question Slides
const myQuestions = [
{
question: question1,
answers: {
a: onea,
b: oneb,
c: onec,
d: oned
},
correctAnswer: onecorrectchoice
},
{
question: question2,
answers: {
a: twoa,
b: twob,
c: twoc,
d: twod
},
correctAnswer: twocorrectchoice
},
{
question: question3,
answers: {
a: threea,
b: threeb,
c: threec,
d: threed
},
correctAnswer: threecorrectchoice
},
{
question: question4,
answers: {
a: foura,
b: fourb,
c: fourc,
d: fourd
},
correctAnswer: fourcorrectchoice
},
{
question: question5,
answers: {
a: fivea,
b: fiveb,
c: fivec,
d: fived
},
correctAnswer: fivecorrectchoice
}
];
function buildQuiz() {
// we'll need a place to store the HTML output
const output = [];
// for each question...
myQuestions.forEach((currentQuestion, questionNumber) => {
// we'll want to store the list of answer choices
const answers = [];
// and for each available answer...
for (letter in currentQuestion.answers) {
// ...add an HTML radio button
answers.push(
``
);
}
// add this question and its answers to the output
output.push(
`
${currentQuestion.question}
${answers.join("")}
`
);
});
// finally combine our output list into one string of HTML and put it on the page
quizContainer.innerHTML = output.join("");
}
function showResults() {
// gather answer containers from our quiz
const answerContainers = quizContainer.querySelectorAll(".answers");
// keep track of user's answers
let numCorrect = 0;
// for each question...
myQuestions.forEach((currentQuestion, questionNumber) => {
// find selected answer
const answerContainer = answerContainers[questionNumber];
const selector = `input[name=question${questionNumber}]:checked`;
const userAnswer = (answerContainer.querySelector(selector) || {}).value;
// if answer is correct
if (userAnswer === currentQuestion.correctAnswer) {
// add to the number of correct answers
numCorrect++;
// color the answers green
answerContainers[questionNumber].style.color = "green";
} else {
// if answer is wrong or blank
// color the answers red
answerContainers[questionNumber].style.color = "red";
}
});
// show number of correct answers out of total
resultsContainer.innerHTML = `${numCorrect} out of ${myQuestions.length}`;
}
function showSlide(n) {
slides[currentSlide].classList.remove("active-slide");
slides[n].classList.add("active-slide");
currentSlide = n;
if (currentSlide === 0) {
previousButton.style.display = "none";
} else {
previousButton.style.display = "inline-block";
}
if (currentSlide === slides.length - 1) {
nextButton.style.display = "none";
submitButton.style.display = "inline-block";
} else {
nextButton.style.display = "inline-block";
submitButton.style.display = "inine-block";
}
}
function showNextSlide() {
showSlide(currentSlide + 1);
}
function showPreviousSlide() {
showSlide(currentSlide - 1);
}
const quizContainer = document.getElementById("quiz");
const resultsContainer = document.getElementById("results");
const submitButton = document.getElementById("submit");
// display quiz right away
buildQuiz();
const previousButton = document.getElementById("previous");
const nextButton = document.getElementById("next");
const slides = document.querySelectorAll(".slide");
let currentSlide = 0;
showSlide(0);
// on submit, show results
submitButton.addEventListener("click", showResults);
previousButton.addEventListener("click", showPreviousSlide);
nextButton.addEventListener("click", showNextSlide);
Advertisements
error: Content is protected !!
Cookie Consent
We use cookies to improve your experience on our site. By using our site, you consent to cookies.
Registers a unique ID on mobile devices to enable tracking based on geographical GPS location.
1 day
VISITOR_INFO1_LIVE
Tries to estimate the users' bandwidth on pages with integrated YouTube videos. Also used for marketing
179 days
PREF
This cookie stores your preferences and other information, in particular preferred language, how many search results you wish to be shown on your page, and whether or not you wish to have Google’s SafeSearch filter turned on.
10 years from set/ update
YSC
Registers a unique ID to keep statistics of what videos from YouTube the user has seen.
Session
DEVICE_INFO
Used to detect if the visitor has accepted the marketing category in the cookie banner. This cookie is necessary for GDPR-compliance of the website.
179 days
LOGIN_INFO
This cookie is used to play YouTube videos embedded on the website.