Docsity

Introduction to Java Programming and Data Structures – 12th Edition, Y. Daniel Liang – Com, Exams of Database Programming

Toggle sidebar
bg1
Java Programming and Data Structures | Page Introduction to Java Programming and Data Structures – 12th Edition, Y. Daniel Liang – Complete Test Bank (Chapters 1–44)400 Practice Questions with Answers and RationalesTable of Contents
Section
Topic
Question Range
1
Java Fundamentals and Program Structure
1–10
2
Primitive Types, Variables, and Operators
11–20
3
Selection and Boolean Logic
21–30
4
Mathematical Functions and Strings
31–40
5
Loops and Iteration
41–50
6
Methods and Parameter Passing
51–60
7
Recursion
61–70
8
Single- and Multidimensional Arrays
71–80
9
Classes, Objects, and Constructors
81–90
10
Encapsulation and Object-Oriented Design
91–100
11
Inheritance and Overriding
101–110
12
Polymorphism and Dynamic Binding
111–120
13
Abstract Classes and Interfaces
121–130
14
Exception Handling
131–140
15
Text and File I/O
141–150
16
Binary I/O and Serialization
151–160
17
JavaFX Fundamentals
161–170
18
JavaFX Events and Controls
171–180
19
Generics
181–190
20
Lists, Stacks, Queues, and Priority Queues
191–200
21
Sets and Maps
201–210
22
Algorithm Analysis and Big-O
211–220
23
Sorting Algorithms
221–230
24
Linked Lists
231–240
25
Binary Search Trees
241–250
26
AVL Trees
251–260
27
Hashing and Hash Tables
261–270
28
Graphs and Traversals
271–280
29
Weighted Graphs and Shortest Paths
281–290
30
Networking and Sockets
291–300
31
Internationalization and Localization
301–310
32
Multithreading
311–320
33
Concurrency Utilities and Parallelism
321–330
34
JDBC
331–340
35
Database Design and SQL
341–350
36
Servlets and Web Applications
351–360
37
Web Security and Application Architecture
361–370
38
Collections, Lambdas, and Streams
371–380
39
Debugging and Testing
381–390
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28

Partial preview of the text

Download Introduction to Java Programming and Data Structures – 12th Edition, Y. Daniel Liang – Com and more Exams Database Programming in PDF only on Docsity!

Introduction to Java Programming and Data Structures – 12th Edition,

Y. Daniel Liang – Complete Test Bank (Chapters 1–44)

400 Practice Questions with Answers and Rationales

Table of Contents

Section Topic Question Range

1 Java Fundamentals and Program Structure

2 Primitive Types, Variables, and Operators

3 Selection and Boolean Logic 21– 4 Mathematical Functions and Strings 31–

5 Loops and Iteration 41– 6 Methods and Parameter Passing 51– 7 Recursion 61–

8 Single- and Multidimensional Arrays 71– 9 Classes, Objects, and Constructors 81– 10 Encapsulation and Object-Oriented Design

11 Inheritance and Overriding 101– 12 Polymorphism and Dynamic Binding 111–

13 Abstract Classes and Interfaces 121– 14 Exception Handling 131– 15 Text and File I/O 141–

16 Binary I/O and Serialization 151– 17 JavaFX Fundamentals 161– 18 JavaFX Events and Controls 171–

19 Generics 181– 20 Lists, Stacks, Queues, and Priority Queues

21 Sets and Maps 201– 22 Algorithm Analysis and Big-O 211–

23 Sorting Algorithms 221– 24 Linked Lists 231– 25 Binary Search Trees 241–

26 AVL Trees 251– 27 Hashing and Hash Tables 261– 28 Graphs and Traversals 271–

29 Weighted Graphs and Shortest Paths 281– 30 Networking and Sockets 291– 31 Internationalization and Localization 301–

32 Multithreading 311– 33 Concurrency Utilities and Parallelism 321– 34 JDBC 331–

35 Database Design and SQL 341– 36 Servlets and Web Applications 351– 37 Web Security and Application Architecture

38 Collections, Lambdas, and Streams 371–

39 Debugging and Testing 381–

40 Software Design and Development Practices

Instructions

  • Choose the single best answer from options A–D.
  • The correct answer and a short rationale follow each question.
  • Use the questions for revision across Java programming, object-oriented design, data structures, algorithms, GUI development, concurrency, databases, and web programming.

Java Fundamentals and Program Structure

1. Which statement best describes the following concept? java source files normally use which extension?

