Skip to main content

Quiz 2.7: Code highlighting

Question 1

Which keyword declares a constant in this JavaScript, next to the inline const and let?

// Count the concerts
const total = concerts.length;
let label = `Total: ${total}`;
console.log(label, 42, true);
Show correct answer

const

Question 2

What does this Java method return for func(2, 5)?

public static int func(int a, int b) {
return a > b ? a : b;
}
Show correct answer

5

Question 3

What would you rename this function to if you named it well/better (more semantically) than func?

public static int func(int a, int b) {
return a > b ? a : b;
}
Show correct answer

max

Question 4

Which setting does this YAML file turn on?

# course settings
quiz:
locale: en
shuffleAnswers: true
maxAttempts: 0
Show correct answer

shuffleAnswers

Question 5

Which element is the parent of <item> in this XML?

<manifest identifier="demo">
<resources>
<item id="1" type="quiz">Quiz 2.7</item>
</resources>
</manifest>
Show correct answer

<resources>

Question 6

Which option is valid code?

Show correct answer

This one:

const answer = () => "yes";