|
| 1 | +<script> |
| 2 | + |
| 3 | +var questions = [ |
| 4 | + |
| 5 | + {id:1, query:"Which of the following describes the most ideal type of activity to automate with UiPath?", "answer":"test-answer.md", |
| 6 | + options:[ |
| 7 | + {option:"Multistep process with many decision points with structured data", correct:false, selected:false}, |
| 8 | + {option:"Perform Analysis on data and provide", correct:true, selected:false}, |
| 9 | + {option:"Varied tasks that rely heavily on user input", correct:false, selected:false}, |
| 10 | + {option:"Rule-based process with structured data", correct:false, selected:false} |
| 11 | + ], |
| 12 | + "objectives":[ |
| 13 | + "1.1", |
| 14 | + "2.2" |
| 15 | + ]}, |
| 16 | + |
| 17 | + {query:"A client receives a spreadsheet containing orders. The orders must be input into an internal web-based order system. Which is the best activity to use?", |
| 18 | + options:[ |
| 19 | + {option:"Sequence", correct:true, selected:false}, |
| 20 | + {option:"Flowchart", correct:false, selected:false}, |
| 21 | + {option:"Learning Machine", correct:false, selected:false}, |
| 22 | + {option:"Transactional Process", correct:false, selected:false} |
| 23 | + ], |
| 24 | + "objectives":[ |
| 25 | + "1.1", |
| 26 | + "2.2" |
| 27 | + ]}, |
| 28 | + |
| 29 | + |
| 30 | + {query:"Which Activity requires the least amount of parameters?", |
| 31 | + options:[ |
| 32 | + {option:"SMTP", correct:false, selected:false}, |
| 33 | + {option:"Outlook", correct:true, selected:false}, |
| 34 | + {option:"POP3", correct:false, selected:false}, |
| 35 | + {option:"Mail", correct:false, selected:false} |
| 36 | + ], |
| 37 | + "objectives":[ |
| 38 | + "1.1", |
| 39 | + "2.2" |
| 40 | + ]}, |
| 41 | + |
| 42 | + {query:"What happens if you try to save a table using Excel Write Range activity to a file that does not exist?", |
| 43 | + options:[ |
| 44 | + {option:"Throws a “File not found” error", correct:false, selected:false}, |
| 45 | + {option:"Workflow will wait until the file appears and times out if it doesn’t", correct:false, selected:false}, |
| 46 | + {option:"Activity will not run and continue the sequence", correct:false, selected:false}, |
| 47 | + {option:"Creates the file and saves the table", correct:true, selected:false} |
| 48 | + ], |
| 49 | + "objectives":[ |
| 50 | + "1.1", |
| 51 | + "2.2" |
| 52 | + ]}, |
| 53 | + |
| 54 | + {query:"When using an Excel Application Scope activity, which activity should be used to sort a table directly in an .xlsx file?", |
| 55 | + options:[ |
| 56 | + {option:"Sequence", correct:false, selected:false}, |
| 57 | + {option:"Flowchart", correct:false, selected:false}, |
| 58 | + {option:"Learning Machine", correct:false, selected:false}, |
| 59 | + {option:"Transactional Process", correct:true, selected:false} |
| 60 | + ], |
| 61 | + "objectives":[ |
| 62 | + "1.1", |
| 63 | + "2.2" |
| 64 | + ]}, |
| 65 | + |
| 66 | + ]; |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | +//alert(questions[1].options[3].option); |
| 73 | +//alert(questions[1].options[2].correct); |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | +var answers = new Array(questions.length); |
| 79 | +var questionNumber = 0; |
| 80 | +//displayQuestion(0); |
| 81 | + |
| 82 | + |
| 83 | +//alert(person.firstName); |
| 84 | +//alert(questions[0].query); |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | +window.addEventListener('load', function () { |
| 89 | + displayQuestion(0); |
| 90 | + |
| 91 | + document.getElementById("question-jumper").innerHTML; |
| 92 | + |
| 93 | + let buttons = ""; |
| 94 | + for (i = 0; i < questions.length; i++) { |
| 95 | + var aTag = document.createElement('a'); |
| 96 | + |
| 97 | + aTag.setAttribute('onClick','displayQuestion(\''+ i + '\')'); |
| 98 | + aTag.setAttribute('class','btn btn-info mr-2'); |
| 99 | + aTag.setAttribute('id', 'jumpTo'+i); |
| 100 | + aTag.innerHTML = "" + (i+1); |
| 101 | + document.getElementById("question-jumper").append(aTag); |
| 102 | + } |
| 103 | + |
| 104 | + |
| 105 | +}) |
| 106 | + |
| 107 | +navigateQuestions = function(number){ |
| 108 | +console.log('navigateQuestions' + number); |
| 109 | + if(number=='next') { |
| 110 | + number = questionNumber + 1; |
| 111 | + } |
| 112 | + if(number=='previous') { |
| 113 | + number = questionNumber - 1; |
| 114 | + } |
| 115 | + displayQuestion(number); |
| 116 | +} |
| 117 | + |
| 118 | +displayQuestion = function(number){ |
| 119 | + |
| 120 | + console.log("Number to display is " + number); |
| 121 | + //alert(document.getElementById("option0").checked); |
| 122 | + |
| 123 | + questions[questionNumber].options[0].checked = document.getElementById("option0").checked; |
| 124 | + questions[questionNumber].options[1].checked = document.getElementById("option1").checked; |
| 125 | + questions[questionNumber].options[2].checked = document.getElementById("option2").checked; |
| 126 | + questions[questionNumber].options[3].checked = document.getElementById("option3").checked; |
| 127 | + |
| 128 | + questionNumber = number; |
| 129 | + |
| 130 | + questionNumber = parseInt(number, 10); |
| 131 | + |
| 132 | + let questionNumberDisplay = parseInt(number, 10) + 1; |
| 133 | + document.getElementById("questionNumber").innerHTML = "Question " + questionNumberDisplay; |
| 134 | + document.getElementById("query").innerHTML = questions[questionNumber].query; |
| 135 | + document.getElementById("labelOption0").innerHTML = questions[questionNumber].options[0].option; |
| 136 | + document.getElementById("labelOption1").innerHTML = questions[questionNumber].options[1].option; |
| 137 | + document.getElementById("labelOption2").innerHTML = questions[questionNumber].options[2].option; |
| 138 | + document.getElementById("labelOption3").innerHTML = questions[questionNumber].options[3].option; |
| 139 | + |
| 140 | + |
| 141 | + |
| 142 | + document.getElementById("option0").checked = questions[questionNumber].options[0].checked; |
| 143 | + document.getElementById("option1").checked = questions[questionNumber].options[1].checked; |
| 144 | + document.getElementById("option2").checked = questions[questionNumber].options[2].checked; |
| 145 | + document.getElementById("option3").checked = questions[questionNumber].options[3].checked; |
| 146 | + |
| 147 | + |
| 148 | + //var checkedRadioButtons = document.querySelector('input[name="optionRadios"]:checked'); |
| 149 | + //if (checkedRadioButtons!=null) { |
| 150 | + // checkedRadioButtons.checked = false; |
| 151 | + //} |
| 152 | + |
| 153 | + var radios = document.querySelectorAll('input[type="radio"]:checked'); |
| 154 | + var value = radios.length>0? radios[0].value: null; |
| 155 | + |
| 156 | + |
| 157 | + document.getElementById("previous").setAttribute("class", "enabled btn btn-primary"); |
| 158 | + document.getElementById("next").setAttribute("class", "enabled btn btn-primary"); |
| 159 | + if (questionNumber==0) { |
| 160 | + document.getElementById("previous").setAttribute("class", "disabled btn btn-primary"); |
| 161 | + } |
| 162 | + if (questionNumber == (questions.length-1)) { |
| 163 | + document.getElementById("next").setAttribute("class", "disabled btn btn-primary"); |
| 164 | + } |
| 165 | + |
| 166 | +} |
| 167 | + |
| 168 | +gradeExam = function(){ |
| 169 | + |
| 170 | + //Make sure changes on the question they asked for the grade to be there. |
| 171 | + questions[questionNumber].options[0].checked = document.getElementById("option0").checked; |
| 172 | + questions[questionNumber].options[1].checked = document.getElementById("option1").checked; |
| 173 | + questions[questionNumber].options[2].checked = document.getElementById("option2").checked; |
| 174 | + questions[questionNumber].options[3].checked = document.getElementById("option3").checked; |
| 175 | + |
| 176 | + let correctCount = 0; |
| 177 | + for (i = 0; i < questions.length; i++) { |
| 178 | + let correct = true; |
| 179 | + for (j = 0; j < questions[i].options.length; j++) { |
| 180 | + correct = (questions[i].options[j].checked == questions[i].options[j].correct); |
| 181 | + if (correct == false) { |
| 182 | + |
| 183 | + document.getElementById('jumpTo'+i).setAttribute('class', 'btn btn-danger mr-2'); |
| 184 | + break; |
| 185 | + } else { |
| 186 | + document.getElementById('jumpTo'+i).setAttribute('class', 'btn btn-success mr-2'); |
| 187 | + } |
| 188 | + } |
| 189 | + if (correct) {correctCount++} |
| 190 | + } |
| 191 | + //alert(correctCount); |
| 192 | + document.getElementById('score').innerHTML = 'You got ' + correctCount + ' out of ' + questions.length + ' correct.'; |
| 193 | + |
| 194 | +} |
| 195 | + |
| 196 | + |
| 197 | +</script> |
| 198 | + |
| 199 | +<br/><br/> |
| 200 | + |
| 201 | + |
| 202 | +<div class="container"> |
| 203 | + |
| 204 | +<div class="card"> |
| 205 | + <div class="card-header" id="questionNumber"> |
| 206 | + |
| 207 | + </div> |
| 208 | + <div class="card-body"> |
| 209 | + <h3 class="card-title" id="query"></h3> |
| 210 | + |
| 211 | + |
| 212 | + |
| 213 | +<div class="form-check"> |
| 214 | + <input class="form-check-input" type="radio" name="optionRadios" id="option0" value="option0"> |
| 215 | + <label class="form-check-label" for="option0" id="labelOption0"> |
| 216 | + |
| 217 | + </label> |
| 218 | +</div> |
| 219 | +<div class="form-check"> |
| 220 | + <input class="form-check-input" type="radio" name="optionRadios" id="option1" value="option1"> |
| 221 | + <label class="form-check-label" for="option1" id="labelOption1"> |
| 222 | + |
| 223 | + </label> |
| 224 | +</div> |
| 225 | +<div class="form-check"> |
| 226 | + <input class="form-check-input" type="radio" name="optionRadios" id="option2" value="option2"> |
| 227 | + <label class="form-check-label" for="option2" id="labelOption2"> |
| 228 | + |
| 229 | + </label> |
| 230 | +</div> |
| 231 | +<div class="form-check"> |
| 232 | + <input class="form-check-input" type="radio" name="optionRadios" id="option3" value="option3"> |
| 233 | + <label class="form-check-label" for="option3" id="labelOption3"> |
| 234 | + |
| 235 | + </label> |
| 236 | +</div> |
| 237 | +<p class="card-text"> |
| 238 | +<div> |
| 239 | + <a href="#" id="previous" class="btn btn-primary" onclick="navigateQuestions('previous')"><< Previous</a> |
| 240 | + |
| 241 | + <a href="#" id="next" class="btn btn-primary" onclick="navigateQuestions('next')">Next >></a> |
| 242 | + <a href="#" id="finish" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" onclick="gradeExam()">Finish</a> |
| 243 | + </div> |
| 244 | + |
| 245 | +<div> |
| 246 | +</p> |
| 247 | + |
| 248 | + |
| 249 | +</span> |
| 250 | +</div> |
| 251 | + |
| 252 | + |
| 253 | + </div> |
| 254 | +</div> |
| 255 | + |
| 256 | +<div class="card mt-2"> |
| 257 | + <div class="card-header" id="questionJumperTitle"> |
| 258 | + Question Jumper |
| 259 | + </div> |
| 260 | + <div class="card-body"> |
| 261 | + <h3 class="card-title" id="query"></h3> |
| 262 | + <p class="card-text"><small class="text-muted"><span id="question-jumper"></small></p> |
| 263 | + </div> |
| 264 | +</div> |
| 265 | + |
| 266 | + |
| 267 | +</div> |
| 268 | + |
| 269 | +<!-- Modal --> |
| 270 | +<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"> |
| 271 | + <div class="modal-dialog"> |
| 272 | + <div class="modal-content"> |
| 273 | + <div class="modal-header"> |
| 274 | + <h5 class="modal-title" id="exampleModalLabel">Quiz Results</h5> |
| 275 | + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
| 276 | + <span aria-hidden="true">×</span> |
| 277 | + </button> |
| 278 | + </div> |
| 279 | + <div id="score" class="modal-body"> |
| 280 | + |
| 281 | + </div> |
| 282 | + <div class="modal-footer"> |
| 283 | + <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> |
| 284 | + </div> |
| 285 | + </div> |
| 286 | + </div> |
| 287 | +</div> |
0 commit comments