100% found this document useful (2 votes)
12 views

Introduction to Java Programming Comprehensive Version 10th Edition Liang Test Bank instant download

The document is a test bank for the 'Introduction to Java Programming Comprehensive, 10th Edition' by Y. Daniel Liang, containing various questions and answers related to Java programming concepts. It includes sections on reading input, identifiers, variables, assignment statements, and numeric data types, among others. Additionally, it provides links to download other related test banks and solution manuals for different editions and subjects.

Uploaded by

fefiivadnai
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 (2 votes)
12 views

Introduction to Java Programming Comprehensive Version 10th Edition Liang Test Bank instant download

The document is a test bank for the 'Introduction to Java Programming Comprehensive, 10th Edition' by Y. Daniel Liang, containing various questions and answers related to Java programming concepts. It includes sections on reading input, identifiers, variables, assignment statements, and numeric data types, among others. Additionally, it provides links to download other related test banks and solution manuals for different editions and subjects.

Uploaded by

fefiivadnai
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/ 56

Introduction to Java Programming Comprehensive

Version 10th Edition Liang Test Bank download pdf

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

Visit testbankbell.com today to download the complete set of


test banks or solution manuals!
We believe these products will be a great fit for you. Click
the link to download now, or visit testbankbell.com
to discover even more!

Test Bank for Introduction to Java Programming and Data


Structures Comprehensive Version, 12th Edition, Y. Daniel
Liang
http://testbankbell.com/product/test-bank-for-introduction-to-java-
programming-and-data-structures-comprehensive-version-12th-edition-y-
daniel-liang/

Solution Manual for Introduction to Java Programming and


Data Structures Comprehensive Version, 12th Edition Y.
Daniel Liang
http://testbankbell.com/product/solution-manual-for-introduction-to-
java-programming-and-data-structures-comprehensive-version-12th-
edition-y-daniel-liang/

Solution Manual for Introduction to Java Programming,


Brief Version, 11th Edition, Y. Daniel Liang

http://testbankbell.com/product/solution-manual-for-introduction-to-
java-programming-brief-version-11th-edition-y-daniel-liang/

Solution Manual for Todays Technician Automotive Heating


& Air Conditioning Classroom Manual and Shop Manual,
5th Edition
http://testbankbell.com/product/solution-manual-for-todays-technician-
automotive-heating-air-conditioning-classroom-manual-and-shop-
manual-5th-edition/
Test Bank for Essentials of Human Diseases and Conditions
6th Edition by Frazier

http://testbankbell.com/product/test-bank-for-essentials-of-human-
diseases-and-conditions-6th-edition-by-frazier/

Signals Systems and Inference 1st Edition Oppenheim


Solutions Manual

http://testbankbell.com/product/signals-systems-and-inference-1st-
edition-oppenheim-solutions-manual/

Janeways Immunobiology 9th Edition Murphy Test Bank

http://testbankbell.com/product/janeways-immunobiology-9th-edition-
murphy-test-bank/

DSM5 Diagnostic and Statistical Manual of Mental Disorders


5th Edition Test Bank

http://testbankbell.com/product/dsm5-diagnostic-and-statistical-
manual-of-mental-disorders-5th-edition-test-bank/

Test Bank for Modern Dental Assisting 12th Edition by Bird

http://testbankbell.com/product/test-bank-for-modern-dental-
assisting-12th-edition-by-bird/
Test Bank for Essentials of Accounting for Governmental
and Not-for-Profit Organizations 13th Edition by Copley

http://testbankbell.com/product/test-bank-for-essentials-of-
accounting-for-governmental-and-not-for-profit-organizations-13th-
edition-by-copley/
chapter2.txt
Introduction to Java Programming Comprehensive
Version 10th Edition Liang Test Bank
full chapter at: https://testbankbell.com/product/introduction-to-java-
programming-comprehensive-version-10th-edition-liang-test-bank/
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
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
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
Random documents with unrelated
content Scribd suggests to you:
Ronald drew a candle nearer him; he was conscious of having drunk a
good deal, and the light seemed dim and veiled. He fumbled over the
envelope, and drawing out the sheet, unfolded it. He stared at it with mouth
fallen open.
“It’s a joke,” he said in a loud, unsteady voice. “It’s some silly joke.”
“Let’s have it, then,” said his father. “Who’s the joker?”
“It’s from Philip,” said he. “He says that he’s married, and that his wife
has had twins to-day—boys.”
Lord Yardley rose to his feet, the flush on his face turning to purple.
Then, without a word, he fell forward across the table, crashing down
among the glasses and decanters.

