100% found this document useful (1 vote)
9 views

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

The document provides a comprehensive test bank for the 10th edition of 'Introduction to Java Programming' by Y. Daniel Liang, including links to various solution manuals and test banks for related subjects. It contains numerous questions and answers covering Java programming concepts, syntax, variables, data types, and operations. The content is structured into sections with multiple-choice questions aimed at evaluating understanding of Java programming principles.

Uploaded by

ageualthan
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 (1 vote)
9 views

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

The document provides a comprehensive test bank for the 10th edition of 'Introduction to Java Programming' by Y. Daniel Liang, including links to various solution manuals and test banks for related subjects. It contains numerous questions and answers covering Java programming concepts, syntax, variables, data types, and operations. The content is structured into sections with multiple-choice questions aimed at evaluating understanding of Java programming principles.

Uploaded by

ageualthan
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/ 58

Introduction to Java Programming Comprehensive

Version 10th Edition Liang Test Bank download pdf

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

Visit testbankmall.com today to download the complete set of


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

Test Bank for Introduction to Java Programming and Data


Structures Comprehensive Version, 12th Edition, Y. Daniel
Liang
https://testbankmall.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
https://testbankmall.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

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

Test Bank for Conceptual Physics 12th Edition Paul G.


Hewitt

https://testbankmall.com/product/test-bank-for-conceptual-
physics-12th-edition-paul-g-hewitt/
Test Bank for Precalculus Enhanced with Graphing
Utilities, 7th Edition Michael Sullivan III

https://testbankmall.com/product/test-bank-for-precalculus-enhanced-
with-graphing-utilities-7th-edition-michael-sullivan-iii/

Test Bank for Personality Classic Theories and Modern


Research, 5th Edition: Friedman

https://testbankmall.com/product/test-bank-for-personality-classic-
theories-and-modern-research-5th-edition-friedman/

Solution Manual for Elementary Survey Sampling, 7th


Edition

https://testbankmall.com/product/solution-manual-for-elementary-
survey-sampling-7th-edition/

Test Bank for Foundations and Adult Health Nursing, 5th


Edition: Barbara Christensen

https://testbankmall.com/product/test-bank-for-foundations-and-adult-
health-nursing-5th-edition-barbara-christensen/

Solution Manual for Mathematics with Allied Health


Applications, 1st Edition

https://testbankmall.com/product/solution-manual-for-mathematics-with-
allied-health-applications-1st-edition/
Solution Manual for HTML5 and CSS: Comprehensive, 7th
Edition, Denise M. Woods William J. Dorin

https://testbankmall.com/product/solution-manual-for-html5-and-css-
comprehensive-7th-edition-denise-m-woods-william-j-dorin/
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
a. Nothing.
b. b is an instance of A.
c. b is an instance of C.
d. b is an instance of A followed by b is an instance of C.

#
14. When you implement a method that is defined in a superclass, you
the original method.
a. overload
b. override
c. copy
d. call

#
15. What modifier should you use on a variable so that it can only be
referenced inside its defining class.
a. public
b. private
c. protected
d. Use the default modifier.

#
16. What is the output of running class C?

class A {
public A() {
System.out.println(
"The default constructor of A is invoked");
}
}

class B extends A {
public B() {
System.out.println(
"The default constructor of B is invoked");
}
}

public class C {
public static void main(String[] args) {
B b = new B();
}
}

a. none
b. "The default constructor of B is invoked"
c. "The default constructor of A is invoked" followed by "The
default constructor of B is invoked"
d. "The default constructor of A is invoked"

#
17. Analyze the following program.

