Oracle 1Z0-851 Certification Sample Questions and Answers

1Z0-851 PDF, 1Z0-851 Dumps PDF Free Download, 1Z0-851 Dumps Free, 1Z0-851 Latest Dumps PDF, 1Z0-851 PDF Free DownloadThe Oracle 1Z0-851 Sample Question Set is designed to help you prepare for the Java SE 6 Programmer Certified Professional (1Z0-851) certification exam. To become familiar with actual Oracle Certification exam environment, we suggest you to try Sample Oracle 1Z0-851 Certification Practice Exam.

This sample Oracle 1Z0-851 certification practice exam is designed for evaluation purposes only. If you really want to test your knowledge to identify your weak areas and familiarize with actual exam format, we suggest you to practice with Premium Oracle 1Z0-851 Certification Practice Exam for Java SE 6 Programmer Certified Professional (1Z0-851) certification. Our team of Java experts have designed Questions-Answers for this premium practice exam by collecting inputs from recently certified candidates. Hence, We strongly recommend you to use Premium Oracle 1Z0-851 Certification Practice Exam to clear your actual Oracle 1Z0-851 Certification Exam with great score.

1Z0-851 Sample Questions:

01. Given:
public class Buddy {
 public static void main(String[] args) {
 def:
 for (short s = 1; s < 7; s++) {
 if (s == 5) {
 break def;
 }
 if (s == 2) {
 continue;
 }
 System.out.print(s + ".");
 }
 }
}
What is the result?
a) 1.3.
b) 1.3.4.
c) 1.2.3.4.
d) 1.3.4.6.
 
02. Given the code fragment:
public class App {
 public static final String M_ADDRESS = "Address1 0x4C Address2 0x5";
 public static void main(String[] args) {
 // line n1
 Pattern pattern = Pattern.compile(regExPattern);
 Matcher matcher = pattern.matcher(M_ADDRESS);
 while (matcher.find()) {
 System.out.print(matcher.group());
 }
 }
}
Which declaration statement, at line n1, enables the code fragment to print 0x4C0x5?
a) String regExPattern = "0[xX][a-fA-F0-9]";
b) String regExPattern = "0[xX]([a-fA-F0-9])1";
c) String regExPattern = "0[xX]([0-9a-fA-F])+";
d) String regExPattern = "0[xX]([a-fA-F0-9])? ";
 
03. Given:
public class SuperFoo {
 public SuperFoo doStuff(int x) {
 return new SuperFoo();
 }
}
class Foo extends SuperFoo {
 //line n1
}
Which code fragment at line n1 compiles?
a) Foo doStuff(int x) { return new SuperFoo(); }
b) public Foo doStuff(int x) { return new SuperFoo(); }
c) public SuperFoo doStuff(int x) { return new Foo(); }
d) SuperFoo doStuff(int y) { return new SuperFoo(); }
 
04. Given:
public class Bird {
 public static void main(String[] args) {
 try {
 throw new Exception();
 } catch (Exception e) {
 try {
 throw new Exception();
 } catch (Exception e2) {
 System.out.print("inner ");
 }
 System.out.print("middle ");
 }
 System.out.print("outer ");
 }
}
What is the result?
a) inner
b) inner middle
c) inner outer
d) inner middle outer
 
05. Given:
public class Lockdown implements Runnable {
 public static void main(String[] args) {
 new Thread(new Lockdown()).start();
 new Thread(new Lockdown()).start();
 }
 public void run() {
 locked(Thread.currentThread().getId());
 }
 synchronized void locked(long id) {
 System.out.print(id + "a ");
 System.out.print(id + "b ");
 }
}
What is the result?
a) The deadlock situation occurs.
b) If 7 and 8 are the Threads Ids generated, the possible output is:7a 7b 8a 8b or 7a 8a 7b 8b
c) Compilation fails.
d) An Exception is thrown at runtime.
 
06. Given the code fragment:
String[] dogs = {"fido", "clover"};
List dogList = Arrays.asList(dogs);
dogList.add("spot");
dogs[0] = "fluffy";
System.out.println(dogList);
for(String s: dogs) {
 System.out.print(s + " ");
}
What is the result?
a)
[spot, fido, clover]
fluffy fido clover
b)
[fluffy, spot, fido, clover]
fluffy spot fido clover
c) Compilation fails.
d) An exception is thrown at runtime.
 
07. Given the code fragment:
class Traveler implements Serializable {
 static int x1 = 0;
 volatile int x2 = 0;
 transient int x3 = 0;
}
public class Network {
 public static void main(String[] args) {
 Traveler t = new Traveler();
 t.x1 = 7;
 t.x2 = 7;
 t.x3 = 7;
 // code that serialize t then de-serialize t goes here
 System.out.print(t.x1 + " " + t.x2 + " " + t.x3);
 }
}
What is the result?
a) 0 7 0
b) 0 7 7
c) 7 7 0
d) 7 7 7
 
08. Given:
public class x {
 public static void main(String [] args) {
 String p = System.getProperty("x");
 if(p.equals(args[1]))
 System.out.println("found");
 }
}
Which command-line invocation prints found?
a) java -Dx=y x y z
b) java -Dx=y x x y z
c) java x x=y
d) java x x y z
 
09. Given the statement:
Magazines are a kind of Messengers, and Magazines also fulfill the contract of NewsPapers. In addition, Messengers are composed with several Messages.
Which code represents the statement?
a)
class Message { }
class Magazine extends NewsPaper implements Messenger { }
interface Messenger {
 Message [] w;
}
class NewsPaper { }
b)
class Message { }
class Magazine extends Messenger implements NewsPaper { }
class Messenger {
 Message [] w;
}
interface NewsPaper { }
c)
class Magazine { }
class Message extends Magazine implements NewsPaper { }
class Messenger {
 Message [] w;
}
interface NewsPaper { }
d)
interface Message { }
class Magazine extends Messenger implements Message { }
class Message {
 Messenger [] w;
}
class Messenger { }
 
10. Given the code fragment:
public static void main(String[] args) {
 TreeMap<String, Integer> myMap = new TreeMap<String, Integer>();
 myMap.put("ak", 50);
 myMap.put("co", 60);
 myMap.put("ca", 70);
 myMap.put("ar", 80);
 NavigableMap<String, Integer> myMap2 = myMap.headMap("d", true);
 myMap.put("fl", 90);
 myMap2.put("hi", 100);
 System.out.println(myMap.size() + " " + myMap2.size());
}
What is the result?
a) 6 5
b) 6 6
c) Compilation fails.
d) An exception is thrown at runtime. 

Solutions:

QUESTION: 01

Answer: b

QUESTION: 02

Answer: c

QUESTION: 03

Answer: c

QUESTION: 04

Answer: d

QUESTION: 05

Answer: b

QUESTION: 06

Answer: d

QUESTION: 07

Answer: a

QUESTION: 08

Answer: b

QUESTION: 09

Answer: b

QUESTION: 10

Answer: d

 

Rating: 5 / 5 (35 votes)