A fortnight after the birth of the twins, Rosina, who till then had been
doing well, developed disquieting symptoms with high temperature. Her
illness declared itself as scarlet fever, and on the 6th of April she died.
Surely in those spring weeks there had been busy superintendence over
the fortunes of the Staniers. Philip, till lately outcast from his home and
vagrant bachelor, had succeeded to the great property and the honours and
titles of his house. Two lusty sons were his, and there was no Rosina to vex
him with her petulance and common ways. All tenderness that he had had
for her was diverted into the persons of his sons, and in particular of Colin.
In England, in this month of April, the beloved home awaited the coming of
its master with welcome and rejoicing.
Book Two
CHAPTER I
Colin Stanier had gone straight from the tennis-court to the bathing-
place in the lake below the terraced garden. His cousin Violet, only
daughter of his uncle Ronald, had said that she would equip herself and
follow him, and the boy had swum and dived and dived and swum waiting
for her, until the dressing-bell booming from the turret had made him
reluctantly quit the water. He was just half dry and not at all dressed when
she came.
“Wretched luck!” she said. “Oh, Colin, do put something on!”
“In time,” said Colin; “you needn’t look!”
“I’m not looking. But it was wretched luck. Mother....”
Colin wrapped a long bath-towel round himself, foraged for cigarettes
and matches in his coat pocket, and sat down by her.
“Mother?” he asked.
“Oh, yes. Mother was querulous, and so she wanted some one to be
querulous to.”
“Couldn’t she be querulous to herself?” asked Colin.
“No, of course not. You must have a partner or a dummy if you’re being
querulous. I wasn’t more than a dummy, and so when she had finished the
rest of it she was querulous about that. She said I was unsympathetic.”
“Dummies usually are,” said Colin. “Cigarette?”
“No, thanks. This one was, because she wanted to come and bathe. Did
you dive off the top step?”
“Of course not. No audience,” said Colin. “What’s the use of doing
anything terrifying unless you impress somebody? I would have if you had
come down.”
“I should have been thrilled. Oh, by the way, Raymond has just
telephoned from town to say that he’ll be here by dinner-time. He’s
motoring down.”
Colin considered this. “Raymond’s the only person older than myself
whom I envy,” he said. “He’s half an hour older than me. Oh, I think I envy
Aunt Hester, but then I adore Aunt Hester. I only hate Raymond.”
“Just because he’s half an hour older than you?” asked the girl.
“Isn’t that enough? He gets everything just because of that unlucky half-
hour. He’ll get you, too, if you’re not careful.”
Colin got up and gathered his clothes together.
“He’ll have Stanier,” he observed. “Isn’t that enough to make me detest
him? Besides, he’s a boor. Happily, father detests him, too; I think father
must have been like Raymond at his age. That’s the only comfort. Father
will do the best he can for me. And then there’s Aunt Hester’s money. But
what I want is Stanier. Come on.”
“Aren’t you going to dress?” asked Violet.
“Certainly not. As soon as I get to the house I shall have to undress and
dress again.”
“Not shoes?” asked she.
“Not when the dew is falling. Oh, wet grass is lovely to the feet. We’ll
skirt the terrace and go round by the lawn.”
“And why is it that you envy Aunt Hester?” asked the girl.
“Can’t help it. She’s so old and wicked and young.”
Violet laughed. “That’s a very odd reason for envying anybody,” she
said. “What’s there to envy?”
“Why, the fact that she’s done it all,” said Colin frowning. “She has done
all she pleased all her life, and she’s just as young as ever. If I wasn’t her
nephew, she would put me under her arm, just as she did her husband a
thousand years ago, and marry me to-morrow. And then you would marry
Raymond, and—and there we would all be. We would play whist together.
My dear, those ghastly days before we were born! Grandfather with his
Garter over his worsted jacket and a kitten on his knee, and grandmamma
and Aunt Janet and your father and mine! They lived here for years like
that. How wonderful and awful!”
“They’re just as wonderful now,” said Violet. “And....”
“Not quite so awful; grandfather isn’t here now, and he must have been
the ghastliest. Besides, there’s Aunt Hester here to tone them up, and you
and I, if it comes to that. Not to mention Raymond. I love seeing my father
try to behave nicely to Raymond. Dead failure.”
Colin tucked his towel round him; it kept slipping first from one
shoulder, then the other.
“I believe Raymond is falling in love with you,” he said. “He’ll propose
to you before long. Your mother will back him up, so will Uncle Ronald.
They would love to see you mistress here. And you’d like it yourself.”
“Oh—like it?” said she. She paused a moment. “Colin, you know what I
feel about Stanier,” she said. “I don’t think anybody knows as well as you.
You’ve got the passion for it. Wouldn’t you give anything for it to be yours?
Look at it! There’s nothing like it in the world!”
They had come up the smooth-shaven grass slope from the lake, and
stood at the entrance through the long yew-hedge that bordered the line of
terraces. There were no ghastly monstrosities in its clipped bastion; no
semblance of peacocks and spread tails to crown it: it flowed downwards, a
steep, uniform embattlement of stiff green, towards the lake, enclosing the
straight terraces and the deep borders of flower-beds. The topmost of these
terraces was paved, and straight from it rose the long two-storied façade of
mellow brick balustraded with the motto, “Nisi Dominus ædificavit,” in tall
letters of lead, and from floor to roof it was the building of that Colin
Stanier whose very image and incarnation stood and looked at it now.
So honest and secure had been the workmanship that in the three
centuries which had elapsed since first it nobly rose to crown the hill above
Rye scarcely a stone of its facings had been repaired, or a mouldering brick
withdrawn. It possessed, even in the material of its fashioning, some
inexplicable immortality, even as did the fortunes of its owners. Its
mellowing had but marked their enrichment and stability; their stability
rivalled that of the steadfast house. The sun, in these long days of June, had
not yet quite set, and the red level rays made the bricks to glow, and gave a
semblance as of internal fire to the attested guarantee of the motto.
Whoever had builded, he had builded well, and the labour of the bricklayers
was not lost.
A couple of years ago Colin, still at Eton, had concocted a mad freak
with Violet. There had been a fancy-dress ball in the house, at which he had
been got up to represent his ancestral namesake, as shewn in the famous
Holbein. There the first Colin appeared as a young man of twenty-five, but
the painter had given him the smooth beauty of boyhood, and his
descendant, in those rich embroidered clothes, might have passed for the
very original and model for the portrait.
This, then, had been their mad freak: Violet, appearing originally in the
costume of old Colin’s bride, had slipped away to her room, when the ball
was at its height, and changed clothes with her cousin. She had tucked up
her hair under his broad-brimmed jewelled hat, he had be-wigged himself
and easily laced his slimness into her stiff brocaded gown, and so
indistinguishable were they that the boys, Colin’s friends and
contemporaries, had been almost embarrassingly admiring of him, while her
friends had found her not less forward. A slip by Colin in the matter of
hoarse laughter at an encircling arm and an attempt at a kiss had betrayed
him into forgetting his brilliant falsetto and giving the whole thing away.
Not less like to each other now than then, they stood at the entrance of
the terraces. He had gained, perhaps, a couple of inches on her in height,
but the piled gold of her hair, and his bare feet equalised that. No growth of
manhood sheathed the smoothness of his cheeks; they looked like replicas
of one type, still almost sexless in the glow of mere youth. Theirs was the
full dower of their race, health and prosperity, glee and beauty, and the
entire absence of any moral standard.
Faun and nymph, they stood there together, she in the thin blouse and
white skirt of her tennis-clothes, he in the mere towel of his bathing. He had
but thrown it on anyhow, without thought except to cover himself, and yet
the folds of it fell from his low square shoulders with a plastic perfection. A
hand buried in it held it round his waist, tightly outlining the springing of
his thighs from his body. With her, too, even the full tennis-skirt, broad at
the hem for purposes of activity, could not conceal the exquisite grace of
her figure; above, the blouse revealed the modelling of her arms and the
scarcely perceptible swell of her breasts. High-bred and delicate were they
in the inimitable grace of their youth; what need had such physical
perfection for any dower of the spirit?
She filled her eyes with the glow of the sunlit front, and then turned to
him. “Colin, it’s a crime,” she said, “that you aren’t in Raymond’s place. I
don’t like Raymond, and yet, if you’re right and he means to propose to me,
I don’t feel sure that I shall refuse him. It won’t be him I refuse, if I do, it
will be Stanier.”
“Lord, I know that!” said Colin. “If I was the elder, you’d marry me to-
morrow.”
“Of course I should, and cut out Aunt Hester. And the funny thing,
darling, is that we’re neither of us in love with the other. We like each other
enormously, but we don’t dote. If you married Aunt Hester I shouldn’t
break my heart, nor would you if I married Raymond.”
“Not a bit. But I should think him a devilish lucky fellow!”
She laughed. “So should I,” she said. “In fact, I think him devilish lucky
already. Colin, if I do refuse him, it will be because of you.”
“Oh, chuck it, Violet!” said he.
She nodded towards the great stately house. “It’s a big chuck,” she said.
From the far side of the house there came the sound of motor-wheels on
the gravel, and after a moment or two the garden door at the centre of the
terrace opened, and Raymond came out. He was not more than an inch or so
shorter than his brother, but his broad, heavy, short-legged build made him
appear short and squat. His eyebrows were thick and black, and already a
strong growth of hair fringed his upper lip. While Colin might have passed
for a boy of eighteen still, the other would have been taken for a young man
of not less than twenty-five. He stood there for a minute, looking straight
out over the terrace, and the marsh below. Then, turning his eyes, he saw
the others in the dusky entrance through the yew-hedge, and his face lit up.
He came towards them.
“I’ve only just come,” he said. “Had a puncture. How are you, Violet?”
“All right. But how late you are! We’re all late, in fact. We must go and
dress.”
Raymond looked up and down Colin’s bath-towel, and his face darkened
again. But he made a call on his cordiality.
“Hullo, Colin,” he said. “Been bathing? Jolly in the water, I should
think.”
“Very jolly,” said Colin. “How long are you down for?”
He had not meant any particular provocation in the question, though he
was perfectly careless as to whether Raymond found it there or not. He did,
and his face flushed.
“Well, to be quite candid,” he said, “I’m down here for as long as I
please. With your permission, of course.”
“How jolly!” said Colin in a perfectly smooth voice, which he knew
exasperated his brother. “Come on, Vi, it’s time to dress.”
“Oh, there’s twenty minutes yet,” said Raymond. “Come for a few
minutes’ stroll, Vi.”
Colin paused for her answer, slightly smiling, and looking just above
Raymond’s head. The two always quarrelled whenever they met, though
perhaps “quarrel” is both too strong and too superficial a word to connote
the smouldering enmity which existed between them, and which the
presence of the other was sufficient to wreathe with little flapping flames.
Envy, as black as hell and as deep as the sea, existed between them, and
there was no breath too light to blow it into incandescence. Raymond
envied Colin for absolutely all that Colin was, for his skin and his slimness,
his eyes and his hair, and to a degree unutterably greater, for the winning
smile, the light, ingratiating manner that he himself so miserably lacked,
even for a certain brusque heedlessness on Colin’s part which was
interpreted, in his case, into the mere unselfconsciousness of youth. In the
desire to please others, Raymond held himself to be at least the equal of his
brother, yet, where his efforts earned for him but a tepid respect, Colin
would weave an enchantment. If Raymond made some humorous
contribution to the conversation, glazed eyes and perfunctory comment
would be all his wages, whereas if Colin, eager and careless, had made
precisely the same offering, he would have been awarded attention and
laughter.
Colin, on the other hand, envied his brother not for anything he was, but
for everything he had. Theirs was no superficial antagonism; the graces of
address and person are no subjects for light envy, nor yet the sceptred fist of
regal possessions. That fist was Raymond’s; all would be his; even Violet,
perhaps, Stanier certainly, would be.
At this moment the antagonism flowered over Violet’s reply. Would she
go for a stroll with Raymond or wouldn’t she? Colin cared not a blade of
grass which she actually did; it was her choice that would feed his hatred of
his brother or make him chuckle over his discomfiture. For an infinitesimal
moment he diverted his gaze from just over Raymond’s head to where, a
tiny angle away, her eyes were level with his. He shook his head ever so
slightly; some drop of water perhaps had lodged itself from his diving in his
ear.
“Oh, we shall all be late,” said she, “and Uncle Philip hates our being
late. Only twenty minutes, did you say? I must rush. Hair, you know.”
She scudded off along the paved terrace without one glance behind her.
“Want a stroll, Raymond?” said Colin. “I haven’t got to undress, only to
dress. I needn’t go for five minutes yet.”
Raymond had seen the headshake and Colin’s subsequent application of
the palm of a hand to his ear was a transparent device. Colin, he made sure,
meant him to see that just as certainly as he meant Violet to do so. The
success of it enraged him, and not less the knowledge that it was meant to
enrage him. Colin’s hand so skilfully, so carelessly, laid these traps which
silkenly gripped him. He could only snarl when he was caught, and even to
snarl was to give himself away.
“Oh, thanks very much,” he said, determined not to snarl, “but, after all,
Vi’s right. Father hates us being late. How is he? I haven’t seen him yet.”
“Ever so cheerful,” said Colin. “Does he know you are coming, by the
way?”
“Not unless Vi has told him. I telephoned to her.”
“Pleasant surprise,” said Colin. “Well, if you don’t want to stroll, I think
I’ll go in. Vi’s delighted that you’ve come.”
Once again Raymond’s eye lit up. “Is she?” he asked.
“Didn’t you think so?” said Colin, standing first on one foot and then on
the other, as he slipped on his tennis shoes to walk across the paving of the
terrace.

There had been no break since the days of Colin’s grandfather in the
solemnity of the ceremonial that preceded dinner. Now, as then, the guests,
if there were any, or, if not, the rest of the family, were still magnificently
warned of the approach of the great hour, and, assembling in the long
gallery which adjoined the dining-room, waited for the advent of Lord
Yardley.
That piece of ritual was like the Canon of the Mass, invariable and
significant. It crystallised the centuries of the past into the present; dinner
was the function of the day, dull it might be, but central and canonical, and
the centre of it all was the entrance of the head of the family. He would not
appear till all were ready; his presence made completion, and the Staniers
moved forward by order. So when the major-domo had respectfully
enfolded the flock in the long gallery, he took his stand by the door into the
dining-room. That was the signal to Lord Yardley’s valet who waited by the
door at the other end of the gallery which led into his master’s rooms. He
threw that open, and from it, punctual as the cuckoo in the clock, out came
Lord Yardley, and every one stood up.
But in the present reign there had been a slight alteration in the minor
ritual of the assembling, for Colin was almost invariably late, and the edict
had gone forth, while he was but yet fifteen, and newly promoted to a seat
at dinner, that Master Colin was not to be waited for: the major-domo must
regard his jewelled flock as complete without him. He, with a “Sorry,
father,” took his vacant place when he was ready, and his father’s grim face
would soften into a smile. Raymond’s unpunctuality was a different matter,
and he had amended this weakness.
To-night there were no guests, and when the major-domo took his stand
at the dining-room door to fling it open on the remote entry of Lord Yardley
from the far end of the gallery, all the family but Colin were assembled.
Lord Yardley’s mother, now over eighty, white and watchful and bloodless,
had been as usual the first to arrive, and, leaning on her stick, had gone to
her chair by the fireplace, in which, upright and silent, she waited during
these canonical moments. She always came to dinner, though not appearing
at other meals, for she breakfasted and lunched in her own rooms, where all
day, except for a drive in the morning, she remained invisible. Now she
held up her white hand to shield her face from the fire, for whatever the
heat of the evening, there was a smouldering log there for incense.
Ronald Stanier sat opposite her, heavy and baggy-eyed, breathing sherry
into the evening paper. His wife, the querulous Janet, was giving half an ear
to Raymond’s account of his puncture, and inwardly marvelling at Lady
Hester’s toilet. Undeterred by the weight of her sixty years, she had an
early-Victorian frock of pink satin, high in the waist and of ample skirt. On
her undulated wig of pale golden hair, the colour and lustre of which had
not suffered any change of dimness since the day when she ran away with
her handsome young husband, she wore a wreath of artificial flowers; a
collar of pearls encircled her throat which was still smooth and soft. The
dark eyebrows, highly arched, gave her an expression of whimsical
amusement, and bore out the twinkle in her blue eyes and the little upward
curve at the corner of her mouth. She was quite conscious of her sister-in-
law’s censorious gaze; poor Janet had always looked like a moulting hen....
By her stood Violet, who had but this moment hurried in, and whose
entrance was the signal for Lord Yardley’s valet to open the door. She had
heard Colin splashing in his bath as she came along the passage, though he
had just bathed.
Then, with a simultaneous uprising, everybody stood, old Lady Yardley
leaned on her stick, Ronald put down the evening paper, and Raymond
broke off the interesting history of his punctured wheel.
Philip Yardley went straight to his mother’s chair, and gave her his arm.
In the dusk, Raymond standing between him and the window was but a
silhouette against the luminous sky. His father did not yet know that he had
arrived, and mistook him for his brother.
“Colin, what do you mean by being in time for dinner?” he said. “Most
irregular.”
“It’s I, father,” said Raymond.
“Oh, Raymond, is it?” said Lord Yardley. “I didn’t know you were here.
Glad to see you.”
The words were sufficiently cordial, but the tone was very unlike that in
which he had supposed himself to be addressing Colin. That was not lost on
Raymond; for envy, the most elementary of all human passions, is also
highly sensitive.
“You came from Cambridge?” asked his father, when they had sat down,
in the same tone of studious politeness. “The term’s over, I suppose.”
“Yes, a week ago,” said Raymond. As he spoke he made some awkward
movement in the unfolding of his napkin, and upset a glass which crashed
on to the floor. Lord Yardley found himself thinking, “Clumsy brute!”
“Of course; Colin’s been here a week now,” he said, and Raymond did
not miss that. Then Philip Yardley, considering that he had given his son an
adequate welcome, said no more.
These family dinners were not, especially in Colin’s absence and in
Raymond’s presence, very talkative affairs. Old Lady Yardley seldom spoke
at all, but sat watching first one face and then another, as if with secret
conjectures. Ronald Stanier paid little attention to anything except to his
plate and his glass, and it was usually left to Violet and Lady Hester to carry
on such conversation as there was. But even they required the stimulus of
Colin, and to-night the subdued blink of spoons on silver-gilt soup-plates
reigned uninterrupted. These had just ceased when Colin appeared, like a
lamp brought into a dusky room.
“Sorry, father,” he said. “I’m late, you know. Where’s my place? Oh,
between Aunt Hester and Violet. Ripping.”
“Urgent private affairs, Colin?” asked his father.
“Yes, terribly urgent. And private. Bath.”
The whole table revived a little, as when the gardener waters a drooping
bed of flowers.
“But you had only just bathed,” said Violet.
“That’s just why I wanted a bath. Nothing makes you so messy and
sticky as a bathe. And there were bits of grass between my toes, and a small
fragment of worm.”
“And how did they get there, dear?” asked Aunt Hester, violently
interested.
“Because I walked up in bare feet over the grass, Aunt Hester,” said
Colin. “It’s good for the nerves. Come and do it after dinner.”
Lord Yardley supposed that Colin had not previously seen his brother,
and that seeing him now did not care to notice his presence. So, with the
same chill desire to be fair in all ways to Raymond, he said:
“Raymond has come, Colin.”
“Yes, father, we’ve already embraced,” said he. “Golly, I don’t call that
soup. It’s muck. Hullo, granny dear, I haven’t seen you all day. Good
morning.”
Lady Yardley’s face relaxed; there came on her lips some wraith of a
smile. Colin’s grace and charm of trivial prattle was the only ray that had
power at all to thaw the ancient frost that had so long congealed her. Ever
since her husband’s death, twenty years ago, she had lived some half of the
year here, and now she seldom stirred from Stanier, waiting for the end. Her
life had really ceased within a few years of her marriage; she had become
then the dignified lay-figure, emotionless and impersonal, typical of the
wives of Staniers, and that was all that her children knew of her. For them
the frost had never thawed, nor had she, even for a moment, lost its cold
composure, even when on the night that the news of Raymond’s and Colin’s
birth had come to Stanier, there came with it the summons that caused her
husband to crash among the glasses on the table. Nothing and nobody
except Colin had ever given brightness to her orbit, where, like some dead
moon, she revolved in the cold inter-stellar space.
But at the boy’s salutation across the table, she smiled. “My dear, what
an odd time to say good morning,” she said. “Have you had a nice day,
Colin?”
“Oh, ripping, grandmamma!” said he. “Enjoyed every minute of it.”
“That’s good. It’s a great waste of time not to enjoy....” Her glance
shifted from him to Lady Hester. “Hester, dear, what a strange gown,” she
said.
“It’s Aunt Hester’s go-away gown after her marriage,” began Colin.
“She....”
“Colin,” said his father sharply, “you’re letting your tongue run away
with you.”
Very unusually, Lady Yardley turned to Philip. “You mustn’t speak to
Colin like that, dear Philip,” she said. “He doesn’t know about those things.
And I like to hear Colin talk.”
“Very well, mother,” said Philip.
“Colin didn’t have a mother to teach him what to say, and what not to
say,” continued Lady Yardley; “you must not be harsh to Colin.”
The stimulus was exhausted and she froze into herself again.
Colin had been perfectly well aware during this, that Raymond was
present, and that nothing of it was lost on him. It would be too much to say
that he had performed what he and Violet called “the grandmamma trick”
solely to rouse Raymond’s jealousy, but to know that Raymond glowered
and envied was like a round of applause to him. It was from no sympathy or
liking for his grandmother that he thawed her thus and brought her back
from her remoteness; he did it for the gratification of his own power in
which Raymond, above all, was deficient.... Like some antique bird she had
perched for a moment on Colin’s finger; now she had gone back into her
cage again.
Colin chose that night to take on an air of offended dignity at his father’s
rebuke, and subsided into silence. He knew that every one would feel his
withdrawal, and now even Uncle Ronald who, with hardly less aloofness
than his mother, for he was buried in his glass and platter, and was remote
from everything except his vivid concern with food and drink, tried to
entice the boy out of his shell. Colin was pleased at this: it was all salutary
for Raymond.
“So you’ve been bathing, Colin,” he said.
“Yes, Uncle Ronald,” said he.
“Pleasant in the water?” asked Uncle Ronald.
“Quite,” said Colin.
Aunt Hester made the next attempt. They were all trying to please and
mollify him. “About that walking in the grass in bare feet,” she said. “I
should catch cold at my age. And what would my maid think?”
“I don’t know at all, Aunt Hester,” said Colin very sweetly.
Raymond cleared his throat. Colin was being sulky and unpleasant, and
he, the eldest, would make things agreeable again. No wonder Colin
subsided after that very ill-chosen remark about Aunt Hester.
“There’s a wonderful stride been made in this wireless telegraphy,
father,” he said. “There were messages transmitted to Newfoundland
yesterday, so I saw in the paper. A good joke about it in Punch. A fellow
said, ‘They’ll be inventing noiseless thunder next.’ ”
There was a dead silence, and then Colin laughed loudly.
“Awfully good, Raymond,” he said. “Very funny. Strawberries, Aunt
Hester?”
That had hit the mark. Leaning forward to pull the dish towards him, he
saw the flush on Raymond’s face.
“Really? As far as Newfoundland?” said Lord Yardley.

By now the major-domo was standing by the dining-room door again,


and Philip rose. His mother got up and stood, immobile and expressionless,
till the other women had passed out in front of her. Then, as she went out,
she said exactly what she had said for the last sixty years.
“You will like a game of whist, then, soon?”
Generally when the women had gone, the others moved up towards the
host. To-night Philip took up his glass and placed himself next Colin. The
decanters were brought round and placed opposite him, and he pushed them
towards Raymond.
“Help yourself, Raymond,” he said.
Then he turned round in his armchair to the other boy.
“Still vexed with me, Colin?” he said quietly.
“Of course not, father,” he said. “Sorry I sulked. But you did shut me up
with such a bang.”
“Well, open yourself at the same place,” said Philip.
“Rather. Aunt Hester’s dress, wasn’t it? Isn’t she too divine? If she ever
dies, which God forbid, you ought to have her stuffed and dressed just like
that, and put in a glass case in the hall to shew how young it is possible to
be when you’re old. But, seriously, do get a portrait done of her to hang
here. There’s nothing of her in the gallery.”
“Any other orders?” asked Philip.
“I don’t think so at present. Oh, by the way, are you going to Italy this
year?”
“Yes, I think I shall go out there before long for a few weeks as usual.
Why?”
“I thought that perhaps you would take me. I’ve got four months’
vacation, you see, now that I’m at Cambridge, and I’ve never been to Italy
yet.”
Philip paused; he was always alone in Italy. That was part of the spell.
“You’d get dreadfully bored, Colin,” he said. “I shall be at the villa in
Capri: there’s nothing to do except swim.”
Colin divined in his father’s mind some reluctance other than that which
he expressed. He dropped his eyes for a moment, then raised them again to
his father’s face, merry and untroubled.
“You don’t want me to come with you, father,” he said. “Quite all right,
but why not have told me so?”
Philip looked at the boy with that expression in his face that no one else
ever saw there; the tenderness for another, the heart’s need of another,
which had shot into fitful flame twenty years ago, had never quite been
extinguished; it had always smouldered there for Colin.
“I’ll think it over,” he said, and turned round in his chair.
“You were telling me something about wireless, Raymond,” he said. “As
far as Newfoundland! That is very wonderful. A few years ago scientists
would have laughed at such an idea as at a fairy-tale or a superstition. But
the superstitions of one generation become the science of the next.”
Raymond by this time was in a state of thorough ill-temper. He had
witnessed all the evening Colin’s easy triumphs; he had seen how Colin,
when annoyed, as he had been at his father’s rebuke, went into his shell,
and instantly every one tried to tempt him out again. Just now in that low-
voiced conversation between his brother and his father, he had heard his
father say, “Still vexed with me?” in a sort of suppliance.... He determined
to try a manœuvre that answered so well.
“I should have said just the opposite,” he remarked, re-filling his glass.
“I should have thought that the science and beliefs of one generation
became the superstitions of the next. Our legend, for instance; that was
soberly believed once.”
Philip Yardley did not respond quite satisfactorily. “Ah!” he said, getting
up. “Well, shall we be going?”
Raymond had just poured himself out a glass of port, and, very
unfortunately, he remembered a precisely similar occasion on which his
father, just when Colin had done the same, proposed an adjournment. He
repeated the exact words Colin had used then.
“Oh, you might wait till I’ve finished my port,” he said.
That did not produce the right effect. On the previous occasion his father
had said, “Sorry, old boy,” and had sat down again.
“You’d better follow us, then,” said Philip. “But don’t drink any more,
Raymond. You’ve had as much as is good for you.”
Raymond’s face blazed. To be spoken to like that, especially in front of
his uncle and brother, was intolerable. He got up and pushed his replenished
glass away, spilling half of it. Instantly Colin saw his opportunity, and
knowing fairly well what would happen, he put his hand within Raymond’s
arm in brotherly remonstrance.
“Oh, I say, Raymond!” he said.
Raymond shook him off. “Leave me alone, can’t you?” he said angrily.
Then he turned to his father. “I didn’t mean to spill the wine, father,” he
said. “It was an accident.”
“Accidents are liable to happen, when one loses one’s temper,” said
Philip. “Ring the bell, please.”
There were two tables for cards laid out in the drawing-room, and
Raymond, coming in only a few seconds after the others, found that,
without waiting for him, the bridge-table had already been made up with
Lady Hester, Violet, his father, and Colin. They had not given him a chance
to play there, and now for the next hour he was condemned to play whist
with his grandmother and his uncle and aunt, a dreary pastime.
At ten old Lady Yardley went dumbly to bed, and there was the choice
between sitting here until the bridge was over, or of following Uncle
Ronald into the smoking-room. But that he found he could not do; his
jealousy of Colin, both as regards his father and as regards Violet,
constrained him as with cords to stop and watch them, and contrast their
merriment with his own ensconced and sombre broodings.
And then there was Violet herself. Colin’s conjecture had been perfectly
right, for in the fashion of Staniers, he must be considered as in the process
of falling in love with her. The desire for possession, rather than devotion,
was the main ingredient in the bubbling vat, and that was very sensibly
present. She made a ferment in his blood, and though he would not have
sacrificed anything which he really valued, such as his prospective lordship
of Stanier, for her sake, he could not suffer the idea that she should not be
his. He knew, too, how potent in her was the Stanier passion for the home,
and that he counted as his chief asset, for he had no illusion that Violet was
in love with him. Nor was she, so he thought, in love with Colin; the two
were much more like a couple of chums than lovers.
So he sat and watched them round the edge of the newspaper which had
beguiled Uncle Ronald’s impatience for dinner. The corner where he sat
was screened from the players by a large vase of flowers on the table near
them, and Raymond felt that he enjoyed, though without original intention,
the skulking pleasures of the eavesdropper.
Colin, as usual, was to the fore. Just now he was dummy to his partner,
Aunt Hester, who, having added a pair of tortoise-shell spectacles to
complete her early-Victorian costume, was feeling a shade uneasy. She had
just done what she most emphatically ought not to have done, and was
afraid that both her adversaries had perceived it. Colin had perceived it, too;
otherwise the suit of clubs was deficient. Violet had already alluded to this.
“Oh, Aunt Hester!” cried Colin. “What’s the use of pretending you’ve
not revoked? Don’t cling on to that last club; play it, and have done with it.
If you don’t, you’ll revoke again.”
Aunt Hester still felt cunning; she thought she might be able to bundle it
up in the last trick. “But I ain’t got a club, Colin,” she said, reverting to
mid-Victorian speech.
“Darling Aunt Hester, you mean ‘haven’t,’ ” said Colin. “ ‘Ain’t’ means
‘aren’t,’ and it isn’t grammar even then, though you are my aunt.
‘Ain’t....’ ”
Lord Yardley, leaning forward, pulled Colin’s hair. It looked so golden
and attractive, it reminded him.... “Colin, are you dummy, or ain’t you?” he
asked.
“Certainly, father. Can’t you see Aunt Hester’s playing the hand? I
shouldn’t call it playing, myself. I should call it playing at playing. Club,
please, Aunt Hester.”
“Well, if you’re dummy, hold your tongue,” said Lord Yardley. “Dummy
isn’t allowed to speak, and....”
“Oh, those are the old rules,” said Colin. “The new rules make it
incumbent on dummy to talk all the time. Hurrah, there’s Aunt Hester’s
club, aren’t it? One revoke, and a penalty of three tricks....”
“Doubled,” said his father.
“Brute,” said Colin, “and no honours at all! Oh yes, fourteen to us above.
Well played, Aunt Hester! Wasn’t it a pity? Your deal, Vi.”
Colin, having cut the cards, happened to look up at the big vase of
flowers which stood close to the table. As he did so, there was a trivial
glimmer, as of some paper just stirred, behind it. He had vaguely thought
that Uncle Ronald and Raymond had both gone to the smoking-room, but
there was certainly some one there, and which of the two it was he had
really no idea. Every one else, adversaries and partner, was behaving as if
there was no one else in the room, so why not he?
“Raymond’s got the hump this evening,” he said cheerfully. “He won at
whist—Lord, what a game!—because I saw Aunt Janet pay him half-a-
crown with an extraordinarily acid expression, and ask for change. So as
he’s won at cards, he will be blighted in love. I expect he’s had a knock
from the young thing at the tobacconist’s in King’s Parade. I think she likes
me best, father. But it’ll be the same daughter-in-law. She breathes through
her nose, and is marvellously genteel. Otherwise she’s just like Violet.”
“Pass,” said Violet.
“Hurrah! I knew it would make you pessimistic to be called like a
tobacconist’s....”
Philip Yardley laid down his cards and actually laughed. “Colin, you
low, vulgar brute,” he said, “don’t talk so much!”
Colin imitated Raymond’s voice and manner to perfection. “I should
have said just the opposite,” he remarked. “I should have thought you
wanted me to talk more, and make trumps.”
Violet caught on. “Oh, you got him exactly, Colin,” she said. “What did
he say that about?”
“Go on, Colin,” said his father. “We shall never finish.”
Colin examined his hand. “Three no-trumps,” he said. “Not one, nor
two, but three. Glorious trinity!”
There was no counter-challenge, and as Lord Yardley considered his
lead, Colin looked up through the vase of flowers once more. There was
some one there still, and he got up to fetch a match from a side-table. That
gave him a clearer view of what lay beyond.
“Hullo, Raymond?” he said. “Thought you’d gone to the smoking-
room.”
“No; just looking at the paper,” said Raymond. “I’m going now.”
“Oh, but we’ll have another rubber,” said Colin. “Cut in?”
“No, thanks,” said Raymond.
Colin waited till the door had closed behind him. “Lor!” he said.
“Just shut that door, Colin,” said Lord Yardley.
Lady Hester was thrilled about the tobacconist’s young thing; it really
would be rather a good joke if one of the boys, following his father’s
example, married a “baggage” of that sort, and she determined to pursue the
subject with Colin on some future occasion. She loved such loose natural
talk as he treated her to; he told her all his escapades. He was just such a
scamp as Colin the first must have been, and with just such gifts and utter
absence of moral sense was he endowed.
Indeed, the old legend, so it seemed to her, lived again in Colin, though
couched in more modern terms. It was the mediæval style to say that for the
price of the soul, Satan was willing to dower his beneficiary with all
material bounty and graces; more modernly, you said that this boy was an
incorrigible young Adonis, who feared neither God nor devil. True, the
lordship of Stanier was not yet Colin’s, but something might happen to that
grim, graceless Raymond.
How the two hated each other, and how different were the exhibitions of
their antagonism! Raymond hated with a glowering, bilious secrecy, that
watched and brooded; Colin with a gay contempt, a geniality almost. But if
the shrewd old Lady Hester had been asked to wager which of the two was
the most dangerous to the other, she would without hesitation have put her
money on Colin.
The second rubber was short, but as hilarious as the first, and on its
conclusion Lady Hester hurried to bed, saying that she would be “a fright”
in the morning if she lost any more sleep. Violet followed her, Philip
withdrew to his own room, and Colin sauntered along to the smoking-room
in quest of whisky. His Uncle Ronald was still there, rapidly approaching
the comatose mood of midnight, which it would have been inequitable to
call intoxication and silly to call sobriety. Raymond sprawled in a chair by
the window.
“Hullo, Uncle Ronald, still up?” said Colin. “You’ll get scolded.”
Uncle Ronald lifted a sluggish eyelid. “Hey?” he said. “Oh, Colin, is it?
What’s the time, my boy?”
“Half-past twelve,” said Colin, adding on another half-hour. He wanted
to get rid of his uncle and see how he stood with his brother. No doubt they
would have a row.
“Gobbless me,” said Ronald. “I shall turn in. Just a spot more whisky.
Good night, boys.”
As soon as he had gone Raymond got out of his chair and placed himself
where he could get his heels on the edge of the low fender-kerb. He hated
talking “up” to Colin, and this gave him a couple of inches.
“I want to ask you something,” he said.
“Ask away,” said Colin.
“Did you know I was in the room when you imitated me just now?”
“Hadn’t given a thought to it,” said Colin.
“It’s equally offensive whether you mimic me before my face or behind
my back,” said Raymond. “It was damned rude.”
“Shall I come to you for lessons in manners?” asked Colin. “What do
you charge?”
Colin spoke with all the lightness of good-humoured banter, well aware
that if Raymond replied at all, he would make some sledge-hammer
rejoinder. He would swing a cudgel against the rapier that pricked him, yet
never land a blow except on the air, or, maybe, his own foot.
“It’s beastly insolence on your part,” said Raymond.
“And that’s very polite,” said Colin. “You may mimic me how and
where and when you choose. If it’s like, I shall laugh. If it isn’t, well, I shall
still laugh.”
“I haven’t got your sense of humour,” said Raymond.
“Clearly, nor Violet’s. She thought I had got you to a ‘t.’ You probably
heard what she said from your sequestered corner behind your newspaper.”
Raymond advanced a step. “Look here, Colin, do you mean to imply that
I was listening?”
Colin laughed. “And I want to ask you a question,” he said. “Didn’t you
know that we all thought you had gone away?”
Raymond disregarded this. “Then there’s another thing. What do you
mean by telling father about the girl at the tobacconist’s? You know it was
nothing at all.”
“Rather,” said Colin. “I said so. You seem to forget that I told him that I
was the favourite. That’s the part you didn’t like.”
Raymond flushed. “It’s all very well for you to say that,” he said. “But
you know perfectly well that my father doesn’t treat us alike. Things which
are quite harmless in his eyes when you do them appear very different to
him when I’m the culprit. I had had a knock from a tobacconist’s girl, had
I? You’re a cad to have told him that quite apart from its being a lie.”
Colin laughed with irritating naturalness. “Is this the first lesson in
manners?” he said. “I’m beginning to see the hang of it. You call the other
fellow a cad and a liar. About my father’s not treating us alike, that’s his
affair. But I should never dream of calling you a liar for saying that. We’re
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