Question: Java programming multiple choice and one fill in the blank 1. What is the value of d if the user enters 123 ? Scanner kybd

Java programming multiple choice and one fill in the blank

1. What is the value of d if the user enters 123?

Scanner kybd = new Scanner(System.in); 

double d = Double.parseDouble(kybd.next());

a. 123.0

b.0.123

c. the code does not compile because 123 is an int

2. Declare the variable i correctly

String s0 = "ab"; 
String s1 = "cd"; 
_____i = s0.compareTo(s1); 

3. What is s after the following?

String s = "AbCd"; 
s.toLowerCase(); 
 
a. abCd 
b. ABCD 
c. AbCd 

4. Consider

String team = "Durham Bulls";

Which statement will return that character 'B'?

a. char b = team.charAt(7);

b. char b = team[8];

c.char b = team[7];

5. Which of the following statement(s) are true given the code snippet

int sophie; 
String sally; 
(multiple answers) 
 
a. sophie contins an integer value like 5, but sally points to an object of type string 
b. sophie contains a pointer to an integer value, sally contains a pointer to a string 
c. sophie is a variable, but sally contains an object 
d. both sally and sophie are variables 

6. Consider

String s0 = "ab"; 
String s1 = "cd"; 

What is the difference between the following

String s2 = s0 + s1; 

String s3 = s0.concat(s1);

a. none, both are "abcd"

b. s2 is "cdab" s3 is "abcd"

c. none, both are "cdab"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!