sentences list and print each sentence alongside its vowel count."rhythm" return 0? List all its characters and verify the condition manually."Hello World". Use .isalpha() to ensure you skip spaces.[::-1] as a brilliant shortcut to reverse a list, but understanding how to do it manually — walking backwards using an index — teaches you how array indexing really works under the hood.
i and add it to the new list. Run the code to confirm the output matches.range(4, -1, -1) produces.reverse_string(s) that does the exact same thing for a string. Remember, strings are joined, not appended.[1, 2, 3, 2, 4, 3, 5] step by step on paper — after each item is processed, write down what both the seen and duplicates lists look like.[5, 5, 5, 5] return [5] and not [5, 5, 5]? Which specific part of the if condition prevents it from firing multiple times?15 / 4 give 3.75 and not 3? What specific Python operator would give you a flat 3?%, return the remainder of the division. Test it with calculator(10, '%', 3) — the expected answer is 1.-40 converts to -40 in both directions — verify this by hand using the formula on paper to see the math in action.celsius_to_kelvin(c). The formula for Kelvin is simply the Celsius value plus the constant 273.15. Run a test case ensuring 0°C maps to 273.15K.String.valueOf(ch) to convert characters and then vowels.contains() to check membership safely.
sentence.toCharArray() does for "Hello" — what exact primitive array does it produce?countConsonants(String s) method and print both counts for "Hello World". Use Character.isLetter(ch) to ensure you skip spaces and punctuation.i and the end of the array to populate the result array. Run the code and confirm the output.{1,2,3,4,5} on paper. For each value of i (0 to 4), mathematically prove which element from the original array gets picked.reverseString(String s) that reverses a String using the exact same logic structure, utilizing s.charAt() and a StringBuilder.ArrayList structure and the .contains() method to track items securely as the algorithm scans the array.
.contains() extensively here. What is the fundamental difference between an ArrayList and a primitive int[] array regarding built-in utility methods?ArrayList directly into a System.out.println() statement compared to a primitive array?switch statement targeting a String to handle the logic cleanly, returning a double.
Double.NaN? Look at what Java prints for it and explain in one sentence why using it is safer than allowing an unhandled exception to crash the application.case "%" to the switch block to handle modulus logic. Test with calculate(10, "%", 3) — expected output is 1.0.String.format() heavily in these situations to ensure mathematical outputs map cleanly to a user interface.
9/5, Java will return bad data. Why must you type 9.0 / 5.0 to get the correct output?celsiusToKelvin(double c) method. The formula is simply the Celsius value plus the constant 273.15. Print an output verifying 100°C maps to 373.15K.includes() string method directly against iterable variables for fast validation checks.
for...of loop. How does this iterate over the string compared to a traditional index-based for(let i=0) loop?.split().filter().length..reverse() method, but it possesses a dangerous quirk: it mutates (permanently alters) the original array. To safely use the built-in tool, you must spread the array into an independent copy first. Today, you will write a safe manual loop, and then write the safe modern ES6 one-liner.
[...arr] attached to the built-in JS reverse function. Verify the safety check at the bottom still prints 1,2,3,4,5.arr.reverse() without wrapping it in a spread block? Test it and observe what happens to your final safety check log..split().reverse().join() method chain.arr.indexOf(item) !== index is fundamentally checking against. What exact value does an indexOf call return?["cat","dog","cat","bird","dog"]. Ensure it correctly returns the duplicated strings.b === 0 ? "Error" : a / b. If you translated this ternary operator back into standard code, what would the `if` and `else` branches look like?case '%' to evaluate a modulus request. Test it via calculator(10, '%', 3) — expect an exact return of 1.| id | name | price | category | stock |
|---|---|---|---|---|
| 1 | 'Laptop' | 45000 | 'Electronics' | 10 |
| 2 | 'T-Shirt' | 799 | 'Clothing' | 50 |
| 3 | 'Headphones' | 2500 | 'Electronics' | 30 |
| 4 | 'Jeans' | 1499 | 'Clothing' | 20 |
| 5 | 'Keyboard' | 1800 | 'Electronics' | 15 |
| 6 | 'Jacket' | 3200 | 'Clothing' | 8 |
| name | price |
|---|---|
| Laptop | 45000 |
| Headphones | 2500 |
| Keyboard | 1800 |
| id | name | price | category | stock |
|---|---|---|---|---|
| 2 | T-Shirt | 799 | Clothing | 50 |
| 4 | Jeans | 1499 | Clothing | 20 |
| 5 | Keyboard | 1800 | Electronics | 15 |
| name | price | stock |
|---|---|---|
| T-Shirt | 799 | 50 |
| Jeans | 1499 | 20 |
| Keyboard | 1800 | 15 |
| Headphones | 2500 | 30 |
| Jacket | 3200 | 8 |
| Laptop | 45000 | 10 |
| id | name | price | category | stock |
|---|---|---|---|---|
| 1 | 'Laptop' | 45000 | 'Electronics' | 10 |
| 2 | 'T-Shirt' | 799 | 'Clothing' | 50 |
| 3 | 'Headphones' | 2500 | 'Electronics' | 30 |
| 4 | 'Jeans' | 1499 | 'Clothing' | 20 |
| 5 | 'Keyboard' | 1800 | 'Electronics' | 15 |
| 6 | 'Jacket' | 3200 | 'Clothing' | 8 |
| name | price |
|---|---|
| Laptop | 45000 |
| Jacket | 3200 |
| Headphones | 2500 |
| name | price |
|---|---|
| T-Shirt | 799 |
| Jeans | 1499 |
| name | price |
|---|---|
| Laptop | 45000 |
| Headphones | 2500 |
| Keyboard | 1800 |
| id | name | price | category | stock |
|---|---|---|---|---|
| 1 | 'Laptop' | 45000 | 'Electronics' | 10 |
| 2 | 'T-Shirt' | 799 | 'Clothing' | 50 |
| 3 | 'Headphones' | 2500 | 'Electronics' | 30 |
| 4 | 'Jeans' | 1499 | 'Clothing' | 20 |
| 5 | 'Keyboard' | 1800 | 'Electronics' | 15 |
| 6 | 'Jacket' | 3200 | 'Clothing' | 8 |
| COUNT(*) | SUM(price) | AVG(price) | MAX(price) | MIN(price) |
|---|---|---|---|---|
| 6 | 54798 | 9133.00 | 45000 | 799 |
| COUNT(*) | AVG(price) |
|---|---|
| 3 | 1832.67 |
| id | name | price | category | stock |
|---|---|---|---|---|
| 1 | 'Laptop' | 45000 | 'Electronics' | 10 |
| 2 | 'T-Shirt' | 799 | 'Clothing' | 50 |
| 3 | 'Headphones' | 2500 | 'Electronics' | 30 |
| 4 | 'Jeans' | 1499 | 'Clothing' | 20 |
| 5 | 'Keyboard' | 1800 | 'Electronics' | 15 |
| 6 | 'Jacket' | 3200 | 'Clothing' | 8 |
| category | COUNT(*) | AVG(price) |
|---|---|---|
| Clothing | 3 | 1832.67 |
| Electronics | 3 | 16433.33 |
| category | MAX(price) |
|---|---|
| Clothing | 3200 |
| Electronics | 45000 |
| id | name | price | category | stock |
|---|---|---|---|---|
| 1 | 'Laptop' | 45000 | 'Electronics' | 10 |
| 2 | 'T-Shirt' | 799 | 'Clothing' | 50 |
| 3 | 'Headphones' | 2500 | 'Electronics' | 30 |
| 4 | 'Jeans' | 1499 | 'Clothing' | 20 |
| 5 | 'Keyboard' | 1800 | 'Electronics' | 15 |
| 6 | 'Jacket' | 3200 | 'Clothing' | 8 |
| name | stock |
|---|---|
| Headphones | 30 |
| Keyboard | 15 |
| name | price |
|---|---|
| T-Shirt | 799 |
| Jeans | 1499 |
| Jacket | 3200 |
| name | price | category |
|---|---|---|
| Laptop | 45000 | Electronics |
| T-Shirt | 799 | Clothing |
| Headphones | 2500 | Electronics |
| Keyboard | 1800 | Electronics |