1z0-811 — Free Practice Questions
10 free sample questions from a bank of 42, with the correct answers and explanations. No signup required — start practising right now.
1Which statement is true about primitive variables?
- They can be compared with the == operator.
- They can be compared with the equals method only.
- They cannot be compared.
- They can be compared with the compareTo method only.
Answer: A
2Given the code fragment: Which code fragment, when inserted at line n1, enables the code to print Java Programming:1?
- System.out.println(name + “:” + count);
- System.out.println(c.name + “:” + count);
- System.out.println(c.name + “:” + Course.count);
- System.out.println(Course.name + “:” + c.count);
Answer: C
3Given: Why does the compilation fail?
- The option variable is not initialized.
- The order of case labels is incorrect.
- The option data type is incorrect.
- The break statement is missing.
Answer: C
4Given: What is the result?
- [null:-]
- [ : ]
- [null:null]
- [:null]
Answer: A
5Which two Java reserved words are used to implement encapsulation?
- final
- static
- public
- extends
- private
Answer:
6Given the code fragment: Which code fragment can be inserted at line n1 to enable the code to print 0.0?
- Ball b = null;
b.weight = 0.0;
- Ball.weight = 0.0;
- Ball b = new Ball(0.0);
- Ball b = new Ball();
Answer: D
7Which two statements are true about the Java Runtime Environment (JRE)?
- It is responsible for garbage collection.
- It interprets bytecode stored in a .class file.
- It contains the JDK and Java APIs.
- It is platform independent.
- You must install the JRE to compile a .java file.
Answer:
8Identify two features of Java.
- architecture dependent
- platform independent
- single threaded
- robust
Answer:
9Given the code fragment: What is the result?
- A compilation error occurs.
- A runtime exception is thrown.
- Julia -
Peter
- Peter -
Julia
Answer: A
10Given: And the code fragment: What is the result?

- A compilation error occurs at line n1.
- White : null
- null: null
- White : White
Answer: A
Want the full bank of 42 questions for 1z0-811? See all practice exams.