0% found this document useful (1 vote)
34 views

Ap CSP MCQ

ap csp mcqs available for u

Uploaded by

19082019j
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
34 views

Ap CSP MCQ

ap csp mcqs available for u

Uploaded by

19082019j
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

//added button to easter egg screen that changes

var result1 = 0;
var result2 = 0;
var result3 = 0;
var result4 = 0;

setScreen("homeScreen");
setUpTheQuiz();

function questionOne(userAnswer){
1 // 1
1️⃣
if(userAnswer == "a"){
result1 += 1;
} else if(userAnswer == "b" ) {
result2 +=1;
} else if (userAnswer == "c") {
result3 +=1;
} else {
result4 +=1;
}

// Code a set of conditionals to categorize answers based on which button the


user clicks.
// The variable userAnswer will contain a 1 letter string associated with the
// choice that the user made: "a", "b", "c", or "d".

setScreen("questionTwoScreen");
}
function questionTwo(userAnswer){
1 // 1
1️⃣
if(userAnswer == "a"){
result1 += 1;
} else if(userAnswer == "b" ) {
result2 +=1;
} else if (userAnswer == "c") {
result3 +=1;
} else {
result4 +=1;
}

setScreen("questionThreeScreen");
}

function questionThree(userAnswer){
1 // 1
1️⃣
if(userAnswer == "a"){
result1 += 1;
} else if(userAnswer == "b" ) {
result2 +=1;
} else if (userAnswer == "c") {
result3 +=1;
} else {
result4 +=1;
}

console.log(result2);
setScreen("resultsScreen");
finalResults();
}

