Oracle Java SE 7 Programmer I - 1Z1-803 FREE EXAM DUMPS QUESTIONS & ANSWERS
Given:
public class Equal {
public static void main(String[] args) {
String str1 = "Java";
String[] str2 = {"J","a","v","a"};
String str3 = "";
for (String str : str2) {
str3 = str3+str;
}
boolean b1 = (str1 == str3);
boolean b2 = (str1.equals(str3));
System.out.print(b1+", "+b2);
} What is the result?
public class Equal {
public static void main(String[] args) {
String str1 = "Java";
String[] str2 = {"J","a","v","a"};
String str3 = "";
for (String str : str2) {
str3 = str3+str;
}
boolean b1 = (str1 == str3);
boolean b2 = (str1.equals(str3));
System.out.print(b1+", "+b2);
} What is the result?
Correct Answer: D
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).
A method is declared to take three arguments. A program calls this method and passes only two arguments. What is the result?
Correct Answer: A
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).
View the exhibit:
public class Student {
public String name = "";
public int age = 0;
public String major = "Undeclared";
public boolean fulltime = true;
public void display() {
System.out.println("Name: " + name + " Major: " + major); }
public boolean isFullTime() {
return fulltime;
}
}
Given:
Public class TestStudent {
public static void main(String[] args) {
Student bob = new Student ();
bob.name = "Bob";
bob.age = 18;
bob.year = 1982;
}
}
What is the result?
public class Student {
public String name = "";
public int age = 0;
public String major = "Undeclared";
public boolean fulltime = true;
public void display() {
System.out.println("Name: " + name + " Major: " + major); }
public boolean isFullTime() {
return fulltime;
}
}
Given:
Public class TestStudent {
public static void main(String[] args) {
Student bob = new Student ();
bob.name = "Bob";
bob.age = 18;
bob.year = 1982;
}
}
What is the result?
Correct Answer: B
Vote an answer
public class Two {
public static void main(String[] args) {
try {
doStuff();
system.out.println("1");
}
catch {
system.out.println("2");
}}
public static void do Stuff() {
if (Math.random() > 0.5) throw new RunTimeException(); doMoreStuff();
System.out.println("3 ");
}
public static void doMoreStuff() {
System.out.println("4");
}
}
Which two are possible outputs?
public static void main(String[] args) {
try {
doStuff();
system.out.println("1");
}
catch {
system.out.println("2");
}}
public static void do Stuff() {
if (Math.random() > 0.5) throw new RunTimeException(); doMoreStuff();
System.out.println("3 ");
}
public static void doMoreStuff() {
System.out.println("4");
}
}
Which two are possible outputs?
Correct Answer: A,B
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).
A method is declared to take three arguments. A program calls this method and passes only two arguments. What is the results?
Correct Answer: A
Vote an answer
Given: What is the result?


Correct Answer: D
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).
Given:
class Base {
public static void main(String[] args) {
System.out.println("Base " + args[2]);
}
}
public class Sub extends Base{
public static void main(String[] args) {
System.out.println("Overriden " + args[1]);
}
}
And the commands:
javac Sub.java
java Sub 10 20 30
What is the result?
class Base {
public static void main(String[] args) {
System.out.println("Base " + args[2]);
}
}
public class Sub extends Base{
public static void main(String[] args) {
System.out.println("Overriden " + args[1]);
}
}
And the commands:
javac Sub.java
java Sub 10 20 30
What is the result?
Correct Answer: A
Vote an answer
Given:

Which approach ensures that the class can be compiled and run?

Which approach ensures that the class can be compiled and run?
Correct Answer: A
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).
int i, j=0; i = (3* 2 +4 +5 ) ; j = (3 * ((2+4) + 5)); System.out.println("i:"+ i + "\nj":+j);
What is the result?

What is the result?

Correct Answer: A
Vote an answer
Given:
public class DoBreak1 {
public static void main(String[] args) {
String[] table = {"aa", "bb", "cc", "dd"};
for (String ss: table) {
if ( "bb".equals(ss)) {
continue;
}
System.out.println(ss);
if ( "cc".equals(ss)) {
break;
}
}
} }
What is the result?
public class DoBreak1 {
public static void main(String[] args) {
String[] table = {"aa", "bb", "cc", "dd"};
for (String ss: table) {
if ( "bb".equals(ss)) {
continue;
}
System.out.println(ss);
if ( "cc".equals(ss)) {
break;
}
}
} }
What is the result?
Correct Answer: B
Vote an answer
Identify two benefits of using ArrayList over array in software development.
Correct Answer: A,B
Vote an answer
Explanation: Only visible for FreeCram members. You can sign-up / login (it's free).
Given the fragments:

Which line causes a compilation error?

Which line causes a compilation error?
Correct Answer: D
Vote an answer
Given the code fragment:
// insert code here arr[0] = new int[3]; arr[0][0] = 1; arr[0][1] = 2; arr[0][2] = 3;
arr[1] = new int[4]; arr[1][0] = 10; arr[1][1] = 20; arr[1][2] = 30; arr[1][3] = 40;
Which two statements, when inserted independently at line // insert code here, enable the code to compile?
// insert code here arr[0] = new int[3]; arr[0][0] = 1; arr[0][1] = 2; arr[0][2] = 3;
arr[1] = new int[4]; arr[1][0] = 10; arr[1][1] = 20; arr[1][2] = 30; arr[1][3] = 40;
Which two statements, when inserted independently at line // insert code here, enable the code to compile?
Correct Answer: D,F
Vote an answer
Given: Which two actions, used independently, will permit this class to compile?


Correct Answer: A,E
Vote an answer
