[Realistic] 1z0-808 Oracle rapidshare 151-160 (Nov 2021)

Act now and download your Oracle 1z0-808 test today! Do not waste time for the worthless Oracle 1z0-808 tutorials. Download Leading Oracle Java SE 8 Programmer I exam with real questions and answers and begin to learn Oracle 1z0-808 with a classic professional.

2021 Nov 1z0-808 exam answers

Q151. Which three statements are true about the structure of a Java class? 

A. A class can have only one private constructor. 

B. A method can have the same name as a field. 

C. A class can have overloaded static methods. 

D. A public class must have a main method. 

E. The methods are mandatory components of a class. 

F. The fields need not be initialized before use. 

Answer: A,B,C 

Explanation: A: Private constructors prevent a class from being explicitly instantiated by its 

callers. 

If the programmer does not provide a constructor for a class, then the system will always 

provide a default, public no-argument constructor. To disable this default constructor, 

simply add a private no-argument constructor to the class. This private constructor may be 

empty. 

B: The following works fine: 

int cake() { 

int cake=0; 

return (1); 

C: We can overload static method in Java. In terms of method overloading static method 

are just like normal methods and in order to overload static method you need to provide 

another static method with same name but different method signature. 

Incorrect: 

Not D: Only a public class in an application need to have a main method. 

Not E: 

Example: 

class A 

public string something; 

public int a; 

Q: What do you call classes without methods? Most of the time: An anti pattern. 

Why? Because it faciliates procedural programming with "Operator" classes and data 

structures. You separate data and behaviour which isn't exactly good OOP. 

Often times: A DTO (Data Transfer Object) 

Read only datastructures meant to exchange data, derived from a business/domain object. 

Sometimes: Just data structure. 

Well sometimes, you just gotta have those structures to hold data that is just plain and 

simple and has no operations on it. 

Not F: Fields need to be initialtized. If not the code will not compile. 

Example: 

Uncompilable source code - variable x might not have been initialized 


Q152. Given the code fragment: 

public static void main(String[] args) { 

int iArray[] = {65, 68, 69}; 

iArray[2] = iArray[0]; 

iArray[0] = iArray[1]; 

iArray[1] = iArray[2]; 

for (int element : iArray) { 

System.out.print(element + " "); 

A. 68, 65, 69 

B. 68, 65, 65 

C. 65, 68, 65 

D. 65, 68, 69 

E. Compilation fails 

Answer:


Q153. Given: 

What is the result? 

A. 3 4 5 6 

B. 3 4 3 6 

C. 5 4 5 6 

D. 3 6 4 6 

Answer:


Q154. Which statement is/are true? 

I. Default constructor only contains "super();" call. 

II. We can't use any access modifier with a constructor. 

III. A constructor should not have a return type. 

A. Only I. 

B. Only II. 

C. Only I and II. 

D. Only I and III. 

E. AIL 

Answer:

Explanation: 

Statement I is correct as the default constructor only contains super0 call 

Statement II is incorrect as we can use any access modifier with a constructor. 

Statement III is correct as constructor can't have return type, even void. 

So option D is correct. 

httpsy/docs.oracle.com/javase/tutorial/iava/javaOO/construaors.html 


Q155. Given the code fragment: 

Which code fragment, when inserted at line 9, enables the code to print true? 

A. String str2 = str1; 

B. String str2 = new String (str1); 

C. String str2 = sb1. toString (); 

D. String str2 = "Duke"; 

Answer:


Renew 1z0-808 brain dumps:

Q156. Given: 

What is the result? 

A. x: 1 y: 2 

B. 3 y: 4 

C. x: 0 y: 0 

D. 3 y: 4 

E. x: 1 y: 2 

F. 0 y: 0 

G. x: 0 y: 0 

H. 0 y: 0 

Answer:


Q157. Given the code fragment: 

class Student { 

int rollnumber; 

String name; 

List cources = new ArrayList(); 

// insert code here 

public String toString() { 

return rollnumber + " : " + name + " : " + cources; 

And, 

public class Test { 

public static void main(String[] args) { 

List cs = newArrayList(); 

cs.add("Java"); 

cs.add("C"); 

Student s = new Student(123,"Fred", cs); 

System.out.println(s); 

Which code fragment, when inserted at line // insert code here, enables class Test to print 123 : Fred : [Java, C]? 

A. 

private Student(int i, String name, List cs) { 

/* initialization code goes here */ 

B. 

public void Student(int i, String name, List cs) { 

/* initialization code goes here */ 

C. 

Student(int i, String name, List cs) { 

/* initialization code goes here */ 

D. 

Student(int i, String name, ArrayList cs) { 

/* initialization code goes here */ 

Answer:

Explanation: 

Incorrect: 

Not A: Student has private access line: Student s = new Student(123,"Fred", cs); 

Not D: Cannot be applied to given types. Line: Student s = new Student(123,"Fred", cs); 


Q158. Given: 

Class A { } 

Class B { } 

Interface X { } 

Interface Y { } 

Which two definitions of class C are valid? 

A. Class C extends A implements X { } 

B. Class C implements Y extends B { } 

C. Class C extends A, B { } 

D. Class C implements X, Y extends B { } 

E. Class C extends B implements X, Y { } 

Answer: A,E 

Explanation: extends is for extending a class. 

implements is for implementing an interface. Java allows for a class to implement many interfaces. 


Q159. Given: 

Which statement is true? 

A. Both p and s are accessible by obj. 

B. Only s is accessible by obj. 

C. Both r and s are accessible by obj. 

D. p, r, and s are accessible by obj. 

Answer:


Q160. Given: 

What is the result? 

A. box 

B. nbo 

C. bo 

D. nb 

E. An exception is thrown at runtime 

Answer:



see more http://www.2passeasy.com/exam/1z0-808/