Download D. A and C

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
8 Pages
Contestant Number_____________
Time_____________
Rank_____________
JAVA PROGRAMMING (41)
Regional—2007
Using J2SE (JDK) version 5.0
Test Contents
Objective Portion (25 @ 10 points each)
Application
TOTAL POINTS
____________( 250 pts.)
____________( 250 pts.)
_________(500 pts.)
Failure to adhere to any of the following rules will result in disqualification:
1. Contestant must hand in this test booklet and all printouts. Failure to do so will result in
disqualification.
2. No equipment, supplies, or materials other than those specified for this event are allowed
in the testing area. No previous BPA tests and/or sample tests or facsimile (handwritten,
photocopied, or keyed) are allowed in the testing area.
3. Electronic devices will be monitored according to ACT standards.
No more than ten (10) minutes orientation
No more than 90 minutes testing
No more than ten (10) minutes wrap-up
Do NOT open test booklet until instructed to do so.
Property of Business Professionals of America. May be reproduced only for use in the Business
Professionals of America Workplace Skills Assessment Program competition.
JAVA PROGRAMMING
REGIONAL 2007
PAGE 2 of 8
1.
Identify the primitive data types from the list below?
A.
Integral
B.
Floating-point
C.
Boolean
D.
All of the above
2.
Which of the following primitive data type(s) do not contain decimal values?
A.
char
B.
double
C.
byte
D.
A and C
3.
The statement x + y is an example of a
A.
unary operator
B.
binary operator
C.
overloaded constructor
D.
inheritance
4.
Which of the following operators is considered the modulus operator?
A.
%
B.
/
C.
*/
D.
None of the above
5.
Given the java code below, determine which of the four statements is most correct.
2.4 * 2 – 11.4 + 6 / 9
A.
B.
C.
D.
6.
The first math operation to be done is 6 / 9
The result is a non-decimal number
2.4 * 2 will be the first math operation done
The result is greater then 6
Which of the following statements casts a decimal number as an integer?
A.
(double)(25)
B.
(double)(25.3)
C.
(int)(25.3)
D.
None of the above
JAVA PROGRAMMING
REGIONAL 2007
PAGE 3 of 8
7.
Which of the following is not a primitive data type?
A.
string
B.
char
C.
short
D.
byte
8.
Which of the following keywords is used to identify a value that can not change?
A.
private
B.
final
C.
static
D.
const
9. Which of the following commands allows the user to enter input from the standard input
device?
A.
System.getline() = new Scanner(System.in);
B.
Scanner readit = new Scanner(System.in);
C.
Both A and B
D.
Neither A nor B
10.
A method named HelloWorld()takes no arguments and returns nothing. If you have to
define this method, which of the following is the more correct declaration?
A.
HelloWorld();
B.
HelloWorld(void);
C.
void HelloWorld();
D.
void HelloWorld(void);
11.
Given an object named console that will read from the standard input stream, which of
the following statements will read in an integer?
A.
console.next();
B.
console.Int();
C.
console.ReadInt();
D.
console.Read();
12.
Which of the following is an example of post-increment notation on a variable X?
A
Y+=X;
B.
++X;
C.
X++;
D.
X+=Y;
JAVA PROGRAMMING
REGIONAL 2007
PAGE 4 of 8
13.
When concatenating strings, which operator is used?
A.
[]
B.
+
C.
=
D.
-
14.
Which of the following statements is not true about System.out?
A.
System.out.print does an automatic carriage return.
B.
System.out.println allows the use of escape sequences.
C.
System.out.ReadInt() is not a valid command.
D.
All of the above statements are true.
15.
Which of the following statements most accurately represents compound assignment
notation?
A.
B.
C.
D.
16.
X++;
Z = X + Y;
Z*=X;
++X;
Predict the output from the following code.
X = 0;
Y = 3;
System.out.println(“The result is” + Y+=4);
A.
B.
C.
D.
The result is 4
The result is X + 7
The result is 7
run-time error
17.
Which of the statements are true given an object named console to read from the standard
input stream?
A.
console.Readln() will read an entire line.
B.
console.next() will read a decimal value.
C.
console.Nextline() will read an entire line and not do a carriage return
D.
All are not true
JAVA PROGRAMMING
REGIONAL 2007
PAGE 5 of 8
18.
Which of the four solutions best describes the output of the expression (int)(6.8 + 7.7)?
A.
B.
C.
D.
19.
Not a valid operation
The same as (int)(6.8) + (int)(7.7)
14
Both A and B
JVM is an acronym for what?
A.
B.
C.
D.
Java Virtual Main()
Java Vital Machine
Java Virtual Machine
None of the above
20.
In a Java application, identify the name of the method that always is evoked?
A.
init
B.
main
C.
class
D.
begin
21.
Given the following declaration which of the following statements equals to true?
boolean b1 = true;
boolean b2 = false;
A.
B.
C.
D.
22.
b1 == b2;
b1 || b2;
b1 |& b2;
b1 && b2;
Which of the following best describes the purpose of a constructor?
A.
B.
C.
D.
To initialize data in a class
To initialize data in a class and import needed class files
To import needed class files
None of the above
JAVA PROGRAMMING
REGIONAL 2007
PAGE 6 of 8
23.
In a Java Applet, identify the name of the method that is executed first.
A.
B.
C.
D.
24.
Which of the following keywords is most likely to be used in inheritance?
A.
B.
C.
D.
25.
init
main
class
begin
implements
public
private
extends
Java programs are compiled into what?
A.
B.
C.
D.
ASCII
bytecode
Unicode
They are not compiled
JAVA PROGRAMMING
REGIONAL 2007
PAGE 7 of 8
Application Scoring
documentation
program header
variables described
input
calculations
output
________(10)
________(10)
________(10)
________(10)
________(10)
total
_______(50)
misc program
throw Exception included
total
________(10)
declaration of variables
Scanner
principle
rate
interest
decimalformat
total
________(20)
________(10)
________(10)
________(10)
________(20)
conversion of string input to double
parseDouble or other
total
________(20)
formulas
interest
total ________(10)
total
_______(10)
_______(70)
_______(20)
________(10)
_______(20)
output of test data
looks like provided sample
use of provided test data
decimal format
total
________(10)
________(10)
________(20)
hardcopy / output
source code
screen shots (3)
total
________(10)
________(30)
_______(40)
_______(40)
Total Application _______(250)
JAVA PROGRAMMING
REGIONAL 2007
PAGE 8 of 8
Application Program
Make sure that contestant # is written on all output that is turned in with this booklet.
You are to write a Java console (command line) computer program that will calculates interest.
You should be concerned with the following points when developing your program:
1.
2.
3.
4.
5.
6.
7.
8.
Prompt the user for principle amount to use
Prompt the user for interest rate to use
Calculate interest
Display the total principle at end of one year
Format all numerical output with 2 decimal points
Use test data
Print out 3 screen-shoots, one for each set of test data
Print out source code
1) Sample Input/Output Screen:
2) test data to enter:
principle
100
125.5
225.25
interest rate
12
8.25
11.375