Website: Vce To PDF Converter: Facebook: Twitter:: 1Z0-811.Vceplus - Premium.Exam.75Q
Website: Vce To PDF Converter: Facebook: Twitter:: 1Z0-811.Vceplus - Premium.Exam.75Q
75q
Number: 1z0-811
Passing Score: 800
Time Limit: 120 min
File Version: 1.0
1z0-811
Java Foundations
Version 1.0
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Exam A
QUESTION 1
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Reference: https://stackoverflow.com/questions/9690981/compare-two-primitive-long-variables-in-java
QUESTION 2
Given the code fragment:
A. 2
B. 4
C. The program executes an infinite number of times.
D. 3
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Explanation:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 3 Identify two Java
reserved words.
A. array
B. true
C. this
D. exception
E. string
Correct Answer: BC
Section: (none)
Explanation
Explanation/Reference:
Reference:
https://www.computerhope.com/jargon/j/java_reserved_words.htm
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Reference: https://www.quora.com/Can-we-define-a-function-within-another-
function-in-Java
QUESTION 5
Given:
Which code fragment can be inserted at line n1 to enable the code to print All the best?
A. void writeMsg();
B. Messenger.writeMsg();
C. writeMsg();
D. m.writeMsg();
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 6
Given the code fragment:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
}
E. private String name = “John”; public
void display() { System.out.print(name);
}
Correct Answer: BE
Section: (none)
Explanation
Explanation/Reference:
QUESTION 7 You have been asked to develop a Java program that prints the elements of an array in
reverse order.
A. enhanced for
B. standard for
C. while
D. do-while
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Reference: https://www.javatpoint.com/java-program-to-print-the-elements-of-an-array-in-reverse-order
QUESTION 8
Given the code fragment:
A. The code results in a compilation error. To make it compile, insert at line n1:
import java.lang.Math; import java.lang.Random;
B. The code compiles successfully
C. The code results in a compilation error. To make it compile, insert at line n1:
import java.lang; import java.util;
D. The code results in a compilation error. To make it compile, insert at line n1:
import java.util.*;
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Explanation:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 9
Given the code fragment:
Correct Answer: D
Section: (none)
Explanation
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Explanation/Reference:
Explanation:
QUESTION 10
Given the code fragment:
Which code fragment, when inserted at line n1, enables the code to print Java Programming:1?
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 11
Given:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
A. [null:-]
B. [ : ]
C. [null:null]
D. [:null]
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 12
Which two Java reserved words are used to implement encapsulation?
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
A. final
B. static
C. public
D. extends
E. private
Correct Answer: CE
Section: (none)
Explanation
Explanation/Reference:
Reference:
https://learn.saylor.org/mod/page/view.php?id=22044
QUESTION 13
Given the code fragment:
Which code fragment can be inserted at line n1 to enable the code to print 0.0?
A. Ball b = null;
b.weight = 0.0;
B. Ball.weight = 0.0;
C. Ball b = new Ball(0.0);
D. Ball b = new Ball();
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 14 Which two statements are true about the Java Runtime
Environment (JRE)?
Correct Answer: BD
Section: (none)
Explanation
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Explanation/Reference:
Reference: https://en.wikipedia.org/wiki/Java_virtual_machine
A. architecture dependent
B. platform independent
C. single threaded
D. robust
Correct Answer: BD
Section: (none)
Explanation
Explanation/Reference:
Reference: https://www.javatpoint.com/features-of-java
QUESTION 16
Given:
A. 300
B. 100
C. 200
D. A compilation error occurs.
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Explanation:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 17
Given the code fragment:
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 18
Given the code fragment:
Which code fragment can be inserted at line n1 to enable the code to compile?
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 19
Given the code fragment:
A. 9
12
B. 10
10
C. 9
9
D. 10
14
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Explanation:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 20
Given the code fragment:
A. Unknown issues.
Invalid divisor.
B. Unknown issues.
C. Invalid divisor.
D. A compilation error occurs.
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Explanation:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 21
Given the code fragment:
A. 3
B. A compilation error occurs.
C. 2
D. 0
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
Explanation:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 22
Given the code fragment:
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Explanation:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 23
Given:
A. 100
200
B. A compilation error occurs at line n2.
C. A compilation error occurs at line n1.
D. 100 100 Correct Answer: D
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 24
Given:
B. White : null
C. null: null
D. White : White
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
QUESTION 25
Given the code:
Which code fragment, when inserted at line n1, enables the code to print sum is 30?
A. int sum(int a, b) {
B. int sum(int a, int b) {
C. int sum(int, int) {
D. int sum(int[] a, b) {
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Which edition of Java is geared towards use of simple, closed systems with constrained memory requirements, such as a microprocessor board?
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Reference: https://www.oracle.com/technical-
resources/articles/java/raspberrypi.html
QUESTION 27
Given the code fragment:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Which code fragment, when inserted at line n1, enables the code to print one?
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Explanation:
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Reference:
https://core.ac.uk/download/pdf/4824892.pdf
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 29
Given the code fragment:
A. false
false
false
false
B. true
false
false
false
C. true
true
true
true D.
true
true
true
false
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Explanation:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 30 Identify two valid data types for the operands of the addition
(+) operator?
A. string
B. boolean
C. numeric
D. array
Correct Answer: AD
Section: (none)
Explanation
Explanation/Reference:
Reference:
https://www.iitk.ac.in/esc101/05Aug/tutorial/java/nutsandbolts/arithmetic.html
QUESTION 31
Given the code fragment:
A. false false –1
B. true false 0
C. true true 0
D. false true –1
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Explanation:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 32
Given the code fragment:
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Explanation:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 33 Identify two
class variables.
Correct Answer: AB
Section: (none)
Explanation
Explanation/Reference:
Reference: https://www.tutorialspoint.com/What-are-class-variables-instance-variables-and-local-variables-in-Java
QUESTION 34 Which
statement is valid?
A. int 2 totalScore = 0;
B. int total–score = 0;
C. int totalScore2 = 0;
D. int total score = 0;
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Reference: https://liveexample.pearsoncmg.com/html/TotalScore.html
QUESTION 35
Given these class definitions:
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 36
Given:
Which statement, when inserted at line n1, enables the Course class to compile?
A. int newFee;
B. double newFee;
C. long newFee;
D. float newFee; Correct Answer: B Section: (none) Explanation
Explanation/Reference:
QUESTION 37
Given:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 38
Given:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
At which line does a compilation error occur?
A. line 5
B. line 2
C. line 3
D. line 7
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
QUESTION 39
Given:
A. 20
B. 32
C. A compilation error occurs.
D. 21
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
Explanation:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 40
Given the classes:
Correct Answer: AD
Section: (none)
Explanation
Explanation/Reference:
QUESTION 41
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Given the code fragment:
A. 456789
B. 4567889 C. 45678
D. 3456789
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 42
Given the code fragment:
A. 10 20
10 15 20
B. A runtime exception is thrown.
C. 10 20
10 20
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
D. A compilation error occurs.
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Explanation:
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Reference: https://www.javatpoint.com/multiple-catch-block-in-java
QUESTION 44
Given the code fragment:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
A. true
true B.
true
false
C. false
false
D. false
true
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 45
Given the code fragment:
A. 10
B. 11
C. 12
D. 13
Correct Answer: C
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 46
Given the code fragment:
A. [ BETATEST ]
B. [betaTest]
C. [ betaTest ]
D. [BETATEST]
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Explanation:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 47
Given the code
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Explanation:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 48 Which method identifier is correct according to Java naming
conventions?
A. BillCalculator
B. calculateBill
C. calculatebill
D. Calculator
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Student.java java
Student Richard
commands: javac
Course.java javac
Student.java java
“Richard William”
Richard William is
commands: javac
Student.java java
Student Richard
is studying Java. D.
Student.java java
Student “Richard
is studying Java.
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
QUESTION 50
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Given the code fragment:
A. lines 5 and 7
B. line 7
C. lines 6 and 8
D. line 5
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 51
Given the code fragment:
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Explanation:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 52
Given the code fragment:
A. false
false
B. true
true C.
true
false
D. false
true
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
Explanation:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 53
Given:
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 54
Given the code fragment:
Which code fragment, when inserted at line n1, enables it to print Rita is 14 years old?
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
A. System.out.println(“%s is %d years old” +name+age);
B. System.out.println(“%s is %n years old” name, age);
C. System.out.printf(“%s is %d years old”, name, age);
D. System.out.printf(“%s is %n years old”, name, age);
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 55
Given:
C. 5
D. A compilation error occurs in the main method.
Correct Answer: D
Section: (none)
Explanation
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Explanation/Reference:
Explanation:
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 57
Given:
C. 0
D. Nothing is printed.
Correct Answer: B
Section: (none)
Explanation
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Explanation/Reference:
Explanation:
QUESTION 58
Given the code fragment:
A. 1
B. 3
C. 5
D. Nothing is printed.
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Explanation:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 59 What is the meaning of “write once, run
anywhere” in Java?
A. Java programs are designed to run only in web browsers and, thus, can run wherever there is a browser.
B. It is a marketing statement because Java programs must be compiled for a specific platform in order to run.
C. Java programs can run on any Java Virtual Machine without being recompiled.
D. Java programs, after being compiled, can run on any platform or device even without a Java Virtual Machine.
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Reference: https://www.geeksforgeeks.org/why-is-java-write-once-and-run-
anywhere/
QUESTION 60
Given the code fragment:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 61
Given the code fragment:
Which statement, when inserted at line n1, enables the code to print 0 2 4 6 8 10?
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Explanation:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 62
Given the code fragment:
A. 3 : 1
B. 3 : 2
C. 0 : 1
D. 2 : 0
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Explanation:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 63 Identify three advantages of object-oriented
programming.
Explanation/Reference:
Reference:
https://www.tutorialspoint.com/object_oriented_analysis_design/ooad_quick_guide.htm
QUESTION 64
Given the code fragment:
A. 25.67
B. 25.00
C. 25.7
D. 26
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
Explanation:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 65 Identify three features of the Java
programming language.
A. distributed
B. direct memory management
C. multithreaded
D. strongly typed
E. dynamically typed
Explanation/Reference:
Reference: https://www.tutorialspoint.com/What-are-the-major-features-of-Java-
programming
QUESTION 66
Given the code fragment:
A. false
true B.
true
true
C. false false
D. A runtime exception is thrown
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Correct Answer: B
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 67
Given the code fragment:
A. lotus jasmine
B. lotus
C. A compilation error occurs.
D. lotus lily
Correct Answer: D
Section: (none)
Explanation
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Explanation/Reference:
Explanation:
QUESTION 68
Given the code fragment:
A. 8
B. 3
C. 0
D. A compilation error occurs.
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Explanation:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 69
Given the code fragment:
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Explanation:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 70
Given the code fragment:
Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
Explanation:
QUESTION 71
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
Which package would you import to use the Random class?
A. java.io
B. java.math C. java.util
D. java.lang
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Reference: https://www.educative.io/edpresso/how-to-generate-random-numbers-in-
java
Correct Answer: CD
Section: (none)
Explanation
Explanation/Reference:
Reference: https://docs.oracle.com/javase/tutorial/java/javaOO/classdecl.html
QUESTION 73
Given:
A. 1 2 3 aaaa
B. 1 2 aaa
C. Compilation fails
D. a
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
Explanation:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
QUESTION 74
Given:
Correct Answer: D
Section: (none)
Explanation
Explanation/Reference:
QUESTION 75
Given the contents of the Test.java file:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com
What is the result?
Correct Answer: C
Section: (none)
Explanation
Explanation/Reference:
Explanation:
www.vceplus.com - Free Questions & Answers - Online Courses - Convert VCE to PDF - VCEplus.com