100% found this document useful (5 votes)
16 views

Test Bank for Intro to Java Programming, Comp Version, 10/E 10th Edition : 0133813460 download

The document provides links to various test banks and solution manuals for different editions of Java programming textbooks and other subjects. It includes specific questions and answers related to Java programming concepts, such as reading input, variable naming conventions, and numeric data types. Additionally, it covers programming exercises and examples relevant to the curriculum of the mentioned textbooks.

Uploaded by

ruiqiegal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (5 votes)
16 views

Test Bank for Intro to Java Programming, Comp Version, 10/E 10th Edition : 0133813460 download

The document provides links to various test banks and solution manuals for different editions of Java programming textbooks and other subjects. It includes specific questions and answers related to Java programming concepts, such as reading input, variable naming conventions, and numeric data types. Additionally, it covers programming exercises and examples relevant to the curriculum of the mentioned textbooks.

Uploaded by

ruiqiegal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 68

Test Bank for Intro to Java Programming, Comp

Version, 10/E 10th Edition : 0133813460 download

http://testbankbell.com/product/test-bank-for-intro-to-java-
programming-comp-version-10-e-10th-edition-0133813460/

Find test banks or solution manuals at testbankbell.com today!


We have selected some products that you may be interested in
Click the link to download now or visit testbankbell.com
for more options!.

Solution Manual for Intro to Java Programming, Comp


Version, 10/E 10th Edition : 0133813460

http://testbankbell.com/product/solution-manual-for-intro-to-java-
programming-comp-version-10-e-10th-edition-0133813460/

Introduction to Java Programming Comprehensive Version


10th Edition Liang Test Bank

http://testbankbell.com/product/introduction-to-java-programming-
comprehensive-version-10th-edition-liang-test-bank/

Test Bank for Introduction to Java Programming,


Comprehensive Version, 9/E 9th Edition : 0133050572

http://testbankbell.com/product/test-bank-for-introduction-to-java-
programming-comprehensive-version-9-e-9th-edition-0133050572/

2012 Nursing Care of Children Principles and Practice, 4e


Test Bank

http://testbankbell.com/product/2012-nursing-care-of-children-
principles-and-practice-4e-test-bank/
CCH Federal Taxation Comprehensive Topics 2012 Smith
Harmelink Edition Test Bank

http://testbankbell.com/product/cch-federal-taxation-comprehensive-
topics-2012-smith-harmelink-edition-test-bank/

Solution manual for Auditing: A Risk-Based Approach to


Conducting a Quality Audit Johnstone Gramling Rittenberg
9th Edition
http://testbankbell.com/product/solution-manual-for-auditing-a-risk-
based-approach-to-conducting-a-quality-audit-johnstone-gramling-
rittenberg-9th-edition/

Test Bank for General, Organic, and Biological Chemistry:


Structures of Life, 6th Edition, Karen C. Timberlake

http://testbankbell.com/product/test-bank-for-general-organic-and-
biological-chemistry-structures-of-life-6th-edition-karen-c-
timberlake/

Test Bank for Cognition, 6/E Mark H. Ashcraft Gabriel A.


Radvansky

http://testbankbell.com/product/test-bank-for-cognition-6-e-mark-h-
ashcraft-gabriel-a-radvansky/

Test Bank for Automotive Technology A Systems Approach,


6th Edition

http://testbankbell.com/product/test-bank-for-automotive-technology-a-
systems-approach-6th-edition/
Test Bank for Psychology: Themes and Variations 10th
Edition Weiten

http://testbankbell.com/product/test-bank-for-psychology-themes-and-
variations-10th-edition-weiten/
chapter2.txt
Intro to Java Programming, Comp Version, 10/E 10th

Full chapter download at: https://testbankbell.com/product/test-bank-for-intro-to-java-


programming-comp-version-10-e-10th-edition-0133813460/

Chapter 2 Elementary Programming

Section 2.3 Reading Input from the Console


1. Suppose a Scanner object is created as follows:

Scanner input = new Scanner(System.in);

What method do you use to read an int value?

a. input.nextInt();
b. input.nextInteger();
c. input.int();
d. input.integer();
Key:a

#
2. The following code fragment reads in two numbers:

Scanner input = new Scanner(System.in);


int i = input.nextInt();
double d = input.nextDouble();

What are the correct ways to enter these two numbers?

a. Enter an integer, a space, a double value, and then the Enter key.
b. Enter an integer, two spaces, a double value, and then the Enter key.
c. Enter an integer, an Enter key, a double value, and then the Enter key.
d. Enter a numeric value with a decimal point, a space, an integer, and then the
Enter key.
Key:abc
#
6. is the code with natural language mixed with Java code.

a. Java program
b. A Java statement
c. Pseudocode
d. A flowchart diagram
key:c

#
3. If you enter 1 2 3, when you run this program, what will be the output?

Page 1
import java.util.Scanner; chapter2.txt

public class Test1 {


public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter three numbers: ");

Page 2
chapter2.txt
double number1 = input.nextDouble();
double number2 = input.nextDouble();
double number3 = input.nextDouble();

// Compute average
double average = (number1 + number2 + number3) / 3;

// Display result
System.out.println(average);
}
}

a. 1.0
b. 2.0
c. 3.0
d. 4.0
Key:b

#
4. What is the exact output of the following code?

double area = 3.5;


System.out.print("area");
System.out.print(area);

a. 3.53.5
b. 3.5 3.5
c. area3.5
d. area 3.5
Key:c

#
Section 2.4 Identifiers
4. Every letter in a Java keyword is in lowercase?
a. true
b. false
Key:a

#
5. Which of the following is a valid identifier?
a. $343
b. class
c. 9X
d. 8+9
e. radius
Key:ae

Page 3
chapter2.txt
Section 2.5 Variables
6. Which of the following are correct names for variables according to Java
naming conventions?
a. radius
b. Radius
c. RADIUS
d. findArea
e. FindArea
Key:ad

#
7. Which of the following are correct ways to declare variables?
a. int length; int width;
b. int length, width;
c. int length; width;
d. int length, int width;
Key:ab

#
Section 2.6 Assignment Statements and Assignment Expressions
8. is the Java assignment operator.
a. ==
b. :=
c. =
d. =:
Key:c

#
9. To assign a value 1 to variable x, you write
a. 1 = x;
b. x = 1;
c. x := 1;
d. 1 := x;
e. x == 1;
Key:b

#
10. Which of the following assignment statements is incorrect?
a. i = j = k = 1;
b. i = 1; j = 1; k = 1;
c. i = 1 = j = 1 = k = 1;
d. i == j == k == 1;
Key:cd

#
Section 2.7 Named Constants
11. To declare a constant MAX_LENGTH inside a method with value 99.98, you write
a. final MAX_LENGTH = 99.98;
Page 4
chapter2.txt
b. final float MAX_LENGTH = 99.98;
c. double MAX_LENGTH = 99.98;
d. final double MAX_LENGTH = 99.98;
Key:d

#
12. Which of the following is a constant, according to Java naming conventions?
a. MAX_VALUE
b. Test
c. read
d. ReadInt
e. COUNT
Key:ae

#
13. To improve readability and maintainability, you should declare
instead of using literal values such as 3.14159.
a. variables
b. methods
c. constants
d. classes
Key:c

#
Section 2.8 Naming Conventions
60. According to Java naming convention, which of the following names can be
variables?
a. FindArea
b. findArea
c. totalLength
d. TOTAL_LENGTH
e. class
Key:bc

#
Section 2.9 Numeric Data Types and Operations
14. Which of these data types requires the most amount of memory?
a. long
b. int
c. short
d. byte
Key:a

#
34. If a number is too large to be stored in a variable of the float type, it
.
a. causes overflow
b. causes underflow

Page 5
chapter2.txt
c. causes no error
d. cannot happen in Java
Key:a

#
15. Analyze the following code:

public class Test {


public static void main(String[] args) {
int n = 10000 * 10000 * 10000;
System.out.println("n is " + n);
}
}
a. The program displays n is 1000000000000
b. The result of 10000 * 10000 * 10000 is too large to be stored in an int
variable n. This causes an overflow and the program is aborted.
c. The result of 10000 * 10000 * 10000 is too large to be stored in an int
variable n. This causes an overflow and the program continues to execute because
Java does not report errors on overflow.
d. The result of 10000 * 10000 * 10000 is too large to be stored in an int
variable n. This causes an underflow and the program is aborted.
e. The result of 10000 * 10000 * 10000 is too large to be stored in an int variable
n. This causes an underflow and the program continues to execute because Java does
not report errors on underflow.
Key:c

#
16. What is the result of 45 / 4?
a. 10
b. 11
c. 11.25
d. 12
Key:b 45 / 4 is an integer division, which results in 11

#
18. Which of the following expression results in a value 1?
a. 2 % 1
b. 15 % 4
c. 25 % 5
d. 37 % 6
Key:d 2 % 1 is 0, 15 % 4 is 3, 25 % 5 is 0, and 37 % 6 is 1

#
19. 25 % 1 is
a. 1
b. 2
c. 3
d. 4

Page 6
chapter2.txt
e. 0
Key:e

#
20. -25 % 5 is
a. 1
b. 2
c. 3
d. 4
e. 0
Key:e

#
21. 24 % 5 is
a. 1
b. 2
c. 3
d. 4
e. 0
Key:d

#
22. -24 % 5 is
a. -1
b. -2
c. -3
d. -4
e. 0
Key:d

#
23. -24 % -5 is
a. 3
b. -3
c. 4
d. -4
e. 0
Key:d

#
30. Math.pow(2, 3) returns .
a. 9
b. 8
c. 9.0
d. 8.0
Key:d It returns a double value 8.0.

Page 7
chapter2.txt
30. Math.pow(4, 1 / 2) returns .
a. 2
b. 2.0
c. 0
d. 1.0
e. 1
Key:d Note that 1 / 2 is 0.

#
30. Math.pow(4, 1.0 / 2) returns .
a. 2
b. 2.0
c. 0
d. 1.0
e. 1
Key:b Note that the pow method returns a double value, not an integer.
#
31. The method returns a raised to the power of b.

a. Math.power(a, b)
b. Math.exponent(a, b)
c. Math.pow(a, b)
d. Math.pow(b, a)
Key:c

#
Section 2.10 Numeric Literals
15. To declare an int variable number with initial value 2, you write
a. int number = 2L;
b. int number = 2l;
c. int number = 2;
d. int number = 2.0;
Key:c

#
32. Analyze the following code.

public class Test {


public static void main(String[] args) {
int month = 09;
System.out.println("month is " + month);
}
}
a. The program displays month is 09
b. The program displays month is 9
c. The program displays month is 9.0
d. The program has a syntax error, because 09 is an incorrect literal value.
Key:d Any numeric literal with the prefix 0 is an octal value. But 9 is not an octal

Page 8
chapter2.txt
digit. An octal digit is 0, 1, 2, 3, 4, 5, 6, or 7.

#
15. Which of the following are the same as 1545.534?
a. 1.545534e+3
b. 0.1545534e+4
c. 1545534.0e-3
d. 154553.4e-2
Key:abcd

#
Section 2.11 Evaluating Expressions and Operator Precedence
24. The expression 4 + 20 / (3 - 1) * 2 is evaluated to
a. 4
b. 20
c. 24
d. 9
e. 25
Key:c

#
Section 2.12 Case Study: Displaying the Current Time
58. The System.currentTimeMillis() returns .
a. the current time.
b. the current time in milliseconds.
c. the current time in milliseconds since midnight.
d. the current time in milliseconds since midnight, January 1, 1970.
e. the current time in milliseconds since midnight, January 1, 1970 GMT (the
Unix time).
Key:e

#
24. To obtain the current second, use .
a. System.currentTimeMillis() % 3600
b. System.currentTimeMillis() % 60
c. System.currentTimeMillis() / 1000 % 60
d. System.currentTimeMillis() / 1000 / 60 % 60
e. System.currentTimeMillis() / 1000 / 60 / 60 % 24
Key:c

#
24. To obtain the current minute, use .
a. System.currentTimeMillis() % 3600
b. System.currentTimeMillis() % 60
c. System.currentTimeMillis() / 1000 % 60
d. System.currentTimeMillis() / 1000 / 60 % 60
e. System.currentTimeMillis() / 1000 / 60 / 60 % 24
Key:d

Page 9
chapter2.txt

#
24. To obtain the current hour in UTC, use _.
a. System.currentTimeMillis() % 3600
b. System.currentTimeMillis() % 60
c. System.currentTimeMillis() / 1000 % 60
d. System.currentTimeMillis() / 1000 / 60 % 60
e. System.currentTimeMillis() / 1000 / 60 / 60 % 24
Key:e

#
Section 2.13 Augmented Assignment Operators
24. To add a value 1 to variable x, you write
a. 1 + x = x;
b. x += 1;
c. x := 1;
d. x = x + 1;
e. x = 1 + x;
Key:bde

#
25. To add number to sum, you write (Note: Java is case-sensitive)
a. number += sum;
b. number = sum + number;
c. sum = Number + sum;
d. sum += number;
e. sum = sum + number;
Key:de

#
26. Suppose x is 1. What is x after x += 2?
a. 0
b. 1
c. 2
d. 3
e. 4
Key:d

#
27. Suppose x is 1. What is x after x -= 1?
a. 0
b. 1
c. 2
d. -1
e. -2
Key:a

Page 10
Visit https://testbankbell.com
now to explore a rich
collection of testbank,
solution manual and enjoy
exciting offers!
chapter2.txt
28. What is x after the following statements?

int x = 2;
int y = 1;
x *= y + 1;

a. x is 1.
b. x is 2.
c. x is 3.
d. x is 4.
Key:d

#
29. What is x after the following statements?

int x = 1;
x *= x + 1;

a. x is 1.
b. x is 2.
c. x is 3.
d. x is 4.
Key:b

#
29. Which of the following statements are the same?

(A) x -= x + 4
(B) x = x + 4 - x
(C) x = x - (x + 4)

a. (A) and (B) are the same


b. (A) and (C) are the same
c. (B) and (C) are the same
d. (A), (B), and (C) are the same
Key:a

#
Section 2.14 Increment and Decrement Operators
21. Are the following four statements equivalent?
number += 1;
number = number + 1;
number++;
++number;
a. Yes
b. No
Key:a

Page 11
chapter2.txt
#
34. What is i printed?
public class Test {
public static void main(String[] args) {
int j = 0;
int i = ++j + j * 5;

System.out.println("What is i? " + i);


}
}
a. 0
b. 1
c. 5
d. 6
Key:d Operands are evaluated from left to right in Java. The left-hand operand of a
binary operator is evaluated before any part of the right-hand operand is evaluated.
This rule takes precedence over any other rules that govern expressions. Therefore,
++j is evaluated first, and returns 1. Then j*5 is evaluated, returns 5.

#
35. What is i printed in the following code?

public class Test {


public static void main(String[] args) {
int j = 0;
int i = j++ + j * 5;

System.out.println("What is i? " + i);


}
}
a. 0
b. 1
c. 5
d. 6
Key:c Same as before, except that j++ evaluates to 0.

#
36. What is y displayed in the following code?

public class Test {


public static void main(String[] args) {
int x = 1;
int y = x++ + x;
System.out.println("y is " + y);
}
}
a. y is 1.
b. y is 2.

Page 12
chapter2.txt
c. y is 3.
d. y is 4.
Key:c When evaluating x++ + x, x++ is evaluated first, which does two things: 1.
returns 1 since it is post-increment. x becomes 2. Therefore y is 1 + 2.

#
37. What is y displayed?

public class Test {


public static void main(String[] args) {
int x = 1;
int y = x + x++;
System.out.println("y is " + y);
}
}
a. y is 1.
b. y is 2.
c. y is 3.
d. y is 4.
Key:b When evaluating x + x++, x is evaluated first, which is 1. X++ returns 1 since
it is post-increment and 2. Therefore y is 1 + 1.

#
Section 2.15 Numeric Type Conversions
38. To assign a double variable d to a float variable x, you write
a. x = (long)d
b. x = (int)d;
c. x = d;
d. x = (float)d;
Key:d

#
17. Which of the following expressions will yield 0.5?
a. 1 / 2
b. 1.0 / 2
c. (double) (1 / 2)
d. (double) 1 / 2
e. 1 / 2.0
Key:bde 1 / 2 is an integer division, which results in 0.

#
39. What is the printout of the following code:

double x = 5.5;
int y = (int)x;
System.out.println("x is " + x + " and y is " + y);
a. x is 5 and y is 6
b. x is 6.0 and y is 6.0

Page 13
chapter2.txt
c. x is 6 and y is 6
d. x is 5.5 and y is 5
e. x is 5.5 and y is 5.0
Key:d The value is x is not changed after the casting.

#
40. Which of the following assignment statements is illegal?
a. float f = -34;
b. int t = 23;
c. short s = 10;
d. int t = (int)false;
e. int t = 4.5;
Key:de

#
41. What is the value of (double)5/2?
a. 2
b. 2.5
c. 3
d. 2.0
e. 3.0
Key:b

#
42. What is the value of (double)(5/2)?
a. 2
b. 2.5
c. 3
d. 2.0
e. 3.0
Key:d

#
43. Which of the following expression results in 45.37?
a. (int)(45.378 * 100) / 100
b. (int)(45.378 * 100) / 100.0
c. (int)(45.378 * 100 / 100)
d. (int)(45.378) * 100 / 100.0
Key:b

