Question

Which of the following statements will convert a string s into a double value d? d Double.parseDouble(s) d- (new Double(s)).doubleValueO d- Double.valueOfs) doubleValueo. d All f the above a. b. of the following statements convert a double value d into a string s? s (new Double(d)).toStringO. b. C. new Double(d).stringoro: String stringotd d. Which of the following statements is correct? b Integer d. Integer parselnt(100, 16); Integer parselnt12,2) Integer parselntc 100): Integer parselnt 345, 8) parselnt(100); e. What is the output of Integer parselnt( 10,2)2 a. b. 2 10; Invalid statement d.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hii... Please check below.

1. Answer: d

All the above.

all the above statements converts the string to double.

2. Answer: a and e are correct.

s = (new Double(d)).toString();

s=d+"";

Both of the above executes and gives string as output.

3. Answer: c and e are correct

Integer.parseInt("100"); gives 100 and Integer.parseInt("345",8); gives 229

4. Answer: b

Integer.parseInt("10",2); it gives 2 as output. because we say 10 as binary number and coverted it to decimal number.4

Please let me know any issues. Thank you. All the best.

Add a comment
Know the answer?
Add Answer to:
Which of the following statements will convert a string s into a double value d? d...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • d. x2 41. Which of the following statements is invalid? a double r = 9.4632E15; b....

    d. x2 41. Which of the following statements is invalid? a double r = 9.4632E15; b. double r = 9.4632e15; c. double r = 2.9X106; d. double r = 326.75;

  • Consider the following statements: struct nameType { string first; string last; }; struct courseType { string...

    Consider the following statements: struct nameType { string first; string last; }; struct courseType { string name; int callNum; int credits; char grade; }; struct studentType { nameType name; double gpa; courseType course; }; studentType student; studentType classList[100]; courseType course; nameType name; Mark the following statements as valid or invalid. If a statement is invalid, explain why. student.course.callNum = "CSC230"; cin >> student.name; classList[0] = name; classList[1].gpa = 3.45; name = classList[15].name; student.name = name; cout << classList[10] << endl;...

  • 25. The ____________ method can be used to convert a string to a double. Group of...

    25. The ____________ method can be used to convert a string to a double. Group of answer choices c. ToString.double d. double.ToString b. double.Parse a. Parse.double 28. A constant variable's value can only be changed by other statements inside the class. Group of answer choices True False 30. When you assign a double value to a decimal variable, the double value is implicitly converted to a decimal with no loss of data. Group of answer choices True False

  • c++ Consider the following statement string str "Now is the time for the party!" What is...

    c++ Consider the following statement string str "Now is the time for the party!" What is the output of the following statements? (Assume that all parts are independent of each other.) a. cout <str·size ( ) end 1 ; b. Cout << str. substr (7, 8) <<endl: c. string: :size type indstr.find'£') string s str. substr (ind 4, 9); d. cout << str insert (11,"best " <<endl e. str.erase (16, 14) str.insert (16, "to study for the exam? ") cout...

  • Question 15 Which of the following statements will convert the string, str = "285" to an...

    Question 15 Which of the following statements will convert the string, str = "285" to an int? A int x = str; B int x = Integer.integer(str); C int x = Integer.parseInteger(str); D int x = Integer.parseInt(str);

  • what are the answes Which yields 2.5? (double)(10/4) (int)(10) / (int)(4) 10/4 (double)(10) / (double)(4) Considering...

    what are the answes Which yields 2.5? (double)(10/4) (int)(10) / (int)(4) 10/4 (double)(10) / (double)(4) Considering integer division, determine the result of 13 / 3 4.3 05 4.0 4 Which of the following statements is a valid declaration of a constant integer variable named STEP_SIZE? int STEP_SIZE = 5; O final int STEP_SIZE = 14; double STEP_SIZE = 5; final STEP_SIZE = 10; Which is an invalid identifier? num_Cars1 3numCars O_numCars numCars Which one is not a programming language. Java...

  • Write one statement to convert a numeric string s into a number and store the number...

    Write one statement to convert a numeric string s into a number and store the number into double variable i. Question 31 (2 points) Given a String variable address, write a String expression consisting of variable's String value concatenated the string "@google.com". So, if the variable refers to "yuan", the value of the expression would be "[email protected]" Question 32 (2 points) The expression "Test" + 1 + 2 evaluates to?

  • 3. Write Python statements that will do the following: a) Input a string from the user....

    3. Write Python statements that will do the following: a) Input a string from the user. *** Print meaningful messages along with your output.* b) Print the length of the String. Example input: The sky is blue. Correct output: The length of the string is 16 Incorrect output: 16 c) Print the first character of the string. d) Print the last character of the string. 4. Save the program. Double-check the left edge for syntax errors or warning symbols before...

  • Given the following code namespace globalType { void.printResult(): } which of the following statements is needed...

    Given the following code namespace globalType { void.printResult(): } which of the following statements is needed to access printResult? a. globalType.printResult(): b. globalType:: printResult: c. globalType.printResults(): d. globalType: printResult(): Consider the following statements: struct rectangleData { double length: double width: double area: double perimeter: }: rectangleData bigRect: Which of the following statements is valid in C++? a. cin > > bigRect:: length: b. cout < < bigRect.length: c. cout < < bigRect: d. cout < < length: What is the...

  • 5. Which one of the following statements declares a c-string variable? a.char c; b. string s;...

    5. Which one of the following statements declares a c-string variable? a.char c; b. string s; c. char c[10]; d.string s[10]; 6. ________________ function returns the uppercase version of expression. a. tolower(expression); b. upper(expression) c. toupper(expression); d. isupper(expression); 7. Which of the following creates a string object with data ‘csci-1410’? a. string str; b. string ‘csci-1410’; c. string s("csci-1410"); d. string s(csci-1410);

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT