100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Java Final EXAM/50 Questions & answers $12.49   Add to cart

Exam (elaborations)

Java Final EXAM/50 Questions & answers

 0 view  0 purchase
  • Course
  • Institution

Java Final EXAM/50 Questions & answers

Preview 3 out of 19  pages

  • September 7, 2024
  • 19
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
avatar-seller
Java Final EXAM/50 Questions & answers
Which of these packages is automatically loaded, so you don't need to
import it?


1. java.applet
2. java.awt
3. java.string
4. java.lang - -4. java.lang 100%

-System.out is an object of the class _________________.



1. Applet
2. Output
3. System
4. PrintStream - -4. PrintStream 100%

-Which of these shows the correct way to print a literal number?


1. System.out.println({123.75});
2. System.out.println("123.75");
3. System.out.println('123.75');
4. System.out.println(123.75); 100% - -4. System.out.println(123.75); 100%

-According to the CS 170 style rules, every method and each class must
have a ______________________.



1. Single-line comment
2. Javadoc comment
3. body
4. header - -2. Javadoc comment 100%

-The Java keyword that says class B adds something to, or builds upon the
existing definition for class A is ____________________.



1. extends
2. import

,3. derives
4. inherits - -1. extends 100%

-Consider the following statements.

double x = -987.33;
String y = String.format("%(9.2f", x);

What is the value of y?



1. "(987.33)"
2. "-(987.33)"
3. "-987.33"
4. " (987.33)" - -4. " (987.33)" 100%

-If s is a String object, which of these relational expressions is illegal (that is,
your code will not compile if you use it) :



A. s == "Hi"
B. s != "Hi"
C. s > "Hi"
D. All of these are legal - -C. s > "Hi" 100%

-After the execution of the following code, what will be the value of num if
the input values are 4 5?
int num = readInt();

if (num > 0)
num = num + 10;
else
if (num >= 5)
num = num + 15;



1. 4
2. 14
3. 5
4. 15 - -2. 14 100%

-What is the result of evaluating the expression below? Your answer must be
the correct type:

, •€€€€€ 2 is an int
•€€€€€ 2.0 is a double
•€€€€€ "2" is a String

2 * * .0 + 4.5 - 1 - -4.0 100% Equals 4.0 (100%)

-How can a method send a primitive value back to the caller?



1. By assigning the value to one of its parameters
2. It can call its caller with the value
3. By using the return statement
4. It cannot send primitive values back to the caller - -3. By using the return
statement 100%

-Which of these cannot be used as a case label in a switch statement :



A. case 10:
B. case x: // assume x is a final int variable
C. case 10..20:
D. case 'C': - -C. case 10..20: 100%

-A loop that searches for a particular value in input is called a(n) :



A. counted [or counting] loop
B. sentinel loop
C. data loop
D. endless loop - -B. sentinel loop 100%

-What is the output of the following Java code?

intx=55;
inty=5;

switch(x%7)
{
case0:
case1:
y++;
case2:
case3:

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Victorious23. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $12.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

74735 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$12.49
  • (0)
  Add to cart