• 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 2 out of 6 pages
Exam (elaborations)

Java Exam Questions With All Correct Answers

Document preview thumbnail
Preview 2 out of 6 pages

JAVA EXAM QUESTIONS WITH ALL CORRECT ANSWERS

Content preview

JAVA EXAM QUESTIONS WITH ALL
CORRECT ANSWERS

If you declare a variable as an instance variable within a class and you declare and use
the same variable name within a method of the class, then within the method - Answer-
The variable used inside the method takes precedence

A method variable ____ a class variable within the same name - Answer-Override

Non-ambiguous, overloaded methods must have the same - Answer-Name

If a method is written to receive a double parameter, and you assign an integer to the
method, then the method will - Answer-Work correctly, the integer will be promoted to a
double

A constructor ____ parameters - Answer-Can receive

A constructor ____ overloaded - Answer-Can be

If a class is named Student, the class constructors named is - Answer-Student

If you use the automatically supplied default constructor when you create an object -
Answer-Numeric fields are set to 0 (zero)

The code between a pair of curly braces in a method is a - Answer-Block

When a block exists within another block, the blocks are - Answer-Nested


The logical structure in which one instruction occurs after another with no branching is a
- Answer-Sequence

Which of the following is typically used in a flowchart to indicate a decision? - Answer-
Diamond

Which of the following is not a type of it statement? - Answer-Reserve if

A decision is based on a(n) ____ value - Answer-Boolean

, In Java, the value of (4 > 7) is ____. - Answer-False

Assuming the variable q has been assigned the value 3, which of the following
statements displays XXX? - Answer-if ( q >7);
System.out.println("XXX");

What is the output of the following code segment?
t = 10
if ( t > 7)
System.out.print("AAA");
System.out.print("BBB"); - Answer-AAA

What is the output of the following code segment?
t=7
if (t > 7)
System.out.print("AAA");
System.out.print("BBB"); - Answer-BBB

When you code an if statement within another if statement, as in the following then the if
statements are ____.
if (a > b)
if (c > d) x = 0; - Answer-Nested

The operator that combines two conditions into a single Boolean value that is true only
when both of the conditions are true, but is false other wise, is ____. - Answer-&&

The operator that combines two conditions into a single Boolean value that is true when
at least one of the conditions is true is ____. - Answer-||

Which of the following groups has the lowest operator precedence? - Answer-Logical
OR

Which of the following displays "Error" when a student ID is less than 1000 or more than
9999? - Answer-if (stuID < 1000 )
System.out.println("Error");
else
if (stuID > 9999)
System.out.println("Error");

You can use the statement to terminate a switch structure - Answer-break

The argument testing in a switch structure can be any of the following except a(n) ____.
- Answer-double

Assuming a variable w has been assigned to the value 15, what does the following
statement do?

Document information

Uploaded on
July 12, 2025
Number of pages
6
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$13.49

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.
Scholarsstudyguide
3.8
(169)
Sold
853
Followers
476
Items
16410
Last sold
1 week 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