QUESTIONS WITH 100% VERIFIED CORRECT ANSWERS | |
LATEST UPDATE
c
The correct syntax for the "main" method signature is:
a. private static void main(String[] args)
b. public static String main(String[] args)
c. public static void main(String[] args)
d. public void main(String[] args)
e. none of the above
c
The Java compiler does the following:
a. checks a bytecode program in a ".class" file for run-time errors and
if there are none, it generates source code for that program in a ".java"
file
b. checks a source code program in a ".java" file for run-time errors
and if there are none, it generates bytecode for that program in a
".class" file
c. checks a source code program in a ".java" file for compile-time
errors and, if there are none, it generates bytecode for that program in
a ".class" file
,d. checks a bytecode program in a ".class" file for compile-time errors
and if there are none, it generates source code for that program in a
".java" file
e. none of the above
d
In design-by-contract, when the precondition (requires clause) of a
method is not satisfied the implementer of a method is obligated to:
a. stop the program and report an error
b. generate a default result that will let the client know of their error
c. make sure the postcondition (ensures clause) is satisfied
d. none of the above
a
What is the value of k after this code completes?
int i = 0, j = 0, k = 0;
while (i < 3) {
i++;
j = 0;
while (j < 3) {
j++;
k = k + i + j;
}}
,a. 36
b. 54
c. 9
d. 6
b
For this line of XML, what is the attribute name?
<parts dist = "even" > 5 </parts>
a. parts
b. dist
c. even
d. 5
c
Which is true of an XML tree?
a. only tag nodes have a label property
b. every node has an attribute property
c. only tag nodes may have children
d. only non-tag nodes can be leaf nodes
e. none of the above
, b
Which is NOT a property of an RSS 2.0 feed?
a. the root is an rss node with a version attribute whose value is "2.0"
b. there are one or more channel nodes as a child of the root
c. the channel node must have one of each of these nodes as children:
title, link, and description
d. the channel node can also have zero or more item child nodes plus
other optional children
e. all the above are true for RSS 2.0
a
What can you say about these two methods m1 & m2?
private static boolean m1(int x, int y) {
boolean result;
if (x>0 && y > 0) { result = false; }
else { result = true; }
return result;
}
private static boolean m2(int x, int y)