Skip to content

Commit e6d5943

Browse files
fix formatting of questions
1 parent 63bc5b6 commit e6d5943

File tree

2 files changed

+41
-9
lines changed

2 files changed

+41
-9
lines changed

index.html

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@
3030
padding: 1rem;
3131
margin-bottom: 1rem;
3232
}
33+
34+
.structured-block {
35+
white-space: pre-wrap;
36+
font-family: 'Courier New', Courier, monospace;
37+
font-size: 0.95rem;
38+
background-color: #f8f9fa;
39+
border-left: 4px solid #dee2e6;
40+
padding: 0.5rem 1rem;
41+
margin: 1rem 0;
42+
}
3343

3444
/* Mobile optimizations */
3545
@media (max-width: 768px) {
@@ -414,13 +424,35 @@ <h5>${t.term}</h5>
414424
document.getElementById('result-summary').innerHTML = '';
415425
}
416426

427+
function escapeHtml(str) {
428+
return str.replace(/[&<>"']/g, function(m) {
429+
return ({
430+
'&': '&amp;',
431+
'<': '&lt;',
432+
'>': '&gt;',
433+
'"': '&quot;',
434+
"'": '&#39;'
435+
})[m];
436+
});
437+
}
438+
417439
// Format text to handle newlines
418440
function formatText(text) {
419441
if (!text) return '';
420-
// Handle both actual newlines and \n string literals
421-
return text.toString()
422-
.replace(/\\n/g, '\n') // Convert \n string literals to actual newlines
423-
.replace(/\n/g, '<br>'); // Convert all newlines to <br> tags
442+
443+
// Convert string literal '\n' to real newline
444+
text = text.toString().replace(/\\n/g, '\n');
445+
446+
// Detect if the text block looks like a table or test data
447+
const isStructuredBlock = text.includes('|') || text.includes('Input T1') || text.includes('-----------');
448+
449+
if (isStructuredBlock) {
450+
// Preserve whitespace and use monospace font
451+
return `<div class="structured-block">${escapeHtml(text)}</div>`;
452+
}
453+
454+
// Else fallback: replace real newlines with <br>
455+
return text.replace(/\n/g, '<br>');
424456
}
425457