function finalResults(){
if (result1 >= 2) {
displayAnswer1();
} else if (result2 >= 2) {
displayAnswer2();
} else if (result3 >= 2) {
displayAnswer3();
} else if (result4 >= 2) {
displayAnswer4();
} else {
displayEasterEgg();
}

2️⃣
//
// Create the conditional statement that compares the values within each category
variable.
// Display the proper answer on the results page associated with the most common
category chosen.

3️⃣
//
// Create an "Easter Egg" conditional that will display a special result if the
user
// clicks a specific set of choices.

function setUpTheQuiz(){

4️⃣
//
// Customize the quiz to make it your own!

// Main quiz subject / question


setProperty("quizSubjectTextbox", "text", "If you were a superhero, and also a
vegetable, what might you be?");

// Each question has question text, 4 answer responses, and 4 associated images
to display. Customize your own quiz!
// Question 1
setProperty("question1", "text", "What is your favorite texture?");
setProperty("answer1a", "text", "Velvety Smooth");
setProperty("answer1b", "text", "Rough and Tumble");
setProperty("answer1c", "text", "Itch-tastic");
setProperty("answer1d", "text", "Bumpy and bulbous");
setProperty("image1a", "image",
"//images.code.org/6886e5aa15bf6f4f912ce92297318bb2-velvet.png");
setProperty("image1b", "image",
"//images.code.org/48f878eb0e4711e2c94520e428e662ee-rough.png");
setProperty("image1c", "image",
"//images.code.org/aede40113f1545db507e1365551b0af8-itchy.png");
setProperty("image1d", "image",
"//images.code.org/1cd3783d932b2a572b7586b8b7ddf9dd-bumpy.png");

// Question 2
setProperty("question2", "text", "What is your favorite flavor?");
setProperty("answer2a", "text", "Buttery");
setProperty("answer2b", "text", "Sweet");
setProperty("answer2c", "text", "Savory");
setProperty("answer2d", "text", "Salty");
setProperty("image2a", "image",
"//images.code.org/dd6f2d13224c20505fd223875f92bc96-buttery.png");
setProperty("image2b", "image",
"//images.code.org/97ad25b9ce37a1516da388a14ada1a63-sweet.png");
setProperty("image2c", "image",
"//images.code.org/11ac94f610c403433f1d74bd875d4bb6-savory.png");
setProperty("image2d", "image",
"//images.code.org/25f69aed5df8759eb97d9f543b7bb0e5-salty.png");

// Question 3
setProperty("question3", "text", "If you were a car, which one would you be?");
setProperty("answer3a", "text", "El Camino");
setProperty("answer3b", "text", "Box Truck");
setProperty("answer3c", "text", "Lamborghini");
setProperty("answer3d", "text", "Ford Pinto");
setProperty("image3a", "image",
"//images.code.org/fbb9692c9afcae1e8e80378b156a4d2f-elCamino2.png");
setProperty("image3b", "image",
"//images.code.org/448d5a0315f9017fcdc6c9812f66fd69-boxTruck.png");
setProperty("image3c", "image",
"//images.code.org/f5b84513fb9866aedcf5c1a50ea24039-lambo.png");
setProperty("image3d", "image",
"//images.code.org/90f9e80c7cf95dcecf6d1a4bc7f56166-elCamino.png");

function displayAnswer1(){
setProperty("resultsTextOne", "text", "You are Kernelator!");
setProperty("resultsTextTwo", "text", "Armed with the astonishing power of Rapid
Replication, Kernelator can create countless copies of themselves to form a mighty
maize army. This cob combatant tirelessly defends the world from chaos, popping up
wherever injustice rears its head.");
setProperty("resultsImage", "image",
"//images.code.org/c916747b277225eef22224346a433872-final1.png");
}

function displayAnswer2(){
setProperty("resultsTextOne", "text", "You are Tomatitán!");
setProperty("resultsTextTwo", "text", "Possessing the extraordinary power of
Antioxidant Aura, Tomatitán can neutralize harmful free radicals in the
environment, protecting both humans and nature from unseen dangers. This juicy
juggernaut fearlessly squashes all threats, keeping the world fresh and safe.");
setProperty("resultsImage", "image",
"//images.code.org/bae14bf60beacf37b7a8bcdecbdb187a-final4.png");
}

function displayAnswer3(){
setProperty("resultsTextOne", "text", "You are Carrotron!");
setProperty("resultsTextTwo", "text", "Wielding the incredible power of Vitamin
Infusion, Carrotron can rejuvenate and heal those around them, spreading health and
vitality with just a touch. This crunchy crusader always roots out evil and
nourishes justice.");
setProperty("resultsImage", "image",
"//images.code.org/4b4abeca6a233cd5dae00180aa851ca6-final2.png");
}

function displayAnswer4(){
setProperty("resultsTextOne", "text", "You are Brocca!");
setProperty("resultsTextTwo", "text", "From the fabled Garden of Greens, Brocca
can instantly boost the strength and abilities of allies by sharing their nutrient-
rich essence. This floret fighter steams evildoers with ease.");
setProperty("resultsImage", "image",
"//images.code.org/4105de514533553a452a7409f5f75c51-final3.png");
}

function displayEasterEgg(){
setProperty("easterbutton", "hidden", false);
setProperty("resultsTextOne", "text", "EASTER EGG FOUND!");
setProperty("resultsTextTwo", "text", "The Winter Egg was created by the Russian
jeweler Peter Carl Fabergé in 1913 for Tsar Nicholas II. The egg is made of rock
crystal, platinum, and diamonds, and features a white enamel exterior with
intricate diamond-studded patterns resembling frost and snowflakes.");
setProperty("resultsImage", "image",
"//images.code.org/a8c0f0c0eb35184fe5a519ac1eb73a20-easterEgg.png");
}

onEvent("easterbutton","click", function(){
setProperty("image2", "image",
"https://www.shutterstock.com/shutterstock/photos/110202812/display_1500/stock-
vector-emoticon-with-big-toothy-smile-110202812.jpg");
setProperty("image2", "hidden", false);
});

// Start the quiz button


onEvent("startButton", "click", function( ) {
setScreen("questionOneScreen");
});

// Reset the quiz button


onEvent("resetQuizButton", "click", function( ) {
result1 = 0;
result2 = 0;
result3 = 0;
result4 = 0;
setScreen("homeScreen");
});

// Event Handlers for button clicks


// Question 1
onEvent("button1a", "click", function( ) {
questionOne("a");
});

onEvent("button1b", "click", function( ) {


questionOne("b");
});

onEvent("button1c", "click", function( ) {


questionOne("c");
});

onEvent("button1d", "click", function( ) {


questionOne("d");
});

// Question 2
onEvent("button2a", "click", function( ) {
questionTwo("a");
});

onEvent("button2b", "click", function( ) {


questionTwo("b");
});

onEvent("button2c", "click", function( ) {


questionTwo("c");
});

onEvent("button2d", "click", function( ) {


questionTwo("d");
});

// Question 3
onEvent("button3a", "click", function( ) {
questionThree("a");
});

onEvent("button3b", "click", function( ) {


questionThree("b");
});

onEvent("button3c", "click", function( ) {


questionThree("c");
});

onEvent("button3d", "click", function( ) {


questionThree("d");
});

You might also like