#
43. The expression (int)(76.0252175 * 100) / 100 evaluates to .
a. 76.02
b. 76
c. 76.0252175
d. 76.03
Key:b In order to obtain 76.02, you have divide 100.0.

Page 14
chapter2.txt
#
44. If you attempt to add an int, a byte, a long, and a double, the result will
be a value.
a. byte
b. int
c. long
d. double
Key:d

#
Section 2.16 Software Life Cycle
1. is a formal process that seeks to understand the problem and

document in detail what the software system needs to do.


a. Requirements specification
b. Analysis
c. Design
d. Implementation
e. Testing
Key:a
#
1. System analysis seeks to analyze the data flow and to identify the

system’s input and output. When you do analysis, it helps to identify what the
output is first, and then figure out what input data you need in order to produce
the output.
a. Requirements specification
b. Analysis
c. Design
d. Implementation
e. Testing
Key:b

#
0. Any assignment statement can be used as an assignment expression.
a. true
b. false
Key:a

#
1. You can define a constant twice in a block.
a. true
b. false
Key:b
#
44. are valid Java identifiers.
a. $Java
b. _RE4
Page 15
chapter2.txt
c. 3ere
d. 4+4
e. int
Key:ab

#
2. You can define a variable twice in a block.
a. true
b. false
Key:b

#
3. The value of a variable can be changed.
a. true
b. false
Key:a

#
4. The result of an integer division is the integer part of the division; the
fraction part is truncated.
a. true
b. false
Key:a

#
5. You can always assign a value of int type to a variable of long type without
loss of information.
a. true
b. false
Key:a

#
6. You can always assign a value of long type to a variable of int type without
loss of precision.
a. true
b. false
Key:b

#
13. A variable may be assigned a value only once in the program.
a. true
b. false
Key:b

#
14. You can change the value of a constant.
a. true
b. false

Page 16
chapter2.txt
Key:b

#
2. To declare a constant PI, you write
a. final static PI = 3.14159;
b. final float PI = 3.14159;
c. static double PI = 3.14159;
d. final double PI = 3.14159;
Key:d

#
3. To declare an int variable x with initial value 200, you write
a. int x = 200L;
b. int x = 200l;
c. int x = 200;
d. int x = 200.0;
Key:c

#
4. To assign a double variable d to an int variable x, you write
a. x = (long)d
b. x = (int)d;
c. x = d;
d. x = (float)d;
Key:b

#
8. Which of the following is a constant, according to Java naming conventions?
a. MAX_VALUE
b. Test
c. read
d. ReadInt
Key:a

#
9. Which of the following assignment statements is illegal?
a. float f = -34;
b. int t = 23;
c. short s = 10;
d. float f = 34.0;
Key:d

#
10. A Java statement ends with a .
a. comma (,)
b. semicolon (;)
c. period (.)
d. closing brace

Page 17
chapter2.txt
Key:b

#
11. The assignment operator in Java is .
a. :=
b. =
c. = =
d. <-
Key:b

#
12. Which of these data types requires the least amount of memory?
a. float
b. double
c. short
d. byte
Key:d

#
13. Which of the following operators has the highest precedence?
a. casting
b. +
c. *
d. /
Key:a

#
17. If you attempt to add an int, a byte, a long, and a float, the result will
be a value.
a. float
b. int
c. long
d. double
Key:a

#
18. If a program compiles fine, but it terminates abnormally at runtime, then
the program suffers .
a. a syntax error
b. a runtime error
c. a logic error
Key:b

#
24. What is 1 % 2?
a. 0
b. 1
c. 2
Page 18
chapter2.txt
Key:b

#
26. What is the printout of the following code:

double x = 10.1;
int y = (int)x;
System.out.println("x is " + x + " and y is " + y);

a. x is 10 and y is 10
b. x is 10.0 and y is 10.0
c. x is 11 and y is 11
d. x is 10.1 and y is 10
e. x is 10.1 and y is 10.0
Key:d

#
32. The compiler checks .
a. syntax errors
b. logical errors
c. runtime errors
Key:a

#
33. You can cast a double value to _.
a. byte
b. short
c. int
d. long
e. float
Key:abcde
#
34. The keyword must be used to declare a constant.
a. const
b. final
c. static
d. double
e. int
Key:b

#
37. pow is a method in the class.
a. Integer
b. Double
c. Math
d. System
Key:c

Page 19
chapter2.txt
#
38. currentTimeMills is a method in the class.
a. Integer
b. Double
c. Math
d. System
Key:d

#
39. 5 % 1 is
a. 1
b. 2
c. 3
d. 4
e. 0
Key:e

#
40. 5 % 2 is
a. 1
b. 2
c. 3
d. 4
e. 0
Key:a

#
41. 5 % 3 is
a. 1
b. 2
c. 3
d. 4
e. 0
Key:b

#
42. 5 % 4 is
a. 1
b. 2
c. 3
d. 4
e. 0
Key:a

#
43. 5 % 5 is
a. 1

Page 20
Visit https://testbankbell.com
now to explore a rich
collection of testbank,
solution manual and enjoy
exciting offers!
chapter2.txt
b. 2
c. 3
d. 4
e. 0
Key:e

#
43. -5 % 5 is
a. -1
b. -2
c. -3
d. -4
e. 0
Key:e

#
43. -15 % 4 is
a. -1
b. -2
c. -3
d. -4
e. 0
Key:c

#
43. -15 % -4 is
a. -1
b. -2
c. -3
d. -4
e. 0
Key:c

#
43. A variable must be declared before it can be used.
a. True
b. False
Key:a

#
43. A constant can be defined using using the final keyword.
a. True
b. False
Key:a

#
43. Which of the following are not valid assignment statements?
a. x = 55;

Page 21
chapter2.txt
b. x = 56 + y;
c. 55 = x;
d. x += 3;
Key:c

Page 22
Sample Final Exam for CSCI 1302

FINAL EXAM AND COURSE OUTCOMES MATCHING


COURSE OUTCOMES
Upon successful completion of this course, students should be able to
1. understand OO concepts: encapsulation, inheritance, polymorphism, interfaces,
abstract classes
2. use Unified Modeling Language for design, analysis, and documentation
3. develop graphical user interfaces
4. develop event-driven programs
5. use file I/O and handle exceptions
6. design and implement OO programs

Here is a mapping of the final comprehensive exam against the course outcomes:

Question Matches outcomes


1 1
2 2
3 3, 4, 5
4 6, 7
5 1, 2, 3, 4, 5, 6, 7

1
Name: CSCI 1302 Introduction to Programming
Covers chs8-19 Armstrong Atlantic State University
Final Exam Instructor: Dr. Y. Daniel Liang

Please note that the university policy prohibits giving the exam score by email. If you need to know your
final exam score, come to see me during my office hours next semester.

I pledge by honor that I will not discuss the contents of this exam with
anyone.
Signed by Date

1. Design and implement classes. (10 pts)

Design a class named Person and its two subclasses named Student and
Employee. Make Faculty and Staff subclasses of Employee. A person has a
name, address, phone number, and email address. A student has a class
status (freshman, sophomore, junior, or senior). Define the status as a
constant. An employee has an office, salary, and date hired. Define a
class named MyDate that contains the fields year, month, and day. A
faculty member has office hours and a rank. A staff member has a title.
Override the toString method in each class to display the class name
and the person's name.

Draw the UML diagram for the classes. Write the code for the Student
class only.

2
2. Design and use interfaces (10 pts)

Write a class named Octagon that extends GeometricObject


and implements the Comparable and Cloneable interfaces.
Assume that all eight sides of the octagon are of equal
size. The area can be computed using the following formula:
area  (2  4 / 2) * side * side

Draw the UML diagram that involves Octagon,


GeometricObject, Comparable, and Cloneable.

3
3. Design and create GUI applications (10 pts)

Write a Java applet to add two numbers from text fields, and
displays the result in a non-editable text field. Enable your applet
to run standalone with a main method. A sample run of the applet is
shown in the following figure.

4
4. Text I/O (10 pts)

Write a program that will count the number of characters (excluding


control characters '\r' and '\n'), words, and lines, in a file. Words
are separated by spaces, tabs, carriage return, or line-feed
characters. The file name should be passed as a command-line argument,
as shown in the following sample run.

5
5. Multiple Choice Questions: (1 pts each)
(1. Mark your answers on the sheet. 2. Login and click Take
Instructor Assigned Quiz for QFinal. 3. Submit it online
within 5 mins. 4. Close the Internet browser.)
1. describes the state of an object.

a. data fields
b. methods
c. constructors
d. none of the above

#
2. An attribute that is shared by all objects of the class is coded
using .
a. an instance variable
b. a static variable
c. an instance method
d. a static method

#
3. If a class named Student has no constructors defined explicitly,
the following constructor is implicitly provided.

a. public Student()
b. protected Student()
c. private Student()
d. Student()

#
4. If a class named Student has a constructor Student(String name)
defined explicitly, the following constructor is implicitly provided.

a. public Student()
b. protected Student()
c. private Student()
d. Student()
e. None

#
5. Suppose the xMethod() is invoked in the following constructor in
a class, xMethod() is in the class.

public MyClass() {
xMethod();
}

a. a static method
b. an instance method
c. a static method or an instance method

#
6. Suppose the xMethod() is invoked from a main method in a class as
follows, xMethod() is in the class.

public static void main(String[] args) {

6
xMethod();
}

a. a static method
b. an instance method
c. a static or an instance method

#
7. What would be the result of attempting to compile and
run the following code?
public class Test {
static int x;

public static void main(String[] args){


System.out.println("Value is " + x);
}
}

a. The output "Value is 0" is printed.


b. An "illegal array declaration syntax" compiler error occurs.
c. A "possible reference before assignment" compiler error occurs.
d. A runtime error occurs, because x is not initialized.

#
8. Analyze the following code:

public class Test {


private int t;

public static void main(String[] args) {


Test test = new Test();
System.out.println(test.t);
}
}

a. The variable t is not initialized and therefore causes errors.


b. The variable t is private and therefore cannot be accessed in the
main method.
c. Since t is an instance variable, it cannot appear in the static
main method.
d. The program compiles and runs fine.

#
9. Suppose s is a string with the value "java". What will be
assigned to x if you execute the following code?

char x = s.charAt(4);

a. 'a'
b. 'v'
c. Nothing will be assigned to x, because the execution causes the
runtime error StringIndexOutofBoundsException.
d. None of the above.

#
10. What is the printout for the following code?

class Test {

7
public static void main(String[] args) {
int[] x = new int[3];
System.out.println("x[0] is "+x[0]);
}
}

a. The program has a syntax error because the size of the array
wasn't specified when declaring the array.
b. The program has a runtime error because the array elements are
not initialized.
c. The program runs fine and displays x[0] is 0.
d. None of the above.

#
11. How can you get the word "abc" in the main method from the
following call?

java Test "+" 3 "abc" 2

a. args[0]
b. args[1]
c. args[2]
d. args[3]

#
12. Which code fragment would correctly identify the number of
arguments passed via the command line to a Java application,
excluding the name of the class that is being invoked?

a. int count = args.length;


b. int count = args.length - 1;
c. int count = 0; while (args[count] != null) count ++;
d. int count=0; while (!(args[count].equals(""))) count ++;

#
13. Show the output of running the class Test in the following code
lines:

interface A {
void print();
}

class C {}

class B extends C implements A {


public void print() { }
}

class Test {
public static void main(String[] args) {
B b = new B();
if (b instanceof A)
System.out.println("b is an instance of A");
if (b instanceof C)
System.out.println("b is an instance of C");
}
}

8
Visit https://testbankbell.com
now to explore a rich
collection of testbank,
solution manual and enjoy
exciting offers!
Random documents with unrelated
content Scribd suggests to you:
“Guess that proves that it comes from outside,” Jack chuckled as
he sat down on the foot of Bob’s bed.
“Good boy. I never thought of that,” Bob declared.
“Well, haven’t I always told you that I used my head for
something else than a hat rack?” Jack asked.
“I never disputed it. But suppose you raise the shade again and
see if it’s still there.”
Jack quickly did as his brother suggested but the spot did not
reappear.
“Now listen,” Bob ordered.
Two or three minutes passed then, seemingly from a great
distance, came that same weird laugh.
“Did you hear it?” Bob asked.
“Sure did.”
“Then I didn’t dream it.”
“Not this time anyhow,” Jack assured him.
“Well, I never heard of a ghost that could be stopped by anything
so thin as a window curtain so that makes it certain that it’s due to
some human agency. Not that I ever thought otherwise,” he
hastened to add, “but it’s kind of comforting to have positive
evidence.”
“You bet,” Jack agreed.
They talked for some time longer, but as the spot did not again
appear, Bob finally said:
“Well I reckon the show’s over for tonight so we might as well go
to sleep again.”
“Guess that curtain kind of fazed his ghostship,” Jack chuckled as
he groped his way back to his bed.
But he came back before reaching it to say:
“How about getting up early and reconnoitering a bit?”
“Good idea. What time is it?”
“Half past one,” Jack replied glancing at the luminous face of his
wrist watch.
“All right, I’ll call you about four and we’ll scout around.”
Bob possessed the faculty of being able to awake at any time
fixed in his mind on going to sleep so he had no fear of oversleeping
and in a few minutes they were both once more in the land of nod.
The eastern sky was just beginning to redden when he shook his
brother.
“Come on if you’re going ghost hunting with me,” he said.
“Be with you in the shake of a dog’s tail,” Jack replied as he
sprang from his bed.
“Which way’ll we go?” Jack asked as soon as they were out of
doors.
“Which way did you think that laugh came from?”
“It seemed to be from up the lake.”
“Same here. Suppose we go that way.”
“Suits me.”
“And we want to be careful not to overlook anything,” Bob
cautioned.
“You bet. Say, Bob, we ought to have Kernertok and his dog,
Sicum, here. I’ll bet he’d track ’em or it down.”
It was still dark in the thick woods, but the light was increasing
every minute and, as soon as they were well away from the camp,
Bob proposed that they sit down and wait a little until it got lighter.
“We might miss something in the dark,” he said.
“Probably you mean, that is, if there’s anything to miss,” Jack
agreed.
In half an hour Bob declared that it was light enough and they
started off through the thick forest paralleling the shore of the lake.
They went very slowly searching every foot of the way for some sign
that would serve as a clue: a fresh foot print, a newly broken twig or
some other indication of the recent passing of human beings.
“It’s been so dry lately that I’m afraid foot prints wouldn’t show
anyway,” Bob declared after they had gone about a hundred rods
and had found nothing.
“If we only had a nose like a dog’s now we might be able to do
something,” Jack added.
A few minutes later Bob stooped and picked something from the
ground with an exclamation of satisfaction.
“What is it?” Jack, who at the moment was a few feet behind him,
asked.
Bob held out his hand and in it was the stump of a cigarette about
an inch long.
“Huh, is that all?”
“But it means that someone has been here.”
“Sure, but how long ago?”
“Since the last rain. You can see that it has never been wet
because the paper would have turned brown if it had and there’s not
the least trace of it except at the end where it was in someone’s
mouth.”
“I reckon you’re right there, Sherlock,” Jack admitted.
“And Mr. Sleeper doesn’t smoke and Jacques always smokes a
pipe. At least I never saw him smoke a cigarette.”
For the better part of an hour they searched the ground all
around the place but in vain. No other trace could they find.
“It beats me,” Jack declared finally. “I thought we knew
something about woodcraft and all that sort of thing, but the fellow
who dropped that stub has us skinned a mile.”
“Unless he dropped it from an air ship,” Bob suggested.
“Are you serious?”
“Hardly. Still I suppose it might have happened that way.”
“Well, let’s go on. We don’t need to be back for a couple of
hours.”
After they had covered perhaps a mile more with no results, Bob
suggested that they cut over to the lake and follow the shore back.
“We might find where a boat was pulled up,” he said.
For the greater part of the way the trees grew close to the water’s
edge and they found it very hard going, but they were used to
pushing their way through places where it seemed almost impossible
to pass.
“One thing’s sure,” Jack panted as he climbed over a fallen tree,
“No one could have landed along here and got through this stuff
without leaving some marks.”
They were about half way back when they came to a place where
there was a bit of beach. It was rocky but between the rocks were
patches of sand and Bob’s quick eye caught sight of a foot print
imbedded deeply in the soft sand.
“Here’s something,” he cried as he stooped over to examine the
mark.
For some minutes he gazed at the print while Jack was eagerly
hunting for others. But in this he was unsuccessful. That one was
the only foot print on that part of the shore.
“Looks as though he had tried to step only on the stones and had
made a single misstep,” he said as he came back to where Bob was
still kneeling.
“That would be easy,” Bob agreed as he straightened up.
“Well, what do you make of it, Sherlock? How tall was he and
what was the color of his hair?” Jack grinned.
“You ought to know that it takes at least two foot prints to judge
a man’s height by and we’ve only one, but look at it yourself and see
if it tells you anything.”
“Hum, ’bout a number eight and it wasn’t a moccasin. That’s
about the limit of my deductions,” Jack declared a moment later.
“You hit all except the important points,” Bob smiled.
“Such as what?”
“Well, in the first place, that print was made by a heavy man and
—”
“I might have mentioned that except that I thought it was too
obvious,” Jack interrupted.
“And again it was made by a man from the city.”
“Not necessarily. He might have found those pointed toed shoes
or they might have been given to him or—”
“Deductions are seldom absolute,” Bob broke in. “I’m only stating
what is probable and you never saw a native with a pair of shoes,
that would make that mark, on his feet.”
“My error. Pray proceed.” Jack humbly apologized.
“And most significant of all that print was made within the last
twelve hours.”
“How do you know that?”
“It’s easy. As you see it is not more than a foot from the water
and if you’ll remember there was a strong wind blowing this way just
before sundown yesterday.”
“And there must have been surf enough to have washed the print
out if it had been there then,” Jack finished.
“Exactly.”
“But I don’t see how he got away from here without leaving a
trail.”
“Neither do I and that fact rather downs my theory that he was a
city man,” Bob acknowledged.
For another half hour they searched the surrounding
neighborhood but without any result and finally started back arriving
at the camp just as Jacques blew the rising horn.
“What’s next?” Jack asked when they were back in their cabin.
“Seems to me our best bet is to be outside tonight.”
“My idea exactly.”
For the first time since they had been there the day passed slowly
to the boys anxious as they were for the night to come. They had
decided not to tell the Sleepers what they had seen deeming it best
to keep it to themselves for the present at least.
That night was very dark as there was no moon and the stars
were obscured by thick clouds so they were unable to see more than
three or four feet ahead of themselves as they stole softly out of the
cabin shortly after eleven o’clock. The window at the foot of Bob’s
bed faced the north and it was in that direction they turned their
steps. The forest began not more than forty feet from the cabin so
they had but a short distance to go.
“He or they must have been about here,” Bob whispered as they
paused beneath a large spruce.
“Couldn’t have been much further back,” Jack agreed.
“Then suppose you take this tree and I’ll get one a bit over this
way.”
“Righto.”
Jack quickly swung himself into the lower branches of the tree
while Bob moved off to the right. About ten feet above the ground
he found a convenient crotch and proceeded to make himself as
comfortable as circumstances would permit. How still it was. No
breeze stirred the branches and save for an occasional croak of a
frog no sound broke the silence. An hour passed and Jack was
finding it difficult to keep awake. He wondered how Bob was making
out in his perch a few yards away, and if he was as sleepy as he
was.
He had just glanced at his watch and noted that it was a quarter
past twelve when a shrill cry rang through the forest. It was a cry of
fear or pain, he was not sure which and, for a moment he waited
uncertain what to do. Then he heard Bob’s voice from beneath the
branch.
“What was that cry?”
“Just what I was going to ask you.”
“Did you think it came from the Sleepers’ cabin?”
“Shouldn’t say so. It sounded farther off than that.”
“I’m not so sure about that.”
“Then I reckon we’d better go see,” Jack said as he dropped
lightly to the ground.
They made their way as rapidly as possible toward the cabin, not
daring to make use of their flash lights, and had nearly reached it
when a voice ordered:
“That’s near enough.”
At the same instant a beam of light sprang from the porch.
“That you Mr. Sleeper?” Bob asked in a low tone.
“Is that you, Bob?” The man asked instead of replying to his
question.
“It’s me all right,” Bob said as he stepped forward.
Mr. Sleeper had a rain coat over his pajamas and in his hand was
a revolver which he slipped into the pocket of the coat as the boys
came up on the porch.
“Did you hear that yell a few minutes ago?” he asked.
“Yes, sir, we heard it and wasn’t sure but what it came from your
cabin. That’s why we came to see,” Bob told him.
“You got dressed mighty quick.”
“Because we were not undressed,” Bob explained.
“Been roosting out in the trees,” Jack added.
“Roosting in trees! I don’t quite understand.”
“I’ll tell you all about it,” Bob said and explained what had
happened.
“This bids fair to be quite an interesting problem,” Mr. Sleeper
declared as soon as he had finished. “That yell didn’t come from this
cabin, but it wasn’t a great way off. Haven’t I read that a wild cat
makes a cry like that?”
“That was no cat,” Jack assured him. “It’s a fact that they do
sound something like it, but there’s a difference.”
“You have heard them?”
“Lots of times. If you’d ever heard one you could tell the
difference.”
“Then you think it was a man?”
“Either a man or a woman. No four-legged animal around here
makes a noise like that.”
Just then the door of the cabin opened and a voice asked:
“Did you catch it, daddy?”
“Not yet, kitten.”
“Well, please take this.”
In the dim light the boys saw her hand her father a small object
and the next moment he burst into laughter.
“That kid’ll never learn to be serious I’m afraid,” he said as he
held the thing out for the boys to see.
It was a small salt shaker.
“Thought you’d better put some on its tail,” Jack laughed.
“It’s the only way he’d ever catch anything except a cold,” the girl
chuckled loudly enough for them all to hear.
“I’ll catch you if you don’t get back to bed,” Mr. Sleeper tried to
make his voice stern as he started toward the door but it slammed
almost in his face and he laughingly turned back.
“She carries too many guns for me,” he sighed.
Suddenly Jack grasped Bob by the arm. “Look over there toward
Katahdin,” he ordered.
As Bob turned his eye quickly caught what had caused Jack’s
exclamation. Far away, seemingly nearly a mile high in the heavens,
a light was flashing. It would appear and disappear a few times in
rapid succession and then would go out for a time only to begin
again a moment later.
“It’s a signal of some sort,” Bob declared, “and unless I’m
mistaken its Morse. Hold your flash here quick.”
Searching his pockets he quickly found a pencil and a scrap of
paper and began writing down the letters as the strange light spelled
them out.
L-F-P-A-S-T-E-L-E-V-E-N-T-O-M-O-R-R-O-W
Then the light stopped and although they waited for some time it
did not reappear.
“You got ’em just in the nick of time,” Jack declared as Bob
passed the paper to him. “That first word’s half, of course.”
“And the fellow who was signaling must have been on the very
top of Katahdin,” Bob asserted.
“Have you any idea what it means?” Mr. Sleeper asked.
“Only that something’s due to happen at eleven thirty tomorrow
night.”
“Why not at eleven thirty in the forenoon?” Jack asked.
“It’s possible, of course, but it’s more likely to be at night,” Bob
insisted.
They talked a while longer and then, as nothing more happened,
the boys returned to their own cabin.
“Suppose we go up in the morning,” Bob said as they were
undressing.
“Up where?”
“Up Katahdin, of course.”
“Just the ticket. We may find out something and we’ll have the
trip anyway.”
As soon as breakfast was over they asked Jacques to put them up
a lunch telling him that they were going to climb Katahdin. Was it
fancy or did Bob detect a strange hint of fear in the half-breed’s eyes
as he told him their destination? He was not sure for his expression
changed almost instantly and a smile of assent took its place.
“She ver’ hard climb,” he warned them.
“I reckon,” Bob agreed.
“Mebby you wait go some other day. Look lak rain today.”
Bob was not sure but fancied there was a note of eagerness in
the man’s voice.
“Oh, well, we can’t any more than get wet,” he declared and the
man offered no more objection.
“It’s a good thing we brought those pocket radios with us,” Bob
said when they were back in the cabin.
“Why, what you going to do with them?”
“We’ll leave one with Mr. Sleeper and take the other with us.”
“Good idea.”
The radios mentioned were a recent invention which they had
worked and were very compact, a small selenium plate taking the
place of the ordinary aerial.
Mr. Sleeper displayed great interest when they showed him the
outfit and explained how it worked.
“Sure I’ll keep one and if you get into any trouble just let me
know,” he said as soon as they had told him their plans. “I’d like to
go with you but I’m afraid I couldn’t stand it. I’m not much of a
walker. Broke my leg a few years ago and it never was set right.
Gives out if I attempt to walk very far.”
“But my legs are all right and I want to go.”
“I was afraid you were listening behind that door.”
“But I can go?” Helen asked eagerly.
“Not this time, kitten. This is no trip for a girl.”
“We’ll take you up there before the summer’s over,” Bob promised.
“Did you notice anything peculiar about Jacques when I told him
where we’re going?” Bob asked as he pushed the canoe off and dug
his paddle deep in the water.
“No, why?”
“I just wondered.”
“But did you?”
“Well, I hardly know. Perhaps I just imagined it but it seemed to
me that he wasn’t very anxious for us to go.”
“But what earthly reason could he have?”
“Haven’t an idea unless he’s mixed up in this mess in some way.”
“But you don’t think—”
“No I don’t think he is but you never can tell, you know,” Bob
interrupted.
It was shortly after eight o’clock when they reached the dam.
“Have ye seed thot ghost yit?” the keeper asked them as they
drew the canoe from the water.
“Not yet,” Bob smiled.
“Where you goin’?”
“Going to climb Katahdin,” Jack told him.
“Thot’s a pretty stiff climb so it is but it’s meself as guesses ye’re
good fer it. But by the way, ye’d better kape yer eyes open ’cause
that’s someone up thar.”
“What do you mean?” Bob asked.
“Faith an’ I mane whot I say. I seen a light up thar most ivery
night fer a wake or more.”
“What kind of a light?”
“I dunno, but it was a flashing light, like as if somebody was
makin’ a signal.”
“Well, we’ll be on the look-out,” Bob promised as they started
down the gorge.
CHAPTER VI
THE CAVE ON THE MOUNTAIN.

The foot of the mountain was seven miles from the dam and the
going very rough especially through the gorge where they were
obliged to leap from one big rock to another as they followed the
bed of the stream.
“Good thing Mr. Sleeper didn’t come if he’s got a game leg,” Jack
panted as they stopped to rest a moment.
“Reckon he’d have found it pretty rough sledding.”
They soon started on again and about eleven o’clock reached the
foot of Katahdin where they again stopped to rest.
“It’s going to be some climb on a hot day,” Jack declared wiping
his forehead.
“We’ll take it easy, there’s lots of time.”
“What are you doing here?”
Both boys started violently at the sound of a strange voice. A few
feet away, leaning against a big pine, stood a man only a few years
older than Bob. He was dressed in a rough tweed knicker suit with a
cap to match. His face, although pleasant enough, bore plainly the
signs of dissipation; the eyes slightly bloodshot and puffed lids as
well as the red nose evidenced the life he had led.
“I beg your pardon,” Bob said politely, “but were you speaking to
us?”
“Who did you suppose I was speaking to?” the man demanded
angrily.
“Well really, I supposed you were talking to us only I wanted to
make sure, you know,” drawled Bob.
The man’s arrogant tone had maddened him and he put into his
voice all the contempt possible.
“Don’t you get fresh.” The man took a step forward and Bob got
up from the log on which he had been sitting. “I want to know what
you are doing here.”
“What we are doing here,” Bob repeated slowly. “Well now that’s
funny.”
“What’s funny about it?”
“Oh, just a thought I had. It really doesn’t matter, you know.”
Jack was having all he could do to keep from laughing as he
heard his brother fencing with the stranger. He could see that the
latter was rapidly losing control of his temper and knew that that
was just what Bob was after.
“Are you going to answer my question?”
“Why sure, we’re just sitting here, that’s all. What are you doing?”
“That’s none of your business.”
“No?”
“Certainly not.”
“And might I ask you why it’s any more your business what we’re
doing?”
“Because I choose to make it.”
“Oh.”
“I’ll ‘Oh’ you,” the man snapped taking a step forward with
clinched fists.
But he evidently thought better of his intention when he saw that
Bob also took a step to meet him and that his fists were also
clinched.
“Are you going up the mountain?” he demanded, falling back to
his former position.
“Maybe.”
“Well, you’d better not.”
“If not why not?” Bob tantalized.
“Because I say so.”
“And you think that’s a good reason?”
“You’ll find out if you try it.”
“Thanks, I only was asking for information. Come on Jack, we
might as well be on our way.”
As they turned to go Bob glanced back in time to see the man
reach his hand back to his hip pocket but he evidently thought
better of it for he drew the hand away empty.
“Nice pleasant fellow,” Jack said as soon as they were out of
hearing.
“Very. Did you see his shoes?”
“Can’t say I noticed them, why?”
“Nothing only they looked as though they might have made that
track in the sand we found yesterday.”
“But what do you suppose he’s doing away off here?”
“Ask me something easy. But unless he was bluffing we’re likely to
find out unless we keep our eyes open.”
If the going had been bad so far it was worse now. The mountain
was heavily wooded nearly to the top and there was a good deal of
underbrush through which at times they had to literally push their
way. Then, in places, it was very steep and they were obliged to pull
themselves up by grabbing hold of branches. They had pushed on in
this way for a half hour when Bob, who was slightly in the lead,
stopped and held up his hand.
“Listen,” he whispered.
“I don’t hear anything,” Jack said after a moment’s pause.
“Perhaps I was mistaken but I was sure I heard a bush crack off
there to the right.”
“A deer maybe,” Jack ventured.
“No, a deer wouldn’t have made just one crack like that. I’ve had
the feeling ever since we left that fellow that we were being
followed.”
“Think it’s he?”
“Maybe. You stay here a minute. I’ll be right back.”
Bob got onto his hands and knees and noiselessly disappeared in
the thick brush. It was perhaps fifteen minutes before he returned
as silent as he had gone.
“Guess I was mistaken,” he said. “I couldn’t find a trace of
anyone.”
“Then I guess there was no one there.”
“Maybe not, but keep your eyes peeled. I have a hunch that
there’s someone on our trail.”
“Mighty funny there’s no path up this mountain,” Jack puffed a
few minutes later, as he paused to wipe the sweat from his face.
“There probably is only we haven’t struck it,” Bob smiled.
For another half hour they pushed on, now climbing over rocks
and the next moment forcing their way through heavy underbrush.
Suddenly Bob, who at the time was a few feet ahead, stopped and
held up his hand.
“What’s wrong?” Jack whispered as he crept up to him.
“Peep out there,” Bob told him holding the low branch of a tree
aside.
Through the opening Jack could see the front of a rough shanty
only a few feet away.
“Did you see anyone?” he asked drawing back.
“No.”
“Then why all the caution?”
“Better to be careful than sorry,” Bob whispered.
“Well, shall we investigate or go around?”
“What do you think?”
“I say investigate.”
“Come on, then, but keep your eyes open.”
As they crept forward they saw that the building, evidently many
years old and constructed of rough boards, was built so that its back
was close against a cliff the top of which reached thirty or more feet
above the roof. There was no sign of life about the place and, as
they drew nearer, they saw that the door was open a few inches.
“Looks kind of spooky,” Jack whispered.
They were close to the door and Bob, after listening a moment,
pushed it open and entered, closely followed by Jack. A hasty glance
about told them that the place was empty so far as living beings
were concerned. And the same statement was nearly true as regards
other things. An old table so rickety that it seemed about ready to
fall to the ground, and the remains of two or three chairs completed
the inventory.
“Not much here,” Jack declared.
“Does look rather forlorn,” Bob agreed.
As he spoke his eye caught sight of a door at the back of the
room.
“Wonder where this door goes to,” he said as he started across
the room.
Unlike the rest of the building the door appeared to be of recent
construction. The boards were thick and much newer than those of
the shack proper and it was closed by a heavy bar across the
middle.
“Take a look outside while I see if I can open it,” Bob said, as he
placed his hand on the bar.
The bar fitted so snugly that it required some effort to remove it
and Jack was back just as he succeeded in pulling it out.
“All quiet along the Potomac,” he announced.
The door dragged a bit on the bottom but they soon had it open.
Stygian darkness greeted them as they looked in, but both had flash
lights with them and in a moment were throwing the rays about.
They were in what appeared to be a natural cave some thirty feet
wide and twice as long as the roof being very irregular but averaging
about ten feet from the ground. The place was entirely empty, so far
as they could see.
“What do you know about it?” Jack asked.
“It would make a good prison,” Bob replied.
“I’ll say it would.”
“Looks as though there might be a passage in the back part
there,” Bob said as he started for the back of the cave.
He had taken but a single step, however, when a startled
exclamation from Jack caused him to wheel about. By the light of his
torch he saw that his brother was struggling in the grasp of a man
and as he sprang to his assistance he received a heavy blow on the
side of his head which stretched him senseless on the floor.
When consciousness began slowly to drift back he was at first
aware only of a severe headache. Slowly he opened his eyes but he
might as well have kept them closed. It was so dark that he could
see absolutely nothing. For a moment he wondered what it was all
about, then memory came back with a rush and he whispered:
“Jack.”
There was no answer and he tried it again a little louder. This time
he was relieved when his brother answered.
“Thank God, you’re alive, Bob. I was afraid they had killed you.”
“Where are you, Jack?”
“Over here, tied up.”
Then Bob realized that he too was tied. His hands were bound
behind his back and his feet securely fastened together. A bit of
straining at the bonds soon convinced him that whoever had done it
had made a good job.
“Are you all right?” Jack asked anxiously.
“I guess so. Head’s a bit sore and it aches like fury, but I don’t
think it’s broke. Can you roll over this way?”
“Guess so,” and a moment later Jack’s body bumped into him.
“What happened?” Bob asked.
“Can’t tell you much it was so sudden. I didn’t hear a thing, but a
man grabbed me from behind and I tried to shout. Then I saw you
go down and although I made things lively for a minute or two I was
no match for the two of them and they soon had me trussed up.”
“Did you get a look at them?”
“Not enough to amount to anything. I wouldn’t know them from
Adam but I don’t think I ever saw them before but I’m not sure.
How’s your head?”
“Sore, but it feels a bit better.”
“Are you tied tight?”
“Sure am. How about you?”
“Got a little slack. I remembered your method and did the best I
could.”
Bob was an expert in getting free from bonds. His hands were
smaller than most boys when compared with the size of his wrists
and long practice had enabled him to set his muscles in such a way
that no matter how tightly they were bound together he could, on
relaxing, get enough slack to free himself. But now, having been tied
while he was unconscious, he was unable to obtain the least bit of
slack.
“If only my hands weren’t so large,” Jack groaned as he strained
at the rope. “I don’t suppose you can get a mite of slack.”
“Not a bit.”
“Then I reckon it’s up to me.”
Bob could hear him as he pulled and strained.
“Take it easy,” he cautioned. “It’s mighty easy to rub the skin off
and that makes it harder.”
“I can almost do it but not quite,” Jack announced a few minutes
later.
“Roll over here and let’s see if I can help any with my teeth.”
He found that Jack’s hands were tied with a piece of half-inch
rope which seemed to be nearly new. At any rate it was so stiff that,
although he worked until he could taste the blood from his gums, he
could not make the slightest impression on it.
“I’m afraid it’s no use,” he said sadly.
“How about trying with your hands?”
“We’ll try it,” Bob agreed as he rolled over and hitched forward
until he could touch the rope with his fingers.
“My hands are tied so tight that they’re numb,” he said after a few
minutes of vain effort.
“Well, let me work at it again. I may do it in time.”
For a time the only sound to be heard was Jack’s grunting as he
tugged at the rope. Bob hoped almost against hope that he might
succeed and more than once he breathed a silent prayer.
“There, at last,” Jack grunted. “And I don’t believe I peeled off
more than about a yard of skin.”
“You got it?”
“Sure have. Just a minute and I’ll tend to you.”
“But suppose they come back?”
“Gracious, I never thought of that. I suppose we’d better play it
safe and wait a bit.”
“I think so, but I do wish you’d see if you can loosen up this rope
a trifle. It hurts like the dickins.”
After he had worked at the rope on Bob’s wrists for a few minutes
he managed to loosen it enough to give him considerable relief. “It’s
no wonder you couldn’t get free,” he declared as he slipped his hand
back into the loop and stretched out on the floor.
All the time Bob had been listening for a sound on the other side
of the door but had heard nothing.
“Did they search us?” he asked a moment later.
“I’ll say they did. Took everything we had I guess.”
“Then they got the radio?”
“Yep.”
“That’s too bad. If they’d missed it we could have called Mr.
Sleeper.”
“And if wishes were horses beggers could ride,” Jack quoted.
For some time they were silent then Bob said:
“Do you know, Jack, there’s something funny about this business.”
“That just occurred to you?” Jack asked.
“No, but I’m serious.”
“Serious? I hope to goodness you don’t think I’m fooling.”
“Well, what do you make of it?”
“Just what do you mean?”
“I mean is there any connection between the fellows who’ve got
us tied up here and whoever is cutting up monkeydidoes at the
camp?”
“My, but you do have a wonderful faculty for asking easy
questions,” Jack declared after a moment’s pause.
“Well, of course—”
Bob started to speak but just then his ear caught a sound and he
stopped.
“Someone’s at the door,” he whispered.
A moment later the door was swung open and someone stepped
inside closing it behind him. For an instant a beam of light played
about the cave until it rested on them, then the man came slowly
toward them. When he was close to them he spoke and both
recognized the voice as belonging to the young man they had met
earlier in the day.
“Well, I warned you that you’d get into trouble if you kept on, and
you see I was right.”
“That’s so,” Bob agreed.
“Your name’s Golden, isn’t it?”
“Yes.”
“And he’s your brother?”
“Yes.”
“I’ve heard of you.”
“Such is fame.”
“I suppose you’ve been wondering why we tied you up.”
“Naturally.”
“And you can’t guess?”
“Haven’t yet.”
“Well I’d save my breath if I were you.”
“Thanks, but it doesn’t take much breath to think,” Jack broke in.
“May I ask what you are going to do with us?” Bob inquired.
“Nothing, if you are reasonable.”
“And what do you call reasonable?”
“I mean if you’ll do as I say.”
“And what’s that?”
“Go straight home and stay away from this part of the woods and
keep your mouths shut.”
“That’s some sweeping order,” Jack broke in.
“And suppose we don’t promise?” Bob asked.
“Then you stay right here, that’s all.”
“How long can we have to make up our minds?”
“Well, I’ve got to go up the mountain a piece and you may have
till I get back, which will probably be in a half hour or so.”
“Thanks. We’ll have our answer ready by that time,” Bob assured
him.
Before leaving the room the man examined their bonds and was
apparently satisfied with their condition.
“I’ve heard that you couldn’t be tied so that you couldn’t get
away,” he told Bob as he bent over him. “But I guess Skeets did the
trick this time or else you haven’t tried.”
“Oh, I tried all right but he tied me while I was unconscious and
that makes a lot of difference.”
“I reckon so. Well, talk it over and let me know what you decide
when I get back. I really have nothing against you boys and have no
desire to injure you, but I’ve got to look out for number one, you
know, and just now it doesn’t suit me to have you around here.”
He went out and they could hear him as he slipped the bar in
place.
“Wait five minutes and then free yourself,” Bob whispered.
At the end of the time they had heard no sound and Jack set to
work and soon they were both free.
“How about those other two fellows?” Jack asked as he loosened
the last knot about Bob’s ankles.
“That’s a chance we’ll have to take,” Bob replied. “I’m going on
the assumption that they’ve gone off somewhere, but I may be
wrong and if I am—well we’ve taken chances before.”
“Sure we have,” Jack agreed.
“It’s darker than the ace of spades,” Bob declared as they groped
their way across the cave till they reached the side where the door
was placed.
“We must jump him the instant he opens the door,” Bob
explained. “He had a business like looking automatic in his hand
when he came in and he’ll probably have it all ready this time.”
“Well, here’s hoping he won’t have a chance to use it.”
Slowly the time passed until they judged that he had been gone
nearly an hour although they could only guess at the time as their
watches had been taken away from them together with all their
other possessions. But finally they heard someone enter the outer
room and a moment later the bar was removed and the door pushed
cautiously open. The man did not enter at once but threw the light
from his flash into the cave. Knowing that he would at once discover
their absence from the spot where he had left them, Bob did not
wait but at once sprang for the opening. With a smothered cry the
man tried to draw back but Bob was too quick for him and almost
before he could make a move he had him around the neck and was
bearing him down to the ground.
Bang!
The gun went off with a sound which nearly deafened them but
the bullet fortunately did no damage and before he could again
press the trigger Jack, had seized his wrist and with a violent twist
sent the gun spinning several feet away. Feeling sure that Bob would
be able to handle him now that he was disarmed, he quickly
retrieved the gun and then turned to watch the combat ready to
help if his brother was in need of it. But, as he had thought, Bob
was having no trouble in handling the situation. He had the man flat
on his back and one hand was on his throat. In fact the stranger had
ceased to struggle.
“Might as well let him up now, Bob,” Jack told him. “I’ve got his
gun.”
“Better see if he’s got another one first,” Bob suggested.
The man said nothing nor did he make any resistance as Jack
searched him.
“All right, you can let him up now. He has no other weapon.”
They were just outside the door of the cave and it was fairly light
in the room although there was but a single small window. As the
man got to his feet he seemed perfectly composed, a fact which
gave Bob a feeling of insecurity.
“We have decided not to give that promise,” he told him.
“So I judged,” the man smiled. “It would seem that, for the
moment, the tables are turned, as they say, and I guess it’s my turn
to ask what you are going to do with me.”
“I’m afraid we’ve hardly got that far in our plans. First would you
mind telling us where you have put the things you took from us?”
“You’ll find them over in that corner,” nodding his head toward
one of the corners farthest away from the cave.
“See if they’re all there, Jack.”
“All here including the lunch,” Jack announced a minute later.
“Good.” Then turning to the man he said: “I don’t suppose it will
be any good asking you what you’re doing up here and why you tied
us up.”
“I’m afraid not,” the man smiled.
“I thought not. Well ‘what’s sass for the goose’s sass for the
gander.’ If you’ll get that rope we’ll give him a taste of his own
medicine,” he said turning to Jack.
The man made not the slightest objection while they bound him
securely. Rather he seemed inexpressibly bored with the proceeding.
“I don’t know how expert you are at getting a rope off,” Bob said
as soon as they had finished, “But I rather think that will hold you
for awhile.”
“If you are satisfied I guess I’ll have to be,” he smiled.
Grabbing him by the shoulders Bob dragged the man into the
cave and then returned to the outer room closing the door behind
him. After he had slipped the bar in place he turned to Jack.
“Well, what’s next?”
“Lunch,” Jack declared without hesitation.
“All right, but let’s make it snappy.”
“Is there any rush?”
“I think so. Didn’t you notice anything queer about that fellow?”
“Only that he didn’t seem much worried.”
“That’s it exactly. Why didn’t he?”
“You mean he expects those other fellows to show up soon?”
“Exactly.”
“I reckon you’re right.”
While they were talking they had been eating and they made a
hasty meal of it.
“Now let’s beat it,” Jack proposed washing down the last mouthful
with a drink of water from a small thermos bottle.
“I don’t quite like the idea of leaving him here,” Bob said slowly.
“Suppose he was only bluffing and they don’t come. He might starve
to death.”
“Well, how about taking him with us?”
“I hardly like to do that. Wouldn’t it be better to take the bar
away and fix those ropes so that he can work them off after a bit?”
“All right.”
Bob removed the bar and threw open the door at the same time
flashing the light onto the floor of the cave where he had left the
man.
“Guess he’s been doing some rolling,” he said to Jack, who was
just behind him, as he failed to see him.
“Well, he can’t be far,” Jack declared as he stepped into the cave
ahead of Bob. “Well, what do you know about that?” he asked a
moment later after the beam of light had searched the entire cave
and had failed to disclose the man.
“He’s gone!” Bob gasped as he realized the fact.
“But it’s impossible.”
“I know, but it seems to be a fact nevertheless.”
A hurried search of the cave gave them not the slightest hint as to
the manner in which the man had made his escape. The place, at
the back of the cave, which had appeared to be a possible means of
egress proved only a short cul-de-sac and so far as they could see
there was no other opening save the front door.
“If you want my advice we’d better beat it right now while the
beating’s good,” Bob declared after they had made a complete circuit
of the cave and were once more in the outer room.
“You said it. Come on.”
Quickly they gathered up their belongings and, a moment later,
started off down the mountain as fast as they could go.
CHAPTER VII
A WARNING.

The two boys arrived back at the camp shortly before five o’clock.
During the return trip they had not seen a single person, even the
keeper of the dam being away when they got there.
“I don’t know about you, Bob, but believe me, I’m tired,” Jack
declared as he threw himself on his bed almost as soon as they had
entered their cabin.
“I don’t feel exactly rested myself,” Bob smiled as he followed suit.
For half an hour neither spoke again then a knock sounded on the
door and Mr. Sleeper came in.
“Well did you find the top of the mountain still there?” he asked.
“We didn’t get to the top,” Jack grinned.
“You didn’t?”
“No. You see we ran across what you might call unsurmountable
obstacles, so to speak.”
“But what—”
“I’ll tell you all about it,” Bob interrupted, and proceeded to give
him a full account of their adventures.
“Well, of all things,” Mr. Sleeper declared as he finished. “Why
didn’t you call me on that radio set?”
“Well, you see, while we were tied up we couldn’t and after we
got free and got our things back we figured that we’d better get
away without any unnecessary delay,” Bob told him.
“But you say there was no way to get out of that cave except
through the door?”
“I said we couldn’t find any. Of course there must be a way. A
man can’t just naturally evaporate, you know.”
“No, but isn’t it possible that there was some place in the cave
where he could hide?”
“It’s possible, of course, but we didn’t find any,” Bob assured him.
Just then the supper horn sounded and the boys hurried to wash
up for the meal.
“Did you ever know a fellow called Skeets?”
Supper was over and Bob and Jack had followed Jacques out into
the kitchen and it was Bob who asked the question.
“Skeets?” the breed repeated. “Heem big fellow wid long black
hair and whiskers and nose bent, eh?”
“I don’t know what he looks like.” Bob replied. “But I heard him
mentioned and just wondered if you know him.”
“Oui, me know heem. Heem one ter’ bad mans. Heem keel man
two tree year ago, but no could prove, but me know.”
“Have you seen him lately?”
“Non, no seen heem most two year. Heem ver’ bad mans. Me no
want see heem.”
“I would have liked to ask him if he knew about that cave but I
didn’t dare to.”
It was shortly after nine o’clock and the two boys were alone in
their cabin after a short sail on the lake with the Sleepers.
“You were wise not to,” Jack agreed.
“I’m glad you think so,” Bob assured him. “You see we don’t know
for sure just how he stands and until we do we’ve got to be mighty
careful. Not that I think he’s mixed up in it but, of course, there’s a
chance.”
“You going to sit up tonight?”
“Not for all the ghosts this side of—of—”
“Of where?”
“Well, I guess I don’t know,” Bob laughed. “But it’s me for the
hay.”
“Say, Bob,” Jack began a few minutes later after they had
undressed, “If I ask you a question, promise me that you won’t jump
down my throat.”
“I promise. What is it?”
“Has it ever occurred to you to wonder if the Sleepers are mixed
up in this ghost business? Careful now. You know you promised.”
Bob had started up as though greatly surprised at the question,
but he lay back again on the bed and for a moment did not answer.
“Well?”
“Just what made you ask that?”
“You answer my question first?”
“Yes.”
“Yes what?”
“It has occurred to me. Now what made you ask the question?”
“Because it occurred to me, I suppose. But you don’t think so, do
you?”
“No. Do you?”
“N-o-o-.”
“You say that rather doubtfully.”
“Well, there’s one thing about it that I can’t quite make out.”
“And that’s?”
“It’s Mrs. Sleeper not being afraid of ghosts. Why yesterday she
nearly fainted at the sight of an angle worm and she says she loves
ghosts. It doesn’t fit in somehow.”
Bob made no comment for a few minutes then he said:
“Well, it’s no use saying that the same thing hasn’t been in my
mind, for it has, but we must be very careful. The suspicion is far
from being proof or even evidence, you know. By the way I intended
to ask Jacques if any of the folks who had been seeing ghosts had
mentioned about that spot of light. You don’t think that would do
any harm, do you?”
“Don’t see why it should.”
“Well, we can ask him in the morning. Good night, sleep tight.”
“And don’t let the bugs bite,” Jack finished as he blew out the
light. Then he added: “If you see anything of that spot or any other
ghostly manifestation, let me know, will you?”
In less than five minutes both boys were fast asleep. Whether or
not the mysterious spot appeared that night they never knew for
neither awoke until the breakfast horn rang out at half past six the
next morning.
“See any ghosts?” Jack asked rubbing his eyes.
“Nary a ghost,” Bob replied as he jumped out of bed. “Come on,
lazy, make it snappy or you’ll be late to breakfast.”
“Be dressed as—I say, Bob, what’s that paper on your bed?”
Bob looked quickly around and saw, on the foot of his bed, a
sheet of paper folded once in the middle.
“Well, I’ll be jiggered,” he said a moment later, as he passed the
paper to Jack. “What do you know about that?”
Jack took it and read:
“If you know when you’re well off you’ll leave
here before night.”
There was no signature to the message which was printed in
crude letters.
“How’d it get there?” Jack asked as he stepped to the door and
tried the lock. “This door is locked.”
“Are you sure?”
“Try it yourself.”
“But you know—”
“You’re wrong. I don’t know, any more than I know how that
fellow got out of the cave,” Jack interrupted.
While he was talking Bob had been examining the window
opposite the door.
“No marks of anything here,” he announced. “This screen doesn’t
seem to have been moved.”
“Of course it hasn’t. You don’t think that ghost would be as
clumsy as all that, do you?”
“But how—”
“Tell me how he got out of the cave and I’ll tell you how that
letter got here—maybe.”
“But, Jack, this is serious.”
“You bet your life it is.”
“And I’m going to show it to Jacques and to the Sleepers and I
want you to watch them closely when I spring it on them. We may
get a clue.”
The other guests had not come in to the dining-room when they
got there and Jacques was busy at the table. Bob handed him the
paper without any word of explanation. The man looked at it, read it
several times, turned it over to look on the back and finally turned to
Bob.
“Whar you geet heem, eh?”
“It was on my bed this morning.”
“Huh! You keep heem door lock?”
“Yes the door was locked.”
Jacques scratched his head in evident perplexity.
“I dunno what tink,” he finally said. “What you do, eh? You go?”
“Not so you’d notice it,” Jack replied and as he spoke Bob fancied
that a look of relief came to the breed’s face.
“Maybe you geet hurt you stay here,” he said, but in a tone in
which Bob was sure there was only worriment.
“We’ll take a chance on that,” he said. “The fishing’s too good
here to let a thing like that scare us away.”
“And it’s probably only a joke anyway,” Jack added.
Just then the Sleepers, including Helen, entered the room and
after greeting them Bob showed them the note.
“You say you found this on your bed?” Mr. Sleeper asked after he
had examined it closely.
“Yes,” Bob replied.
“And do you lock your door at night?”
“We have been doing it since we’ve been up here and it was
locked this morning.”
“How about the windows?”
“There was no sign to indicate that anyone had crawled in,” Bob
assured him.
“But do you think it would have been possible?”
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

testbankbell.com

You might also like