426458
function renderSingleQuestion() {

questions.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,7 @@ window.questions = [
11101110
"c) Visual testing helps find overlapping user interface elements",
11111111
"d) Visual testing fails when the screen layout changes"
11121112
],
1113-
"correct_answer": "A",
1113+
"correct_answer": "C",
11141114
"k_level": "K2",
11151115
"points": "1",
11161116
"justification": {
@@ -2266,7 +2266,7 @@ window.questions = [
22662266
},
22672267
{
22682268
"id": 17,
2269-
"question": "The confusion matrix for an image classifier is shown below.\n\n| Actual Positive | Actual Negative\n--------------------------------------------------\nPredicted Positive | 78 | 22\nPredicted Negative | 6 | 14\n\nWhich of the following options represents the precision of the classifier?",
2269+
"question": "The confusion matrix for an image classifier is shown below.\n\n| Actual Positive | Actual Negative\n--------------------------------------------------\nPredicted Positive | 78 | 22\nPredicted Negative | 6 | 14\n\nWhich of the following options represents the precision of the classifier?",
22702270
"options": {
22712271
"a": "20/120 * 100",
22722272
"b": "78/120 * 100",
@@ -2309,7 +2309,7 @@ window.questions = [
23092309
},
23102310
{
23112311
"id": 29,
2312-
"question": "An AI-based system is being used by the health ministry to identify vulnerable groups of patients, who will be provided with support and advice to help prevent them suffering future illnesses to which they may be susceptible. The results will also be shared with other government agencies \nand medical insurance companies. The system is initially being trained on a large set of data \ncollected by the health ministry from two surveys of 5,000 men over 50 years of age and 25,000 \nwomen over 30 years of age. The system will continue to identify vulnerable patients by gathering \ninformation from publicly available social media. \nWhich of the following attributes should be MOST carefully considered when specifying the \nobjectives and acceptance criteria for the system? Select TWO options.",
2312+
"question": "An AI-based system is being used by the health ministry to identify vulnerable groups of patients, who will be provided with support and advice to help prevent them suffering future illnesses to which they may be susceptible. The results will also be shared with other government agencies and medical insurance companies. The system is initially being trained on a large set of data collected by the health ministry from two surveys of 5,000 men over 50 years of age and 25,000 women over 30 years of age. The system will continue to identify vulnerable patients by gathering information from publicly available social media. Which of the following attributes should be MOST carefully considered when specifying the objectives and acceptance criteria for the system? Select TWO options.",
23132313
"options": {
23142314
"a": "Adaptability",
23152315
"b": "Bias",
@@ -2332,7 +2332,7 @@ window.questions = [
23322332
},
23332333
{
23342334
"id": 33,
2335-
"question": "An AI-based mobile phone search system provides a list of phones that it believes are most suitable for the user based on its knowledge of the user's previous mobile phone usage and their specified preferences.\n\nGiven that metamorphic testing is being used with the following source test case:\n\nInputs | Outputs\n--------------------------------------------------------------\nSelected price range: $200–$300 | Recommended Phones:\n3D camera: Don’t care | SnapHappy_X1\nScreen size: mid to large | SnapHappy_M2\nOS: Android or iOS | SnapHappy_M3\nBattery Life: Don’t care | ClickNow_1000x\n | ClickNow_1000xs\n\nAnd this test data for two corresponding follow-up test cases:\n\nInput T1\n-----------\nSelected price range: $200–$300\n3D camera: yes\nScreen size: mid to large\nOS: Android or iOS\nBattery Life: Don’t care\n\nInput T2\n-----------\nSelected price range: $200–$300\n3D camera: no\nScreen size: mid to large\nOS: Android or iOS\nBattery Life: Don’t care\n\nWhich of the following options is MOST likely to be a valid list of recommended phones for the follow-up test cases?",
2335+
"question": "An AI-based mobile phone search system provides a list of phones that it believes are most suitable for the user based on its knowledge of the user's previous mobile phone usage and their specified preferences.\n\nGiven that metamorphic testing is being used with the following source test case:\n\nInputs | Outputs\n--------------------------------------------------------------\nSelected price range: $200–$300 | Recommended Phones:\n3D camera: Don’t care | SnapHappy_X1\nScreen size: mid to large | SnapHappy_M2\nOS: Android or iOS | SnapHappy_M3\nBattery Life: Don’t care | ClickNow_1000x\n | ClickNow_1000xs\n\nAnd this test data for two corresponding follow-up test cases:\n\nInput T1\n-----------\nSelected price range: $200–$300\n3D camera: yes\nScreen size: mid to large\nOS: Android or iOS\nBattery Life: Don’t care\n\nInput T2\n-----------\nSelected price range: $200–$300\n3D camera: no\nScreen size: mid to large\nOS: Android or iOS\nBattery Life: Don’t care\n\nWhich of the following options is MOST likely to be a valid list of recommended phones for the follow-up test cases?",
23362336
"options": {
23372337
"a": "T1: SnapHappy_X1, SnapHappy_M2 \n T2: ClickNow_1000x, ClickNow_1000xs",
23382338
"b": "T1: SnapHappy_M2, SnapHappy_M3, ClickNow_1000x, ClickNow_1000xs \n T2: SnapHappy_X1, ClickNow_1000x",
@@ -2351,7 +2351,7 @@ window.questions = [
23512351
},
23522352
{
23532353
"id": 35,
2354-
"question": "LAIgal systems has an AI-based product for extracting relevant favorable judgements similar to a \ngiven legal case. This product is used by judges in the courts. Details of the current case are \nprovided, and the system produces relevant judgements. The system needs to be safe from \nmalicious inputs. A similar open-source product exists and is available. Not having a suitable test \noracle is a challenge when testing. \nWhich of the following test techniques should be selected to test the new version during system \ntesting? Select TWO options.",
2354+
"question": "LAIgal systems has an AI-based product for extracting relevant favorable judgements similar to a given legal case. This product is used by judges in the courts. Details of the current case are provided, and the system produces relevant judgements. The system needs to be safe from malicious inputs. A similar open-source product exists and is available. Not having a suitable test oracle is a challenge when testing. Which of the following test techniques should be selected to test the new version during system testing? Select TWO options.",
23552355
"options": {
23562356
"a": "A/B testing",
23572357
"b": "Back-to-back testing",

0 commit comments

Comments
 (0)