A. An exception that must be caught or declared by the compiler's rules B. .java C. The member is accessible within its declaring top-level class D. Math Correct answer: B. .java Rationale: Java source code is conventionally saved in .java files.

2. Which statement best describes the following concept? which tool compiles Java source code?

A. long B. javac C. By value D. The remainder Correct answer: B. javac Rationale: The Java compiler translates source code into bytecode.

3. Which statement best describes the following concept? what does the JVM execute?

A. do-while B. The current object C. Java bytecode D. extends Correct answer: C. Java bytecode Rationale: The Java Virtual Machine executes compiled class files.

4. Which statement best describes the following concept? what is the conventional Java application entry-point method?

A. 4 B. do-while C. A variable declared in a method header D. public static void main(String[] args) Correct answer: D. public static void main(String[] args) Rationale: The launcher recognizes this conventional main method signature.

5. Which statement best describes the following concept? which primitive type stores a 64-bit signed integer?

A. Terminates the loop B. A subclass supplies a compatible implementation of an inherited method C. long D. To run cleanup code after try/catch processing Correct answer: C. long Rationale: long is Java's 64-bit signed integral primitive.

6. Which statement best describes the following concept? what is the default type of a decimal floating-point literal?

A. The remainder B. double

13. Which statement best describes the following concept? which statement selects code based on a boolean condition?

A. if B. Terminates the loop C. A reference type defining a contract for implementing classes D. A special value that signals input or loop termination Correct answer: A. if Rationale: An if statement conditionally executes a block.

14. Which statement best describes the following concept? which operator is the conditional or ternary operator?

A. The remainder B. An event that disrupts normal program execution C. ?: D. A subclass supplies a compatible implementation of an inherited method Correct answer: C. ?: Rationale: The conditional operator chooses between two expressions.

15. Which statement best describes the following concept? what does short-circuit evaluation mean for &&?

A. .java B. No C. The right operand is skipped when the left operand is false D. ?: Correct answer: C. The right operand is skipped when the left operand is false Rationale: A false left operand already determines the result of logical AND.

16. Which statement best describes the following concept? which loop checks its condition before executing its body?

A. A special value that signals input or loop termination B. A blueprint defining the state and behavior of objects C. By value D. while Correct answer: D. while Rationale: A while loop is a pretest loop.

17. Which statement best describes the following concept? which loop executes its body at least once?

A. do-while B. No C. 0 D. A variable declared in a method header Correct answer: A. do-while Rationale: The do-while condition is checked after the body.

18. Which statement best describes the following concept? what does break do inside a loop?

A. A class that cannot be instantiated directly B. length() C. 4 D. Terminates the loop Correct answer: D. Terminates the loop Rationale: break transfers control to the statement after the loop.

19. Which statement best describes the following concept? what does continue do inside a loop?

A. Java bytecode B. Skips to the next iteration C. No D. A reference type defining a contract for implementing classes Correct answer: B. Skips to the next iteration Rationale: continue ends the current iteration and proceeds with the next loop cycle.

20. Which statement best describes the following concept? what is a sentinel value?

A. A reference type defining a contract for implementing classes B. throw C. A special value that signals input or loop termination D. Math Correct answer: C. A special value that signals input or loop termination Rationale: Sentinel-controlled processing stops when the designated value appears.

Selection and Boolean Logic

21. Which statement best describes the following concept? what is a method parameter?

A. equals() B. 0 C. An event that disrupts normal program execution D. A variable declared in a method header Correct answer: D. A variable declared in a method header Rationale: Parameters receive values supplied by a method call.

22. Which statement best describes the following concept? what is an argument?

A. while B. javac C. == D. A value passed to a method call Correct answer: D. A value passed to a method call Rationale: Arguments are matched with the method's parameters.

23. Which statement best describes the following concept? what does a void method return?

A. Skips to the next iteration B. No value C. double D. javac Correct answer: B. No value Rationale: A void method performs work without returning a result.

24. Which statement best describes the following concept? what is method overloading?

A. Methods with the same name and different parameter lists B. extends C. try D. A method calling itself directly or indirectly Correct answer: A. Methods with the same name and different parameter lists Rationale: The compiler distinguishes overloaded methods by their parameter lists.

25. Which statement best describes the following concept? how does Java pass primitive arguments?

A. A method calling itself directly or indirectly B. .java C. By value D. ?: Correct answer: C. By value Rationale: A copy of the primitive value is assigned to the parameter.

26. Which statement best describes the following concept? what is recursion?

A. A class that cannot be instantiated directly B. To run cleanup code after try/catch processing C. A method calling itself directly or indirectly D. if

D. equals() Correct answer: C. An instance of a class Rationale: An object has state and behavior defined by its class.

34. Which statement best describes the following concept? what is a constructor used for?

A. No value B. extends C. Initializing a newly created object D. No Correct answer: C. Initializing a newly created object Rationale: A constructor runs when an instance is created.

35. Which statement best describes the following concept? does a constructor declare a return type?

A. Combining data and methods while controlling access to internal state B. No C. An exception that must be caught or declared by the compiler's rules D. A value passed to a method call Correct answer: B. No Rationale: A constructor uses the class name and has no return type.

36. Which statement best describes the following concept? what does the keyword this refer to?

A. public static void main(String[] args) B. The current object C. A value passed to a method call D. javac Correct answer: B. The current object Rationale: this refers to the instance whose method or constructor is executing.

37. Which statement best describes the following concept? what is encapsulation?

A. Combining data and methods while controlling access to internal state B. implements C. double D. A reference type defining a contract for implementing classes Correct answer: A. Combining data and methods while controlling access to internal state Rationale: Encapsulation protects object state through a controlled interface.

38. Which statement best describes the following concept? what does private access mean?

A. 0 B. To stop further recursive calls C. The member is accessible within its declaring top-level class D. Using a common supertype to refer to objects of different subtypes Correct answer: C. The member is accessible within its declaring top-level class Rationale: private restricts direct access to the declaring class.

39. Which statement best describes the following concept? which keyword declares inheritance from a class?

A. do-while B. By value C. extends D. ?: Correct answer: C. extends Rationale: A subclass uses extends to inherit from a superclass.

40. Which statement best describes the following concept? which keyword declares that a class implements an interface?

A. Initializing a newly created object B. The member is accessible within its declaring top-level class C. implements D. ArrayIndexOutOfBoundsException

Correct answer: C. implements Rationale: A class uses implements to provide an interface's behavior.

Loops and Iteration

41. Which statement best describes the following concept? what is method overriding?

A. By value B. The right operand is skipped when the left operand is false C. A subclass supplies a compatible implementation of an inherited method D. A value passed to a method call Correct answer: C. A subclass supplies a compatible implementation of an inherited method Rationale: Overriding enables specialized behavior in subclasses.

42. Which statement best describes the following concept? what is polymorphism?

A. 4 B. Using a common supertype to refer to objects of different subtypes C. A subclass supplies a compatible implementation of an inherited method D. javac Correct answer: B. Using a common supertype to refer to objects of different subtypes Rationale: Polymorphism allows different implementations behind one reference type.

43. Which statement best describes the following concept? what does super refer to?

A. Java bytecode B. An event that disrupts normal program execution C. The superclass portion of the current object D. Skips to the next iteration Correct answer: C. The superclass portion of the current object Rationale: super can access superclass members or invoke a superclass constructor.

44. Which statement best describes the following concept? what is an abstract class?

A. No B. Initializing a newly created object C. A class that cannot be instantiated directly D. To stop further recursive calls Correct answer: C. A class that cannot be instantiated directly Rationale: Abstract classes may declare abstract and concrete methods.

45. Which statement best describes the following concept? what is an interface?

A. A reference type defining a contract for implementing classes B. To stop further recursive calls C. Terminates the loop D. A blueprint defining the state and behavior of objects Correct answer: A. A reference type defining a contract for implementing classes Rationale: Interfaces support abstraction and multiple-type implementation.

46. Which statement best describes the following concept? what is an exception?

A. An event that disrupts normal program execution B. long C. Java bytecode D. A method calling itself directly or indirectly Correct answer: A. An event that disrupts normal program execution Rationale: Exceptions represent errors or unusual conditions during execution.

47. Which statement best describes the following concept? which block contains code that may throw an exception?

A. No value B. long C. 0

B. public static void main(String[] args) C. ArrayIndexOutOfBoundsException D. Combining data and methods while controlling access to internal state Correct answer: B. public static void main(String[] args) Rationale: The launcher recognizes this conventional main method signature.

55. Choose the most accurate answer to this review question: which primitive type stores a 64-bit signed integer?

A. ?: B. long C. The remainder D. equals() Correct answer: B. long Rationale: long is Java's 64-bit signed integral primitive.

56. Choose the most accurate answer to this review question: what is the default type of a decimal floating-point literal?

A. Combining data and methods while controlling access to internal state B. .java C. double D. A blueprint defining the state and behavior of objects Correct answer: C. double Rationale: A floating-point literal is double unless suffixed with f or F.

57. Choose the most accurate answer to this review question: what does the % operator calculate?

A. extends B. By value C. The remainder D. Java bytecode Correct answer: C. The remainder Rationale: The remainder operator returns what remains after division.

58. Choose the most accurate answer to this review question: what is the result of 9 / 2 when both operands are int?

A. 4 B. The right operand is skipped when the left operand is false C. extends D. ?: Correct answer: A. 4 Rationale: Integer division discards the fractional part.

59. Choose the most accurate answer to this review question: which operator compares primitive values for equality?

A. double B. The superclass portion of the current object C. while D. == Correct answer: D. == Rationale: For primitives, == compares values.

60. Choose the most accurate answer to this review question: which class provides static methods such as sqrt and pow?

A. The member is accessible within its declaring top-level class B. A variable declared in a method header C. Math D. A special value that signals input or loop termination Correct answer: C. Math Rationale: The Math class provides common mathematical operations.

Recursion

61. Choose the most accurate answer to this review question: how should two String objects be compared by contents?

A. An instance of a class B. Combining data and methods while controlling access to internal state C. equals() D. if Correct answer: C. equals() Rationale: String.equals compares character sequences.

62. Choose the most accurate answer to this review question: which String method returns the number of UTF- code units?

A. The member is accessible within its declaring top-level class B. long C. length() D. if Correct answer: C. length() Rationale: String.length returns the number of char units.

63. Choose the most accurate answer to this review question: which statement selects code based on a boolean condition?

A. A special value that signals input or loop termination B. ArrayIndexOutOfBoundsException C. Terminates the loop D. if Correct answer: D. if Rationale: An if statement conditionally executes a block.

64. Choose the most accurate answer to this review question: which operator is the conditional or ternary operator?

A. 4 B. A blueprint defining the state and behavior of objects C. Using a common supertype to refer to objects of different subtypes D. ?: Correct answer: D. ?: Rationale: The conditional operator chooses between two expressions.

65. Choose the most accurate answer to this review question: what does short-circuit evaluation mean for &&?

A. 0 B. Initializing a newly created object C. The right operand is skipped when the left operand is false D. A special value that signals input or loop termination Correct answer: C. The right operand is skipped when the left operand is false Rationale: A false left operand already determines the result of logical AND.

66. Choose the most accurate answer to this review question: which loop checks its condition before executing its body?

A. long B. array.length C. while D. A variable declared in a method header Correct answer: C. while Rationale: A while loop is a pretest loop.

67. Choose the most accurate answer to this review question: which loop executes its body at least once?

A. long B. 0 C. 4

C. A subclass supplies a compatible implementation of an inherited method D. 4 Correct answer: A. Methods with the same name and different parameter lists Rationale: The compiler distinguishes overloaded methods by their parameter lists.

75. Choose the most accurate answer to this review question: how does Java pass primitive arguments?

A. array.length B. extends C. ArrayIndexOutOfBoundsException D. By value Correct answer: D. By value Rationale: A copy of the primitive value is assigned to the parameter.

76. Choose the most accurate answer to this review question: what is recursion?

A. By value B. Methods with the same name and different parameter lists C. A method calling itself directly or indirectly D. An array whose elements are themselves arrays Correct answer: C. A method calling itself directly or indirectly Rationale: Recursive solutions solve smaller versions of a problem.

77. Choose the most accurate answer to this review question: why does recursion require a base case?

A. To stop further recursive calls B. if C. do-while D. A variable declared in a method header Correct answer: A. To stop further recursive calls Rationale: The base case prevents unbounded recursion.

78. Choose the most accurate answer to this review question: what is the first valid index of a Java array?

A. if B. The remainder C. 0 D. A special value that signals input or loop termination Correct answer: C. 0 Rationale: Java arrays use zero-based indexing.

79. Choose the most accurate answer to this review question: how is an array's length accessed?

A. array.length B. No value C. Math D. ArrayIndexOutOfBoundsException Correct answer: A. array.length Rationale: Arrays expose a final length field.

80. Choose the most accurate answer to this review question: what exception may occur when an array index is invalid?

A. Terminates the loop B. The current object C. A method calling itself directly or indirectly D. ArrayIndexOutOfBoundsException Correct answer: D. ArrayIndexOutOfBoundsException Rationale: Access outside the valid index range causes this exception.

Classes, Objects, and Constructors

81. Choose the most accurate answer to this review question: what is a two-dimensional Java array?

A. A value passed to a method call B. Initializing a newly created object C. ArrayIndexOutOfBoundsException D. An array whose elements are themselves arrays Correct answer: D. An array whose elements are themselves arrays Rationale: Java represents multidimensional arrays as arrays of arrays.

82. Choose the most accurate answer to this review question: what is a class?

A. An instance of a class B. A blueprint defining the state and behavior of objects C. Math D. Initializing a newly created object Correct answer: B. A blueprint defining the state and behavior of objects Rationale: A class declares fields, constructors, and methods.

83. Choose the most accurate answer to this review question: what is an object?

A. double B. A blueprint defining the state and behavior of objects C. An instance of a class D. ArrayIndexOutOfBoundsException Correct answer: C. An instance of a class Rationale: An object has state and behavior defined by its class.

84. Choose the most accurate answer to this review question: what is a constructor used for?

A. Java bytecode B. Skips to the next iteration C. throw D. Initializing a newly created object Correct answer: D. Initializing a newly created object Rationale: A constructor runs when an instance is created.

85. Choose the most accurate answer to this review question: does a constructor declare a return type?

A. A subclass supplies a compatible implementation of an inherited method B. No C. An event that disrupts normal program execution D. if Correct answer: B. No Rationale: A constructor uses the class name and has no return type.

86. Choose the most accurate answer to this review question: what does the keyword this refer to?

A. A variable declared in a method header B. Combining data and methods while controlling access to internal state C. The current object D. javac Correct answer: C. The current object Rationale: this refers to the instance whose method or constructor is executing.

87. Choose the most accurate answer to this review question: what is encapsulation?

A. Combining data and methods while controlling access to internal state B. if C. To run cleanup code after try/catch processing D. Math Correct answer: A. Combining data and methods while controlling access to internal state Rationale: Encapsulation protects object state through a controlled interface.

Correct answer: B. A class that cannot be instantiated directly Rationale: Abstract classes may declare abstract and concrete methods.

95. Choose the most accurate answer to this review question: what is an interface?

A. An instance of a class B. An exception that must be caught or declared by the compiler's rules C. A reference type defining a contract for implementing classes D. No Correct answer: C. A reference type defining a contract for implementing classes Rationale: Interfaces support abstraction and multiple-type implementation.

96. Choose the most accurate answer to this review question: what is an exception?

A. A variable declared in a method header B. A class that cannot be instantiated directly C. Methods with the same name and different parameter lists D. An event that disrupts normal program execution Correct answer: D. An event that disrupts normal program execution Rationale: Exceptions represent errors or unusual conditions during execution.

97. Choose the most accurate answer to this review question: which block contains code that may throw an exception?

A. 0 B. try C. Methods with the same name and different parameter lists D. if Correct answer: B. try Rationale: A try block encloses code whose exceptions may be handled.

98. Choose the most accurate answer to this review question: which keyword explicitly throws an exception?

A. throw B. No value C. Combining data and methods while controlling access to internal state D. Java bytecode Correct answer: A. throw Rationale: throw raises a specific Throwable object.

99. Choose the most accurate answer to this review question: what is the purpose of finally?

A. To run cleanup code after try/catch processing B. if C. A method calling itself directly or indirectly D. By value Correct answer: A. To run cleanup code after try/catch processing Rationale: A finally block is generally executed whether or not an exception occurs.

100. Choose the most accurate answer to this review question: what is a checked exception?

A. Math B. ArrayIndexOutOfBoundsException C. length() D. An exception that must be caught or declared by the compiler's rules Correct answer: D. An exception that must be caught or declared by the compiler's rules Rationale: Checked exceptions are subject to compile-time handling requirements.

Inheritance and Overriding

101. In Java programming, what is the correct answer to this question? java source files normally use which extension?

A. .java

B. extends C. ?: D. The current object Correct answer: A. .java Rationale: Java source code is conventionally saved in .java files.

102. In Java programming, what is the correct answer to this question? which tool compiles Java source code?

A. A reference type defining a contract for implementing classes B. javac C. equals() D. A subclass supplies a compatible implementation of an inherited method Correct answer: B. javac Rationale: The Java compiler translates source code into bytecode.

103. In Java programming, what is the correct answer to this question? what does the JVM execute?

A. Java bytecode B. try C. throw D. An array whose elements are themselves arrays Correct answer: A. Java bytecode Rationale: The Java Virtual Machine executes compiled class files.

104. In Java programming, what is the correct answer to this question? what is the conventional Java application entry-point method?

A. javac B. throw C. public static void main(String[] args) D. ?: Correct answer: C. public static void main(String[] args) Rationale: The launcher recognizes this conventional main method signature.

105. In Java programming, what is the correct answer to this question? which primitive type stores a 64-bit signed integer?

A. long B. 4 C. Methods with the same name and different parameter lists D. extends Correct answer: A. long Rationale: long is Java's 64-bit signed integral primitive.

106. In Java programming, what is the correct answer to this question? what is the default type of a decimal floating- point literal?

A. javac B. A blueprint defining the state and behavior of objects C. try D. double Correct answer: D. double Rationale: A floating-point literal is double unless suffixed with f or F.

107. In Java programming, what is the correct answer to this question? what does the % operator calculate?

A. do-while B. extends C. A subclass supplies a compatible implementation of an inherited method D. The remainder Correct answer: D. The remainder Rationale: The remainder operator returns what remains after division.

114. In Java programming, what is the correct answer to this question? which operator is the conditional or ternary operator?

A. The member is accessible within its declaring top-level class B. do-while C. ?: D. The remainder Correct answer: C. ?: Rationale: The conditional operator chooses between two expressions.

115. In Java programming, what is the correct answer to this question? what does short-circuit evaluation mean for &&?

A. The right operand is skipped when the left operand is false B. 4 C. if D. A special value that signals input or loop termination Correct answer: A. The right operand is skipped when the left operand is false Rationale: A false left operand already determines the result of logical AND.

116. In Java programming, what is the correct answer to this question? which loop checks its condition before executing its body?

A. implements B. while C. To run cleanup code after try/catch processing D. The current object Correct answer: B. while Rationale: A while loop is a pretest loop.

117. In Java programming, what is the correct answer to this question? which loop executes its body at least once?

A. equals() B. while C. do-while D. length() Correct answer: C. do-while Rationale: The do-while condition is checked after the body.

118. In Java programming, what is the correct answer to this question? what does break do inside a loop?

A. Terminates the loop B. Using a common supertype to refer to objects of different subtypes C. try D. length() Correct answer: A. Terminates the loop Rationale: break transfers control to the statement after the loop.

119. In Java programming, what is the correct answer to this question? what does continue do inside a loop?

A. length() B. To run cleanup code after try/catch processing C. A special value that signals input or loop termination D. Skips to the next iteration Correct answer: D. Skips to the next iteration Rationale: continue ends the current iteration and proceeds with the next loop cycle.

120. In Java programming, what is the correct answer to this question? what is a sentinel value?

A. if B. while C. Initializing a newly created object D. A special value that signals input or loop termination

Correct answer: D. A special value that signals input or loop termination Rationale: Sentinel-controlled processing stops when the designated value appears.

Abstract Classes and Interfaces

121. In Java programming, what is the correct answer to this question? what is a method parameter?

A. ?: B. double C. extends D. A variable declared in a method header Correct answer: D. A variable declared in a method header Rationale: Parameters receive values supplied by a method call.

122. In Java programming, what is the correct answer to this question? what is an argument?

A. A value passed to a method call B. ?: C. Initializing a newly created object D. implements Correct answer: A. A value passed to a method call Rationale: Arguments are matched with the method's parameters.

123. In Java programming, what is the correct answer to this question? what does a void method return?

A. double B. public static void main(String[] args) C. Terminates the loop D. No value Correct answer: D. No value Rationale: A void method performs work without returning a result.

124. In Java programming, what is the correct answer to this question? what is method overloading?

A. .java B. Methods with the same name and different parameter lists C. Terminates the loop D. Combining data and methods while controlling access to internal state Correct answer: B. Methods with the same name and different parameter lists Rationale: The compiler distinguishes overloaded methods by their parameter lists.

125. In Java programming, what is the correct answer to this question? how does Java pass primitive arguments?

A. The right operand is skipped when the left operand is false B. while C. By value D. implements Correct answer: C. By value Rationale: A copy of the primitive value is assigned to the parameter.

126. In Java programming, what is the correct answer to this question? what is recursion?

A. public static void main(String[] args) B. implements C. The member is accessible within its declaring top-level class D. A method calling itself directly or indirectly Correct answer: D. A method calling itself directly or indirectly Rationale: Recursive solutions solve smaller versions of a problem.

127. In Java programming, what is the correct answer to this question? why does recursion require a base case?

A. A subclass supplies a compatible implementation of an inherited method B. extends C. To stop further recursive calls