class Test {

9
Random documents with unrelated
content Scribd suggests to you:
inclination. The body-tube carries eye-pieces, numbered, of the
Continental size and optical tube-length (160 mm.), for which the
object glasses are adjusted, and a draw-tube extending to eight
inches.

The fine adjustment is


independent of set screws, and
not subject to derangement. It
is extremely sensitive and direct
in action, and from its
construction is equal in
perfection of working to the
best that can be made. Its
fitting, by a new contrivance, is
completely covered at all
points, being thus preserved
from disturbance or injury by
dust.

The Eclipse is furnished with


two eye-pieces, 1′′ and ¼′′
object glasses of highest
excellence and large angular
aperture, both adjusted to a
double nose-piece, so that they
focus in the same plane; and a
swinging mirror and stage iris
Fig. 60.—Ross’s Rigid Pattern “Eclipse”
Microscope.
diaphragm.

In “Wenham’s Radial”
Microscope the chief aim has been directed towards providing a very
considerable range of effects, both in altitude and azimuth. The
leading principle followed throughout in the construction of this form
of stand is that of facilitating the work of the microscopist and of
obtaining the maximum range of oblique illumination in all
directions. This is fairly well attained by causing all the movements
of inclination and rotation to radiate from the object as a common
centre. Thus it has been found possible to combine seven radial
motions, so that when the instrument is inclined backwards, as in
Fig. 61, or placed in the horizontal, as in Fig. 62 or rotated from in
the brass plate, a pencil of light from a fixed source shall always
reach the object and pass to the objective. The stage is made to
rotate completely, and its rectangular motions are effected by milled
heads acting entirely within the circumference. The sub-stage is
mounted on the Zentmayer system, with two centring screws, by
means of which the optic axis is secured. It is also provided with
rectangular and rotating motions. The coarse adjustment is that of
the Ross-Jackson form—a spiral pinion and diagonal rackwork, while
the fine is on an entirely new principle designed by Dr. H. Schrœder.

The “Ross-Zentmayer
Microscope” is a thoroughly
substantial and practical
instrument, combining
elegance of appearance with
strength and firmness.

It is a true tripod model,


consisting of a triangular base
with two pillars rising from a
cross-piece, which carries the
trunnions. The slow movement
is obtained by a second slide
close behind the first; but to
avoid the friction of rubbing Fig. 61.—Ross’s Wenham Radial Microscope.
surfaces, hardened steel rollers
are inserted between them, which give a frictionless fine motion,
amenable to the slightest touch of the milled-head screw situated
conveniently at the back of the limb, through which a steel lever
passes which actuates the slow motion slide. The body of the
instrument is therefore not touched during the fine focussing, so
that all lateral movement is avoided. The mechanical stage rotates
axially, and the outer edge of
the lower plate is divided into
degrees, in order to register
the angles; a simple mode of
adjustment is provided for
setting the centre of rotation
exactly coincident with the
focal point of the objective.
As the plates of the stage
have no screw or rackwork
between them (these are Fig. 62.—The Ross-Wenham Radial
placed externally), they are Microscope.
brought close together, thus
affording the advantage of a thin substantial stage, and ensuring
rigidity where most required; phosphor-bronze being used in its
construction. The stage is attached to the limb by a conical stem,
with a screw and clamp nut at the back, so that it can be easily
removed for the substitution of a simple plate or other stage; by
turning the stem in the socket the stage may be tilted sideways at
any angle required. A feature in the Ross-Zentmayer stand is the
swinging sub-stage and bar carrying the mirror, having its axis of
rotation situated from an axial point in the plane of the object, which
consequently receives the light without requiring alteration of focus
in any position of the bar; by this means facilities are afforded for
the resolution of objects requiring oblique light and for the
development of their structure. Rays are thus obtained from any
angle and indicated by the graduated circle round the top of the
swing-bar, and many troublesome and expensive pieces of sub-stage
apparatus dispensed with. The value of this arrangement was long
ago recognised in Grubb’s “Sector Stand,” the movement of which
was obtained in a far less efficient manner.
Fig. 63.—The Improved Ross-Zentmayer Model.

The base or foot of the Ross-Zentmayer instrument is made in one


piece. Preference must be given to the double pillar support, as this
is firmer, and allows the sub-stage to swing free while the
microscope is in a vertical position, as in working with fluid
preparations. The sub-stage is provided with screws for centring,
and, when determined, secured by a clamping screw.

The sub-stage, with its apparatus in place, can be instantly removed,


by being drawn out sideways, so as to use the mirror alone, which is
a great convenience.
The mechanical movements of this instrument are perfect, and well
adapted to their purpose.

Messrs. Ross have other typical forms of microscopes. Their “New


Industrial” Microscope, for the use of farmers, horticulturists, textile
and other trades, for the examination of produce and raw materials,
is a surprisingly cheap one, and deserving of commendation. The
great utility of microscopical research to purposes of advanced
agriculture is fully recognised, and a less costly instrument than that
usually supplied for more complex investigations was much needed.
It is provided with a broad square stage for the purpose of receiving
a glass dish to contain liquids or manifold objects, and which may be
moved on the stage to bring the various particles under observation.
A fitting beneath the stage carries a plate with diaphragm apertures
for modifying the light, and as seeds, textile fibres, and other
opaque objects form a large portion of those to be examined, this
sub-stage plate has a space between the perforations which, when
brought into position, provides a dark ground by preventing the
passage of light from underneath. A condensing lens is, however,
provided for the better lighting of opaque objects. Here we have a
microscope which combines efficiency with stability, while its very
simplification allows of a really good and effective instrument for the
small sum of £3 3s.
Fig. 64.—Ross’s “New Industrial” Microscope.

Messrs. Beck’s Microscopes.


Messrs. Beck have adopted what may be termed a rival system of
fine adjustment in their modern microscopes. The short lever and
screw applied externally to the body tube is peculiar, I may say, to
the Ross-Jackson system, and was originally devised to allow of the
body tube being supported somewhat more firmly on the limb. This
change had its merits fully realised in the early microscopes of Smith
and Beck. To their successors, R. & J. Beck, the microscope owes
much, and very many important improvements, while all their
instruments and accessories are excellent examples of good
workmanship and finish. In their Pathological Microscope we have a
movement originally found in Tolles’ microscopes: a vertical disc, by
which the centre can be raised or depressed to correspond with the
thickness of the slide. The stage can also be brought into an
inverted position by rack and pinion. Their fine adjustment has been
greatly improved, as we shall presently see, whereby it has been
made more sensitive and delicate of adjustment. The general
construction of their microscopes as a rule possess the following
advantages: the stands are strong, firm, and yet not too light or too
heavy, the instruments cannot alter from the position in which they
are placed, as, unfortunately, will occasionally happen when joints
work loose; in every position the heavier part of the stand maintains
the centre of gravity.

Beck’s Pathological Microscope (Fig. 65) is a nearly perfect


instrument, furnished with a firm triangular foot, which ensures
great steadiness in any position. It has a well adapted joint for
placing the instrument at any angle of inclination; coarse adjustment
by spiral rack and pinion; fine adjustment by delicate lever and
micrometer screw motion; rack and pinion focussing and screw
centring sub-stage, made to carry all condensers and other sub-
stage apparatus; mechanical stage with horizontal and vertical
traversing motions. The stage is attached to the instrument by two
screws and can therefore be removed at pleasure, leaving a large
square flat glass stage for the culture-plate. It is likewise provided
with finder divisions, and as it always fits on to the same place, any
particular portion of the object can be recorded and found at any
moment. The triple nose-piece is a convenient addition, and a very
acceptable one to the student while diligently engaged in histological
research.
Fig. 65.—Beck’s Pathological Microscope, with square and
removable stage.
Fig. 66.—Beck’s Large “Continental Model” Microscope.

Beck’s Large “Continental Model” Microscope is of superior finish. It


is provided with a substantial horse-shoe foot, which gives support
to the strong, well-balanced body, jointed for giving the microscope
any angle of inclination. The body is provided with a draw-tube
which can be racked down to the Continental measurement. It has a
spiral rack and pinion coarse adjustment, and a fine adjustment of
the most perfect workmanship, which will be described in detail
presently. It has a large square stage with vulcanite top plate to
receive culture preparations. The sub-stage is of the most approved
form for centring, and carries an achromatic or Abbe condenser, iris
diaphragm, &c. The double mirror can be swung out of place for
direct illumination and micro-photography. Altogether, this
instrument is in every way fitted for critical or class-room work.

To return to the fine adjustment of


this, as of other forms of Messrs.
Beck’s microscopes, the applied
mechanism of which is believed to
be one of the most sensitive and
delicate character yet contrived. It
is constructed as shown in the
accompanying figure. The body of
the instrument is supported upon
the barrel D D; this barrel is
accurately and smoothly fitted to
the triangular core E E. At the top
of barrel D D is screwed the cap
G, to which is attached the rod C;
this rod passes through the centre
of the core E E and connects with
the lever arm A at B. The action of
the spring J, which is wrapped
spirally around the rod C, raises
the body of the microscope and
holds the lever arm A tightly
Fig. 67.—Beck’s “New Fine Adjustment.”
against the screw arm F. The
slightest motion, therefore, of the
screw F is communicated through
the lever A and the rod C to the body of the microscope.

The great delicacy of this arrangement will be appreciated when it is


noticed that the distance from I H is double the distance of I B,
therefore any motion at B is only half that at H. This adjustment is
one of the most delicate made for use with high powers.
Fig. 68.—Beck’s National Binocular Microscope.

In the construction of Beck’s Binocular National Microscope, the body


is held in a sliding fitting in the limb, and is moved up or down by
means of a rack and pinion motion. This constitutes the coarse
focussing adjustment. The fine adjustment is effected by the milled
head, which acts upon the body by means of a lever inside the limb.
The upper circular surface of the stage is made of glass, and carries
the object holder, which is provided with a ledge and spring to hold
the object by means of the pressure of an ivory-tipped screw, so
that it can be moved about readily and smoothly. The pressure of
the screw is adjusted by the milled head, which permits of more or
less pressure being made upon the edge of the object.
Fig. 69.—Beck’s Star Microscope.

When the stage is required for other purposes the object holder can
be unscrewed and removed. Beneath the stage there is a cylindrical
fitting for the reception of a diaphragm, a polariser, or other
apparatus. The mirror, besides swinging in a rotatory semi-circle, is
made to slide up or down the stem. The microscope is supported by
a firm pillar on a tripod base, and the body can be inclined at any
angle convenient for working. A sub-stage can be added at any time
for the reception of an achromatic condenser fitted with concentric
screws—a necessity for more delicate microscopical research work.

Beck’s Star Microscope is in every sense a students’ or class-room


instrument. It is firm and well made, with joint for inclination, large
square stage, sliding coarse adjustment and fine adjustment by
micrometer screw, draw-tube, iris diaphragm, double mirror on
swinging crank arm, A or B eye-piece, a one-inch and quarter-inch
objective, the magnifying power of which ranges from 38·5 to 183.

Fig. 70.—Beck’s Binocular Dissecting Microscope.

An early binocular microscope for dissecting purposes was devised


by the late Mr. R. Beck. (Fig. 70.) This took the form of a simple
instrument built up on a square mahogany base A raised about four
inches upon four brass supports B B, having a large circular stage
plate made to revolve on a second plate, on which the object is
placed and brought under the eye for dissection. On the left hand
side is a milled head rack and pinion K, which acts upon a horizontal
bar I for focussing the magnifying lens. Another bar, R, carries the
prism P and a pair of eye-pieces arranged on the principle of M.
Nachet’s binocular microscope. Mr. Beck preferred to adopt
Wenham’s method of arranging these prisms; that is, by allowing
half the cone of rays to proceed to one eye without interruption,
while the other half is intercepted by the prisms and transmitted to
the other eye. Beneath the stage is the ordinary mirror L. The
condensing lens M is supported on a separate brass holder let into
one of the supports of the stand. In practice, however, this
arrangement was found inconvenient, and the microscope has
therefore not been brought into general use.

Messrs. Watson’s Microscopes.


Among London opticians, the various microscopes manufactured by
Messrs. Watson, of Holborn, are of high finish and good
workmanship. Those specially designed for the use of students
possess merits of their own in their mechanical construction, and
also embody a provision, as indeed do all their instruments, whether
for students or more pretentious work, whereby wear and tear in
their frictional parts can be compensated for by the user himself.
This is effected in a simple but efficient manner. The fittings are
sprung, and screws set just outside the dove-tails. The very slightest
turn of the screws compresses the dove-tails, and a very large
amount of wear can in this way be prevented.

I am glad to notice that Messrs. Watson have adopted certain


standard sizes recommended some time ago by the Royal
Microscopical Society for the diameters of eye-pieces. It would be a
great advantage if the same standard became generally recognised
and brought into use, since it is a matter of much importance to
microscopists.

Watson’s Edinburgh Students’ Microscope (Fig. 71) is a thoroughly


efficient one for all practical purposes, great care having been
bestowed upon its smallest details, and it is not difficult to perceive
the reason of its popularity among students. The tripod form of foot
ensures great steadiness and firmness; the body carries the smaller
0·92 eye-piece, and with draw-tube closed is of the Continental
length. The draw-tube is graduated to millimetres, and when fully
extended the body measures 10 inches. The stage is provided with
mechanical and rotary movements; the compound sub-stage with
centring screws, rack and pinion to focus, and a means of lifting the
condenser out of the optical axis when not required for use.
Notwithstanding, none of the movements are at all cramped; a clear
distance is maintained beneath the stage, affording plenty of room
for manipulating the mirror. Both coarse and fine adjustments work
with smoothness, the latter being on Watson’s latest improved
principle—one revolution of the milled head moves the body 1⁄300 of
an inch. The stage is of extra large size, to allow of the use of large
culture-plates. No Continental stand of higher price compares with
the Edinburgh microscope. Its height when placed in the vertical
position is 11½ inches.
Fig. 71.—Watson’s Edinburgh Students’ Microscope.
Fig. 72.—Sub-stage of Edinburgh Students’ Microscope. This view
of underside of stage of students’ instrument shows the mirror set
at an angle for oblique illumination, and sub-stage turned aside.

The various sizes of oculars adopted by opticians and at present in


vogue cause considerable confusion. A standard size is specially
needed for students’ and small microscopes. The standard long used
by Continental manufacturers is 0·92 of an inch. The adoption of this
size would place the eye-piece in the same position as that of the
universal screw for the objective, formulated by the Royal
Microscopical Society many years ago. The desirability of using
standard sizes has been fully recognised by Messrs. Watson and they
are now adapted to most of their microscopes. The English diameter,
1·35 of an inch, known as the “Ross” size, is retained in all their
microscopes of large size.

Watson’s Mechanical Draw-tube.


Fig. 73.—Watson’s Mechanical Draw-tube (full-size).

An important feature in connection with the body-tube of Watson’s


Edinburgh Students’ Microscope (as, indeed, in all their fully
furnished instruments) is that they are provided with two draw-
tubes; one moved by rack-work, the other sliding inside the body-
tube. The advantage is, that the body can be made very short or
extremely long, while sufficient latitude can be given to objectives
corrected for either Continental or English tube-lengths, and to
adjusting the same for thickness of cover-glass by variation of tube
length. Should the cover-glass be thicker than that for which the
objective is corrected, a shorter tube-length is necessary; if thinner,
the body must be lengthened. This is effected by means of the
rackwork draw-tube. The length of the body when closed is 142
millimetres (55⁄8 inches), and when the two draw-tubes are
extended, 305 millimetres (12 inches), being, therefore, shorter than
the Continental and longer than the English tube lengths. Both draw-
tubes are divided into millimetres, and on the rackwork draw-tube a
double scale is engraved, reading continuously from the sliding
draw-tube when fully drawn out, or giving the body length when the
rackwork draw-tube alone is in use. The utility of this mechanical
draw-tube is that it permits of quick manipulation with perfect
results.

Fig. 74.—Watson’s Histological Microscope. Stand “A.”—Height,


when placed vertically and tube pushed home, 9½ inches.
The inside top of the draw-tube is smaller than the remainder, the
former making a fitting for the eye-piece about 1 inch long,
permitting of the tube being blackened inside up to this fitting, thus
minimising reflection. The end of the draw-tube has the universal
screw for using the apertometer, &c.

Watson’s Histological Microscope (Fig. 74) is a somewhat cheaper


form of instrument, designed for the student; although of plainer
construction it is quite as well made as the costlier model. It is
provided with spiral rack and pinion coarse adjustment, and with this
motion the greatest smoothness is preserved. There is no backlash,
the teeth of the pinion never leaving the rack; so effective is it that a
high power can be perfectly focussed by its means. It is also
furnished with their universal pattern of fine adjustment. This can be
had for £3 3s.

Fig. 75.—Watson’s Semi-Mechanical Stage.

Messrs. Watson have among other accessories of value introduced in


connection with their several microscopes a semi-mechanical stage,
whereby they are enabled to reduce the cost of manufacture. Fig. 75
is an outline sketch of the same.
This stage is of the horse-shoe shape, with cut-out centre,
constructed of ¼-inch brass plate, and measures over all 5¼ inches
wide by 4 inches deep. Fitting on the edges of the main stage is a
frame which is actuated vertically by means of a double rack and
pinion from beneath, giving ¾-inch of movement, having controlling
heads on either side of the stage; on the edges of this mechanical
frame a sliding bar is fitted, consequently movement may be
imparted either by rackwork or by hand. The mechanical movement,
however is in one direction only; but as the bar carries the object,
the worker can easily move the object out horizontally with the
finger. The advantage of this stage is that the whole surface is
perfectly flush, and the pinion heads are below its level, so that
culture plates or continuous sections may be conveniently examined.

Another addition of
considerable value is the
centring underfitting for
students’ microscopes.

This fitting places in the hands


of student workers a means of
accurately centring the sub-
Fig. 76.—New Centring Underfitting for stage condenser, at a low cost.
Microscope. It consists of the usual
underfitting tube, having a
flange at the top which is fitted in a box between two plates. The
centring is effected by means of two screws, which press the flange
against a spring, as in the ordinary sub-stage centring movement.
The fitting can be adapted to any form of Messrs. Watson’s and most
other makers of students’ microscopes.

Watson’s Bacteriological Improved Van Heurck’s Microscope (Fig. 77)


is in every way a superior instrument, and it at once conveys a
favourable impression to the practical worker. When set up for use
its many convenient points—its excellence of workmanship and the
precision of its movements—seem to imply its special adaptation for
the bacteriological laboratory and for other high-class work where
absolute reliance has to be placed in the results obtained. Every
detail of the instrument is carried out in the best possible manner.
The coarse adjustment is effected by means of a diagonal rack and
spiral pinion, which ensures the smoothest possible motion; while
the fine, the most important movement in the instrument, is made
with an extra long lever, a specialty of Messrs. Watson’s, and which
imparts an extremely slow action: this is now one of the most
delicate and reliable forms of fine adjustment. By its means the
entire body is raised or lowered by means of a milled head fixed to a
screw having a hardened steel point acting on a lever against a point
attached to the body slide, in a dove-tailed fitting about 2½ inches
long. Owing to the position of the controlling milled head on the
limb, it can be worked with either hand. Another feature of
importance is that, in using the fine adjustment the distance
between the eye-piece and objective remains unaltered. All the
frictional parts of the microscope have spring slots to the dove-tailed
fittings, in which compensating screws are fitted. These are some
few of the more important points, to which much thought and
attention have been given. The body permits also of the use of
objectives of any other optician, since its total length when the draw
tubes are closed up is only 143 mm.; when extended, a total length
of 320 mm. is available. By this means an ample margin is left for
the correction for cover-glass thickness, whether the objective used
be intended for the 160 mm. or 250 mm. tube length. The height of
the microscope when placed in the vertical position is 131⁄8 inches.
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!

testbankmall.com

You might also like