




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































Multiple Choice Identify the choice that best completes the statement or answers the question.
____ 1. What is wrong with the following “skeleton” of a Java program?
public class MyClass { public static void main(String args[]) {
} }
A. public and class on the first line should be interchanged B. MyClass name is wrong C. There should not be a [ ] after args D. Nothing is wrong E. None of these
____ 2. Which line of code will cause Hello to be printed?
A. System.out.println(“Hello”); D. All of these B. System.out.println(Hello); E. None of these C. System.out.println(“Hello”)
A. FireAnts D. Pants on fire B. Fire Ants E. None of these C. Fire Ants
A. rem D. comment B. \ E. None of these C. //
Answer Section
Answer Section
...both B and C are illegal
PTS: 1
Multiple Choice Identify the choice that best completes the statement or answers the question.
B. illegal code E. None of these C. 8
A. Heather (one space after the ‘r’) D. 8Jones B. er Jones E. None of these C. Jones
A. Jon D. ather Jones B. one E. None of these C. ones
B. 8 E. None of these C. 7
A. beaver cleaver D. eEAVER cLEAVER B. BEAVER CLEAVER E. None of these C. b
Multiple Choice Identify the choice that best completes the statement or answers the question.
B. 3 E. None of these C. 2
A. p++ D. p + 1 B. ++p E. None of these C. 1 - p
A. x = x + j; D. j = j + x; B. x + j = x; E. None of these C. x + x = j;
A. w = w + 6; D. Both A and B B. w += 6 E. Both B and C C. w++
A. x +=9; D. x = ++9; B. x = 9; E. More than one of these C. 9 = x;
Answer Section
... answer is p-- or --p
PTS: 1
PTS: 1
Answer Section
... it would seem at first glance that A is illegal; however, 5/2 is done with integer arithmetic yielding an answer of 2.... and that’s legal to store in int i.
PTS: 1
PTS: 1
Multiple Choice Identify the choice that best completes the statement or answers the question.
A. Math.sqrt(139.46); D. (139.46)^(1/2); B. println(sqrt(139.46)); E. None of these C. System.out.println(Math.sqrt(139.46));
A. System.out.println(PI.math); D. System.out.println(Math.pi); B. System.out.println(“pi”); E. System.out.println(Math.PI); C. System.out.println(PI);
B. 209 E. None of these C. 208.
A. double d = Math.pow(4.052, 3.1); D. double d = 3.1^(4.052) B. double d = Math.pow(3.1, 4.052); E. None of these C. double d = 3.1(pow(4.052));
Multiple Choice Identify the choice that best completes the statement or answers the question.
A. int, data, server D. String, int, double B. String, document, file E. None of these C. picture, text, file
A. double fract = kbReader.nextDouble(); D. double fract = kbReader.nextDbl( ); B. double fract = kbReader.next( ); E. None of these C. double fract = kbReader.nextInt( );
A. String name = kbReader.next( ); D. String name = kbReader.get( ); B. String name = kbReader.nextLine( ); E. More than one of these C. String name = kbReader.nextString( );
A. int count = kbReader.nextInt( ); D. int count = kbReader.next( ); B. int count = kbReader.nextInt; E. More than one of these C. int count = kbReader.nextDouble( );
Answer Section
Answer Section
Lesson 9 _Quiz
Multiple Choice Identify the choice that best completes the statement or answers the question.
A. if-else {
}
D. If( ) {
} {
} else
B. {if( )
} {else
}
E. None of these
C. If( ) {
} else {
}
A. Elvis D. Presley (has a leading space) B. ElvisPresley E. None of these C. Elvis Presley
Lesson 9 _Quiz Answer Section
Multiple Choice Identify the choice that best completes the statement or answers the question.
A. char, int D. String, int B. int, double E. char, String C. char, double
A. Provides for error control B. Provide for anything not specifically covered by one of the cases C. Provides flow control D. default is not part of a switch structure E. None of these
B. 2 E. None of these C. 3