Question

Choose the right data types for all variables mentioned in the following code fragment (all four...

Choose the right data types for all variables mentioned in the following code fragment (all four variables have different data types):  int / String / char / double

pos = 5.1;
text = "hello world";
middle = text.charAt(( )pos);

0 0
Add a comment Improve this question Transcribed image text
Answer #1

pos is of type double
text is of type String
middle is of type char

Add a comment
Know the answer?
Add Answer to:
Choose the right data types for all variables mentioned in the following code fragment (all four...
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
  • In the code fragment below, what are the legal data types for the variable "answer"? (Multiple...

    In the code fragment below, what are the legal data types for the variable "answer"? (Multiple answers : Choose all that apply ) byte b = 1; char c = 2; short s = 3; int i = 4 ; float f = 5f; answer = b * c * s * i * f; a. byte b. char c. short d. int e. float f. double g. long

  • A. What is the output of the following C++ code fragment? (all variables are of type...

    A. What is the output of the following C++ code fragment? (all variables are of type int) int count-1; int y-100; while (count 3) y=y-1 ; count+t cout << y << endl; cout<< count <<endl What is the value of x after control leaves the following while loop? (all variables are of type int) B. int x0 while (x < 20) sum- sum+x cout << sum<< endl;

  • Question 31 -Given the following code fragment, what value is contained in myArr[O]? const int ARRAYSIZE...

    Question 31 -Given the following code fragment, what value is contained in myArr[O]? const int ARRAYSIZE 3 double() myArr new double [ARRAYSIZE] myArr [0]1.1 myArr [1]2.2; myArr [2] myArr [0] myArr[1 O3.3 2.2 O 1.1 0 Question 32 - Given the following code fragment, what is displayed in IblResult? const int ARRAYSIZE 3 double(] myArr - new double [ARRAYSIZE] myArr [0] - 1.1 myArr [1] 2.2 lblResult.Text - Convert.Tostring (myArr (01) 3.3 O 2.2 1.1 0 Question 33 - Given...

  • Consider the code fragment (assumed to be in a program in which all variables are correctly...

    Consider the code fragment (assumed to be in a program in which all variables are correctly defined): int num1, num2; double answer; // program gets num1 and num2 from user, and values received // are always non-zero ints between -100 and +100 (code not shown) ... // compute precise quotient: answer = static_cast<double>( num1 / num2 ); After the assignment statement the variable answer, will hold the most precise quotient possible, accurate to several digits to the right of the...

  • 5. (12 points) Consider the following code fragment (part of a program): int index 3; String...

    5. (12 points) Consider the following code fragment (part of a program): int index 3; String dna "ACTGTCA char nucleotide dna.charAt (index); Matching: For each term below, write the letter of the ONE choice that best matches the term. Data types Variables Literals Object Method ーParameter nde x a. coumt, nucleotide, and d b. 3 and "ACTGTCA c. int, char, and String d. index e. charAt f. dna na 6. (10 points) a. Wrte a statement that assigns true to...

  • Which of the following are variables of reference types? Note: 7K and are very common characters...

    Which of the following are variables of reference types? Note: 7K and are very common characters used in Chinese and Japanese languages. Select all of the answers that apply, and none of those that do not. Select one or more: char c = '*'; boolean b = true; double [] d w String s = ">\"; int a []

  • Consider the two variables in the following C-like (not C) code. Assume that both types of...

    Consider the two variables in the following C-like (not C) code. Assume that both types of long and int use 32 bits. Do the variable a and b have equivalent type under name type equivalence? What if under structure type equivalence? 0 struct {char c1[4],c1; int i;} a; struct {char c1[2],c2[3]; long l;} b;

  • 12) 8 pts. Find the errors in the following code fragment and correct them. #i nclude...

    12) 8 pts. Find the errors in the following code fragment and correct them. #i nclude <iostream> using namespace std; double fudge (double s) f return s 2.3; int mainO cout >> "Your original estimate" double estimate; cin >> estimate; cout << endl; for (int 1 = 0;1c3;i++); cout << "EStimate' < fudge(estimate) <<endl Hint: There are 4 syntax errors. There is one error that is syntactically correct but causes the output to not be what you would expect. Once...

  • Create four graphs showing the following four types of relationships between variables (Cozby p 79): positive...

    Create four graphs showing the following four types of relationships between variables (Cozby p 79): positive linear relationship, negative linear relationship, curvilinear relationship, no relationship. You need to choose two variables for each different type of graph. In other words, you cannot use the same variables for all four graph. You may not use any of the examples in the textbook.

  • Question9 1 pts Which of the following data types is NOT valid for the switch expression...

    Question9 1 pts Which of the following data types is NOT valid for the switch expression in a switch instruction? int O double char all three ARE valid NONE of these is valid

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