OSU CSE 2221 Final Review | 65 Questions with 100% Correct Answers | Verified | Latest Update
Question : 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
Correct answer: c
Question : The Java compiler does the following:
- 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
- checks a source code program in a ".java" file for run-time
- checks a source code program in a ".java" file for compile-
- checks a bytecode program in a ".class" file for compile-
- none of the above
errors and if there are none, it generates bytecode for that program in a ".class" file
time errors and, if there are none, it generates bytecode for that program in a ".class" file
time errors and if there are none, it generates source code for that program in a ".java" file
Correct answer: c
Question : Which statement correctly defines a java constant?
- const SPECIAL = 1234;
- int SPECIAL = 1234;
- int final SPECIAL = 1234;
- final int SPECIAL = 1234;
- const int SPECIAL = 1234;
Correct answer: d
Question : What is the value of s after the following
statement:
String s = (!true) + " : " + (10 + 4) + " is 104";
a. "!true : 104 is 104"
b. "false : 104 is 104"
c. "!true : 14 is 104"
d. "false : 14 is 104"
- This is a compile-time error
Correct answer: d
Question : The Checkstyle plugin for Eclipse is useful
because:
- it warns you of potential compile-time errors
- it helps you make your code understandable for yourself
and other programmers
- it prevents your code from making errors caught by assert
- it tells you when code you have written does not obey its
- none of the above
statements
contract
Correct answer: b
Question : If x is an int variable, when does the boolean
expression evaluate to true?
((x % 5 != 0) && (x % 2 != 0))
- when x is divisible by 5 or by 2 but not by both
- when x is divisible by 10
- when x is not divisible by 10
- when x is neither divisible by 5 nor by 2
- when x is either divisible by 5 or by 2