Java week4

About this set

Created by:

Thunderrod  on March 4, 2011

Log in to favorite or report as inappropriate.
Pop out
No Messages

You must log in to discuss this set.

Java week4

The expression (int)6.9 + (int)7.9 evaluates to ____.
13
1/15
Preview our new flashcards mode!

Study:

Cards

Speller

Learn

Test

Scatter

Games:

Scatter

Space Race

Tools:

Export

Copy

Combine

Embed

Order by

Terms

Definitions

The expression (int)6.9 + (int)7.9 evaluates to ____. 13
Suppose that alpha is a double variable. What is the value of alpha after the following statement executes: alpha = 11.5 + (double)(15) / 2;. 19.0
String y = String.format("%15s", "Jumpin' Java"); " Jumpin' Java"
String sentence;
String str1, str2, str3;
int length1, length2;

sentence = "Today is Wednesday.";

str1 = sentence.substring(9, 18);
str2 = str1.substring(0, 3);
str3 = sentence.replace('d', '*');

length1 = sentence.length();
length2 = str1.length();


Based on the code above, what is the value of str3?
Toay is Wenes*ay.
Assume that the following variables have been declared:

String str1 = "Q.E.D.";
String str2 = "Arcturan Megadonkey";
String str3 = "Sirius Cybernetics Corporation";

Evaluate the following expression. Make sure that your answer is the correct type:

2 is an int
2.0 is a double
"X" is a String
'X' is a char


str3.substring(9, str3.indexOf("e"))
"b"
Evaluate the following expression. Make sure that your answer is the correct type:

2 is an int
2.0 is a double


Math.abs(2 + -4)
2
Assume that the following variables have been declared:

String str1 = "Q.E.D.";
String str2 = "Arcturan Megadonkey";
String str3 = "Sirius Cybernetics Corporation";

Evaluate the following expression. Make sure that your answer is the correct type:

2 is an int
2.0 is a double
"X" is a String
'X' is a char


str1.toLowerCase()
"q.e.d."
Evaluate the following expression. Make sure that your answer is the correct type:

2 is an int
2.0 is a double


Math.sqrt(16) * Math.max(Math.abs(-5), Math.abs(-3))
20.0
If you want to execute one piece of code when the variable x is greater than 100, and another piece of code otherwise, you should use : an if statement with an else part
What is the output of the following Java code?

int x = 6;
if (x > 10)
println("One ");
println("Two ");
Two
What is the output of the following code fragment?

int x = 10;
if (x > 15)
x = 0;
println(x);
else
println(x + 5);
Syntax error (does not compile)
In a ____ control structure, the computer executes particular statements depending on some condition(s). selection
What does <= mean? less than or equal to
If s is a String object, which of these relational expressions is illegal (that is, your code will not compile if you use it) : s > "Hi"
What is the output of the following Java code?

int x = 0;
if (x < 0)
println("One ");
println("Two ");
println("Three");
Two Three

First Time Here?

Welcome to Quizlet, a fun, free place to study. Try these flashcards, find others to study, or make your own.

Set Champions

There are no high scores or champions for this set yet. You can sign up or log in to be the first!