• 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 9 pages
Exam (elaborations)

CS 170 || Already Passed.

Document preview thumbnail
Preview 2 out of 9 pages

If an account balance is $1,000 or more, you pay interest. If the balance is less than $100 you charge a fee. The best way to write this is to : correct answers use two if statements If s is a String object, which of these relational expressions is illegal (that is, your code will not compile if you use it) : correct answers s "Hi" The second operand used by the conditional operator must have the type : correct answers Any type is OK When a selection statement causes a line of code to be executed, that line of code is called : correct answers a branch What is the output of the following Java code? int x = 0; if (x 0) println("One "); println("Two "); println("Three"); correct answers Two Three Which of the following is a relational operator? correct answers == Which of the following is not a selection control structure in Java? correct answers case Two-way selection in Java is implemented using ____. correct answers if...else statements In a ____ control structure, the computer executes particular statements depending on some condition(s). correct answers selection Which of the following is NOT a relational operator in Java? correct answers According to the online lessons, _________________ are the components used to build OOP computer programs. correct answers objects Normally, in an object, the methods are _____________, while the fields are ___________. correct answers public, private According to the online lessons, the ________ of an object includes all the information about the object; that is, its attributes or characteristics. correct answers state To create a new class by adding features or data elements to an existing class, you use the OOP technique of correct answers inheritance

Content preview

CS 170 || Already Passed.
If an account balance is $1,000 or more, you pay interest. If the balance is less than $100 you
charge a fee. The best way to write this is to : correct answers use two if statements

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

The second operand used by the conditional operator must have the type : correct answers Any
type is OK

When a selection statement causes a line of code to be executed, that line of code is called :
correct answers a branch

What is the output of the following Java code?
int x = 0;
if (x < 0)
println("One ");
println("Two ");
println("Three"); correct answers Two
Three

Which of the following is a relational operator? correct answers ==

Which of the following is not a selection control structure in Java? correct answers case

Two-way selection in Java is implemented using ____. correct answers if...else statements

In a ____ control structure, the computer executes particular statements depending on some
condition(s). correct answers selection

Which of the following is NOT a relational operator in Java? correct answers <<

According to the online lessons, _________________ are the components used to build OOP
computer programs. correct answers objects

Normally, in an object, the methods are _____________, while the fields are ___________.
correct answers public, private

According to the online lessons, the ________ of an object includes all the information about the
object; that is, its attributes or characteristics. correct answers state

To create a new class by adding features or data elements to an existing class, you use the OOP
technique of correct answers inheritance

, The generic term for methods that carry out an action is a ____________________. correct
answers procedure

Methods like setBackground() that you can use in your own applets are called
____________________ methods. correct answers inherited

When your program first starts, instead of specifying the exact steps to carry out, you can specify
the steps to perform in a general way. Later, you can supply the definition for the general
commands that you've used. This is called: correct answers top-down design

Look at the following few lines of code:

public void printTopHalf()
{
// Statements go here
}

the word printTopHalf is the: correct answers method name

Look at the following few lines of code:

public void printTopHalf()
{
// Statements go here
}

the parentheses following printTopHalf is the: correct answers parameter list

Which modifier is used to specify that a method cannot be used outside a class? correct answers
private

public String exampleMethod(int n, char ch) correct answers String

public int minimum(int x, int y)
{
int smaller = Math.min(x, y);
return smaller;
}
Based on the above code, what would be the output of the statement

int s = minimum(5, minimum(3, 7)); correct answers 3

Which of the following is NOT true about return statements? correct answers return statements
can be used in void methods to return values.

Document information

Uploaded on
March 25, 2025
Number of pages
9
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$11.79

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.
SirAnton
3.7
(118)
Sold
811
Followers
438
Items
40316
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