Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions