• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 4 out of 199 pages
Exam (elaborations)

Test Bank for Starting Out with Java: Control Structures through Objects, 8th edition by Gaddis

Document preview thumbnail
Preview 4 out of 199 pages

Test Bank for Starting Out With Java: Control Structures through Objects, 8th edition 8e by Tony Gaddis. Full Chapters test bank are included - Chapter 1 to 16 Introduction to Computers and Java Java Fundamentals Decision Structures Loops and Files Methods A First Look at Classes Arrays and the ArrayList Class A Second Look at Classes and Objects Text Processing and Wrapper Classes Inheritance Exceptions and Advanced File I/O JavaFX: GUI Programming and Basic Controls JavaFX: Advanced Controls JavaFX: Graphics, Effects, and Media Recursion Databases

Content preview

Test Bank for Starting Out with Java: Control Structures
through Objects, 8th edition by Gaddis


1. What does the `main` method header look like?
A) `public void main(String args)`
B) `public static void main(String[] args)`
C) `static public main(String[] args)`
D) `public main(String[] args)`
Answer: B
Rationale: The JVM calls `public static void main(String[] args)` as the entry point.




2. Which data type stores a single character?
A) `String`
B) `char`
C) `boolean`
D) `int`
Answer: B
Rationale: `char` holds one Unicode character; `String` holds a sequence.




3. What is the result of `` in Java?
A) 3.5
B) 3

,C) 4
D) 3.0
Answer: B
Rationale: Integer division truncates the decimal; both operands are `int`.




4. Which operator gives the remainder?
A) `/`
B) `%`
C) `*`
D) `+`
Answer: B
Rationale: `%` is the modulus operator; it returns the remainder.




5. What is the value of `x` after `int x = 5; x += 3;`?
A) 5
B) 3
C) 8
D) 2
Answer: C
Rationale: `+=` adds the right operand to the variable; 5 + 3 = 8.




6. Which of these is a valid `if` statement?
2

,A) `if x > 5 then`
B) `if (x > 5)`
C) `if x > 5`
D) `if (x > 5) then`
Answer: B
Rationale: Java requires parentheses around the condition.




7. What is the output of `System.out.println("Hello" + 5 + 3);`?
A) `Hello53`
B) `Hello8`
C) `Hello 5 3`
D) `8Hello`
Answer: A
Rationale: Left-to-right: `"Hello" + 5` → `"Hello5"`; then `+ 3` → `"Hello53"`.




8. Which loop always executes at least once?
A) `for`
B) `while`
C) `do-while`
D) `foreach`
Answer: C
Rationale: `do-while` checks the condition after the body.


3

, 9. What is the correct way to declare an array of 10 ints?
A) `int[] arr = new int[10];`
B) `int arr = new int[10];`
C) `int arr[10];`
D) `array int arr[10];`
Answer: A
Rationale: Java syntax: `type[] name = new type[size];`.




10. What does `arr.length` return?
A) Last index
B) Number of elements
C) Size in bytes
D) First element
Answer: B
Rationale: `.length` gives the array’s capacity, not the last index.




11. Which method compares two strings for equality?
A) `==`
B) `equals()`
C) `compare()`
D) `equalsIgnoreCase()`
Answer: B
4

Document information

Uploaded on
September 25, 2026
Number of pages
199
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$21.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
AcademicACHIEVER
3.3
(99)
Sold
569
Followers
24
Items
13085
Last sold
3 hours ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions