Top 10 faq 1z0-808 for IT professionals (11 to 20)
Want to know Ucertify 1z0-808 Exam practice test features? Want to lear more about Oracle Java SE 8 Programmer I certification experience? Study Top Quality Oracle 1z0-808 answers to Improved 1z0-808 questions at Ucertify. Gat a success with an absolute guarantee to pass Oracle 1z0-808 (Java SE 8 Programmer I) test on your first attempt.
The article at Testaimer.com going over http://www.testaimer.com/1z0-808-test is very comprehensive.
2021 Mar 1z0-808 book
Q11. 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
Q12. Given the code fragment:
What is the result?
A. 2 4
B. 0 2 4 6
C. 0 2 4
D. Compilation fails
Answer: C
Q13. Given:
What is the result?
A. Marrown
String out of limits
JesOran
B. Marrown
String out of limits
Array out of limits
C. Marrown
String out of limits
D. Marrown
NanRed
JesOran
Answer: A
Q14. Which statement best describes encapsulation?
A. Encapsulation ensures that classes can be designed so that only certain fields and methods of an object are accessible from other objects.
B. Encapsulation ensures that classes can be designed so that their methods are inheritable.
C. Encapsulation ensures that classes can be designed with some fields and methods declared as abstract.
D. Encapsulation ensures that classes can be designed so that if a method has an argument MyType x, any subclass of MyType can be passed to that method.
Answer: A
Q15. Given:
public class TestOperator {
public static void main(String[] args) {
int result = 30 -12 / (2*5)+1;
System.out.print("Result = " + result);
}
}
What is the result?
A. Result = 2
B. Result = 3
C. Result = 28
D. Result = 29
E. Result = 30
Answer: E
Far out 1z0-808 exam engine:
Q16. Given the definitions of the MyString class and the Test class:
What is the result?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: C
Q17. Given the code in a file Traveler.java:
And the commands:
Javac Traveler.java
Java Traveler Java Duke What is the result?
A. Happy Journey! Duke
B. Happy Journey! Java
C. An exception is thrown at runtime
D. The program fails to execute due to a runtime error
Answer: D
Q18. Given the code fragments:
Which code fragment, when inserted at line ni, enables the code to print Hank?
A. checkAge (iList, ( ) -> p. get Age ( ) > 40);
B. checkAge(iList, Person p -> p.getAge( ) > 40);
C. checkAge (iList, p -> p.getAge ( ) > 40);
D. checkAge(iList, (Person p) -> { p.getAge() > 40; });
Answer: C
Q19. Given:
public class TestLoop1 {
public static void main(String[] args) {
int a = 0, z=10;
while (a < z) {
a++;
--z;
} System.out.print(a + " : " + z); } }
What is the result?
A. 5 : 5
B. 6 : 4
C. 6 : 5
D. 5 : 4
Answer: A
Q20. Given the code format:
Which code fragment must be inserted at line 6 to enable the code to compile?
A. DBConfiguration f; return f;
B. Return DBConfiguration;
C. Return new DBConfiguration;
D. Retutn 0;
Answer: B