Challenge - 5 Problems
Parsing Pro
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 code output
intermediate2:00remaining
What is the output of parsing a valid integer string?
Consider the following Java code snippet that parses a string to an integer. What will be printed?
Java
public class Main { public static void main(String[] args) { String input = "123"; int number = Integer.parseInt(input); System.out.println(number); } }
Attempts:
2 left
💻 code output
intermediate2:00remaining
What happens when parsing a non-numeric string?
What will be the output or result of running this Java code?
Java
public class Main { public static void main(String[] args) { String input = "abc"; int number = Integer.parseInt(input); System.out.println(number); } }
Attempts:
2 left
💻 code output
advanced2:00remaining
Parsing a floating-point string with Integer.parseInt
What will happen when this code runs?
Java
public class Main { public static void main(String[] args) { String input = "12.34"; int number = Integer.parseInt(input); System.out.println(number); } }
Attempts:
2 left
💻 code output
advanced2:00remaining
Parsing a floating-point string with Double.parseDouble
What will be the output of this Java code?
Java
public class Main { public static void main(String[] args) { String input = "12.34"; double number = Double.parseDouble(input); System.out.println(number); } }
Attempts:
2 left
🧠 conceptual
expert2:00remaining
What is the value of 'result' after parsing with radix 16?
Given the code below, what is the value of the variable 'result' after execution?
Java
public class Main { public static void main(String[] args) { String hex = "1A"; int result = Integer.parseInt(hex, 16); System.out.println(result); } }
Attempts:
2 left
