Skip to content

Commit ff06fea

Browse files
author
Anass Rach
committed
Fix formatting issues!
1 parent 20c95bd commit ff06fea

1 file changed

Lines changed: 25 additions & 27 deletions

File tree

java21-quiz.html

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -591,23 +591,23 @@ <h2>Quiz Complete!</h2>
591591
},
592592
{
593593
question: "Given the following family hierarchy and variable declarations, which statements compile without error?",
594-
code: "import java.util.*;\\n" +
595-
"class Grandparent {}\\n" +
596-
"class Parent extends Grandparent {}\\n" +
597-
"class Child extends Parent {}\\n" +
598-
"class Family {\\n" +
599-
" List?\u0020super\u0020Grandparent> ancestors = null;\\n" +
600-
" List?\u0020extends\u0020Child> descendants = null;\\n" +
594+
code: "import java.util.*;\n" +
595+
"class Grandparent {}\n" +
596+
"class Parent extends Grandparent {}\n" +
597+
"class Child extends Parent {}\n" +
598+
"class Family {\n" +
599+
" List&lt;? super Grandparent&gt; ancestors = null;\n" +
600+
" List&lt;? extends Child&gt; descendants = null;\n" +
601601
"}",
602602
options: [
603-
"ancestors.add(new Grandparent()); ancestors.add(new Parent()); ancestors.add(new Child());",
604-
"descendants.add(new Child()); descendants.add(new Parent());",
605-
"Grandparent g = ancestors.get(0);",
606-
"Parent p = ancestors.get(0);",
607-
"Child c = descendants.get(0);"
603+
"ancestors.add(new Grandparent()); ancestors.add(new Parent()); ancestors.add(new Child());",
604+
"descendants.add(new Child()); descendants.add(new Parent());",
605+
"Grandparent g = ancestors.get(0);",
606+
"Parent p = ancestors.get(0);",
607+
"Child c = descendants.get(0);"
608608
],
609609
correct: 0,
610-
explanation: "For List?\u0020super\u0020Grandparent> you can add Grandparent or any subclass. For List?\u0020extends\u0020Child> you cannot add anything except null. The return type of get() cannot be assumed without casting, so assignments to specific types other than Object are compilation errors. Option 0 compiles fully; the others do not."
610+
explanation: "For List&lt;? super Grandparent&gt; you can add Grandparent or any subclass. For List&lt;? extends Child&gt; you cannot add anything except null. The return type of get() cannot be assumed without casting, so assignments to specific types other than Object are compilation errors. Option 0 compiles fully; the others do not."
611611
},
612612
{
613613
question: "Which sequence prints in a for-loop with initialization side-effect?",
@@ -681,25 +681,23 @@ <h2>Quiz Complete!</h2>
681681
explanation: "In bottom-up migration, you begin by converting the module with the fewest dependencies into a named module. Other JARs stay on the classpath initially. This avoids breaking the build and allows gradual migration."
682682
},
683683
{
684-
question: "Which substring is extracted from a text block with escaped newline?",
684+
question: "Which substring is extracted from this short text block?",
685685
code: "public class Family {\n" +
686-
" public static void main(String[] args) {\n" +
687-
" String familyMessage = \"\"\"\n" +
688-
" Hello! You inherited a fortune \\\n" +
689-
" from your grandma!\n" +
690-
" \"\"\";\n" +
691-
" String part = familyMessage.substring(7, 15);\n" +
692-
" System.out.println(part);\n" +
693-
" }\n" +
694-
"}",
695-
options: ["inherited", "Hello! Yo", "You inher", "fortune"],
686+
" public static void main(String[] args) {\n" +
687+
" String familyMessage = \"\"\"\n" +
688+
"Hello! \n" +
689+
"Son\n" +
690+
"\"\"\";\n" +
691+
" String part = familyMessage.substring(7, 9);\n" +
692+
" System.out.println(part);\n" +
693+
" }\n" +
694+
"}",
695+
options: ["So", "on", "\n S", "Son"],
696696
correct: 0,
697-
explanation: "The backslash escapes the newline, text block is single line. Substring(7,15) → 'inherited'."
697+
explanation: "The text block contains 'Hello! \\nSon'. Substring(7, 9) extracts characters at indexes 7 and 8: 'S' + 'o' = 'So'."
698698
}
699-
700699
];
701700

702-
703701
var currentQuestionIndex = 0;
704702
var score = 0;
705703
var selectedAnswer = null;

0 commit comments

Comments
 (0)