Online Access Free 1Z0-501 Exam Questions

Exam Code:1Z0-501
Exam Name:Java Certified Programmer
Certification Provider:Oracle
Free Question Number:147
Posted:Jun 05, 2026
Rating
100%

Question 1

Which constructs a DataOutputStream?

Question 2

Exhibit
1 . public class SyncTest{
2 . public static void main(String[] args){
3 . final StringBuffer s1= new StringBuffer();
4 . final StringBuffer s2= new StringBuffer();
5 . new Thread (){
6 .public void run() {
7 .synchronized(s1) {
8 .s2.append("A");
9 .synchronized(s2) {
1 0. s2.append("B");
1 1.System.out.print(s1);
1 2.System.out.print(s2);
1 3. }
1 4.}
1 5.}
1 6. }.start();
1 7. new Thread() {
1 8. public void run() {
1 9.synchronized(s2) {
2 0.s2.append("C");
2 1.synchronized(s1) {
2 2.s1.append("D");
2 3.System.out.print(s2);
2 4.System.out.print(s1);
2 5.}
2 6.}
2 7.}
2 8.}.start();
2 9.}
3 0. }
Which two statements are true? (Choose Two)

Question 3

Exhibit:
1 . class super {
2 .public int getLength(){return 4;}
3 .}
4 .
5 . public class Sub extends Super {
6 .public long getLength() {return 5;}
7 .
8 . public static void main (String[]args){
9 .super sooper = new Super ();
1 0. Sub sub = new Sub();
1 1. System.out.printIn(
1 2.sooper.getLength()+ "," + sub.getLength()};
1 3.}
1 4. }
What is the output?

Question 4

Given:
1. class BaseClass {
2. Private float x = 1.0f ;
3. protected float getVar ( ) ( return x;)
4. }
5 . class Subclass extends BaseClass (
6 .private float x = 2.0f;
7 .//insert code here
8 . )
Which two are valid examples of method overriding? (Choose Two)

Question 5

Exhibit:
1 . package foo;
2 .
3 . import java.util.Vector;
4 .
5 . private class MyVector extends Vector {
6 . int i = 1;
7 . public MyVector(){
8 . i = 2;
9 .}
1 0. }
1 1.
1 2. public class MyNewVector extends MyVector {
1 3. public MyNewVector (){
1 4. i = 4;
1 5. }
1 6. public static void main (String args []){
1 7. MyVector v = new MyNewVector();
1 8.}
1 9. }
The file MyNewVector.java is shown in the exhibit.
What is the result?

Add Comments

Your email address will not be published. Required fields are marked *

insert code
Type the characters from the picture.