Free 1Z0-811 sample questions
Below are free 1Z0-811 sample questions for Java beginners, with answers and explanations. They cover data types, loops, String methods and simple classes. Try them after your first Java course to see what you need to review.
Try them in the simulator Same questions, with study, timed and flashcard modes.
Showing 10 of 20 free sample questions.
What is the result of executing the following code snippet? ```java String s1 = "Java"; String s2 = new String("Java"); String s3 = "Java"; System.out.print((s1 == s2) + ", "); System.out.print((s1 == s3) + ", "); System.out.print(s1.equals(s2)); ```
A developer is writing a method to format a user's name. The method should take a first and last name and return a formatted string like "Last, First". However, if the last name is null or empty, it should just return the first name. Which of the following implementations correctly handles this logic?
Which of the following are valid Java reserved words? (Select THREE)
Given the following code: ```java int a = 10; int b = 3; int c = 4; boolean result = a / b == 3 && c * b++ > 10; System.out.println(result + ", " + b); ``` What is the output?
What is the primary role of the Java Virtual Machine (JVM)?
The `java.lang` package is automatically imported into every Java program.
A developer needs to store a list of student grades. The number of students is not known in advance and can change during runtime. The developer must be able to add new grades, remove grades, and check how many grades have been entered. Which data structure is the most appropriate choice for this scenario?
Which of the following variable declarations will cause a compilation error?
A developer needs to convert a `String` containing a number into its `int` primitive equivalent. If the string is not a valid number, the program should catch the error and assign a default value of -1. Given the following logic flow, which exception should be handled in the `catch` block? flowchart TD Start([Start]) --> Input{Read String input} Input --> Process{Attempt to parse String to int} Process -->|Success| Assign[Assign parsed int] Process -->|Failure| Handle[Handle Error] Handle --> AssignDefault[Assign default value -1] Assign --> End([End]) AssignDefault --> End
10 more free samples are waiting
Create a free account to unlock the whole 1Z0-811 sample bank, or get full access to all 288 practice questions in the simulator.