OSU CSE 2221 FINAL REVIEW (ACTUAL / ) | 65
QUESTIONS WITH 100% VERIFIED CORRECT ANSWERS | |
LATEST UPDATE
c
The correct syntax for the "main" method signature is:
- private static void main(String[] args)
- public static String main(String[] args)
- public static void main(String[] args)
- public void main(String[] args)
- none of the above
c
The Java compiler does the following:
- checks a bytecode program in a ".class" file for run-time errors and
- checks a source code program in a ".java" file for run-time errors
- checks a source code program in a ".java" file for compile-time
if there are none, it generates source code for that program in a ".java" file
and if there are none, it generates bytecode for that program in a ".class" file
errors and, if there are none, it generates bytecode for that program in a ".class" file 1 / 4
- checks a bytecode program in a ".class" file for compile-time errors
- none of the above
and if there are none, it generates source code for that program in a ".java" file
d In design-by-contract, when the precondition (requires clause) of a
method is not satisfied the implementer of a method is obligated to:
- stop the program and report an error
- generate a default result that will let the client know of their error
- make sure the postcondition (ensures clause) is satisfied
- 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;
} } 2 / 4
- 36
- 54
- 9
- 6
b For this line of XML, what is the attribute name?
- parts
- dist
- even
- 5
c Which is true of an XML tree?
- only tag nodes have a label property
- every node has an attribute property
- only tag nodes may have children
- only non-tag nodes can be leaf nodes
- none of the above 3 / 4
b Which is NOT a property of an RSS 2.0 feed?
- the root is an rss node with a version attribute whose value is "2.0"
- 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
- the channel node can also have zero or more item child nodes plus
- all the above are true for RSS 2.0
other optional children
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)
- / 4