Question
Comments used to document code should: A. be used as little as possible B. be insightful and explain what the instruction's intention is C. only
-
Comments used to document code should:
A. be used as little as possible
B. be insightful and explain what the instruction's intention is
C. only be included in code that is difficult to understand
D. be used to define variables whose names are not easy to understand
E. not be included with the program
2 points
QUESTION 2
-
The main method for a Java program is defined by:
A. public static main( )
B. public static main(String[ ] args);
C. public static main(String[ ] args)
D. private static main(String[ ] args)
E. none of the above
2 points
QUESTION 3
-
What is the result when the following line of Java code is executed:
System.out.println("Hello");
A. Do nothing
B. Cause Hello to be output
C. Cause a syntax error
D. Cause "(Hello)" to be output
E. There is no way to know without executing this line of code.
2 points
QUESTION 4
-
Which character below is not allowed to be used as an identifier?
A. P
B. x1
C. 0 (zero)
D. q
E. y2k
2 points
QUESTION 5
-
Which of the following would not be syntactically legal in Java?
A. public class Foo
B. System.out.println("Hi");
C. { }
D. static main(String[ ] args)
E. only b is legally valid, all of the rest are illegal
2 points
QUESTION 6
-
Which of the following would be a legal Java identifier?
A. i
B. class
C. ilikeclass!
D. idon'tlikeclass
E. I like class
2 points
QUESTION 7
-
A unique aspect of Java that allows code compiled on one machine to be executed on a machine of a different hardware platform is Javas:
A. bytecode
B. syntax
C. use of objects
D. use of exception handling
E. None of the above
2 points
QUESTION 8
-
Java is similar in syntax to what other high level language?
A. Pascal
B. Ada
C. C++
D. FORTRAM
E. BASIC
2 points
QUESTION 9
-
Which of the following is true regarding Java syntax and logic errors?
A. a Java compiler can determine if you have followed proper syntax but not proper logic
B. a Java compiler can determine if you have followed proper logic but not proper syntax
C. a Java compiler can determine if you have followed both proper syntax and logic
D. a Java compiler cannot determine if you have followed either proper syntax or logic
E. a Java compiler can determine if you have followed proper syntax and can determine if you have followed proper logic if you follow the Java naming convention rules
2 points
QUESTION 10
-
Of the following, which would be the best variable name for the current value of a stock?
A. curval
B. theCurrentValueOfThisStockIs
C. currentStockVal
D. csv
E. current
2 points
QUESTION 11
-
Which of the following is a legal Java identifier?
A. 1ForAll
B. OneForAll
C. one/4/all
D. 1_4_all
E. 1forall
2 points
QUESTION 12
-
Which of the following characters does not need to have an associated closing character in a Java program?
A. {
B. (
C. [
D. =
E. all of these require closing characters
2 points
QUESTION 13
-
Miss-typing println as printn will result in:
A. no error at all
B. a run-time error
C. a logical error
D. a syntax error
E. converting the statement into a comment
2 points
QUESTION 14
-
The word println is a(n):
A. String
B. action
C. variable
D. class
E. method
2 points
QUESTION 15
-
A Java variable is the name of a:
A. numeric data value stored in memory
B. data value stored in memory that cannot change its value during the programs execution
C. data value stored in memory that cannot change its data type during the programs execution
D. data value stored in memory that can change both its value and its type during the programs execution
E. data value or a class stored in memory that can change both its value and its type during the programs execution
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started