Knowee
Questions
Features
Study Tools

Time left 1:45:06Question 21Not yet answeredPoints out of 1.00Flag questionTipsQuestion textWhat is the output after this code is compiled and its executable run?#include <iostream>#include <string>using namespace std;int main(){ string str ( "Let us do something crazy" ); cout << "size: " << str.size() << ", "; cout << "length: " << str.length() << ", "; cout << "capacity: " << str.capacity() << ", "; cout << "max size: " << str.max_size() << "\n"; return 0;}Select one:a.size: 2, length: 2, capacity: 2, max size: 25b.size: 5, length: 5, capacity: 5, max size: 4611686018427387897c.size: 25, length: 5, capacity: 25, max size: 25d.size: 25, length: 25, capacity: 25, max size: 4611686018427387897Clear my choiceQuestion 22Not yet answeredPoints out of 1.00Flag questionTipsQuestion textWhat is the output beginning in line 19 after this code is compiled and its executable run?1 #include <iostream>2 #include <string>3 #include <sstream>4 using namespace std;5 struct movies_t{6 string title;7 int year;8 } mn, ys;9 void pm( movies_t movie );10 int main(){11 string ms;12 mn.title = "2001 A Space Odyssey";13 mn.year = 1968;14 cout << "Enter title: ";15 getline( cin, ys.title);16 cout << "Enter year: ";17 getline( cin, ms );18 stringstream( ms ) >> ys.year;19 cout << "My favorite movie is: ";20 pm( mn );21 cout << "And yours is:\n ";22 pm( ys );23 return 0;24 }25 void pm( movies_t movie ){26 cout << movie.title;27 cout << " (" << movie.year << ")\n";28 }Select one:a.2001 A Space Odysseyb.2001 A Space Odyssey (1968)c.My favorite movie is: 2001 A Space Odyssey 1968d.My favorite movie is: 2001 A Space Odyssey (1968)Clear my choiceQuestion 23Not yet answeredPoints out of 1.00Flag questionTipsQuestion textWhat is the final output of this code?double tmpC[5] = {-10.0, -8.0,-6, -4.0, -2.0};fprintf("%8s %8s\n", "Celsius", "Fahrenheit");for (i=0; i<3; i++) { tmpF = ((tmpC[i] * (9.0/5.0)) + 32.0); fprintf("%10.2f %10.2f\n", tmpC[i], tmpF);}Select one:a.Celsius Fahrenheit -10 23.8 -8 25.8 -6 27.8 -4 29.8 -2 31.8b.Fahrenheit Celsius -10 23.8 -8 25.8 -6 27.8 -4 29.8 -2 31.8c.Celsius Fahrenheit-10.00 23.80 -8.00 25.80 -6.00 27.80d.Celsius Fahrenheit -10.00 23.80 -8.00 25.80 -6.00 27.80 -4.00 29.80 -2.00 31.80

Question

Time left 1:45:06Question 21Not yet answeredPoints out of 1.00Flag questionTipsQuestion textWhat is the output after this code is compiled and its executable run?#include <iostream>#include <string>using namespace std;int main(){ string str ( "Let us do something crazy" ); cout << "size: " << str.size() << ", "; cout << "length: " << str.length() << ", "; cout << "capacity: " << str.capacity() << ", "; cout << "max size: " << str.max_size() << "\n"; return 0;}Select one:a.size: 2, length: 2, capacity: 2, max size: 25b.size: 5, length: 5, capacity: 5, max size: 4611686018427387897c.size: 25, length: 5, capacity: 25, max size: 25d.size: 25, length: 25, capacity: 25, max size: 4611686018427387897Clear my choiceQuestion 22Not yet answeredPoints out of 1.00Flag questionTipsQuestion textWhat is the output beginning in line 19 after this code is compiled and its executable run?1 #include <iostream>2 #include <string>3 #include <sstream>4 using namespace std;5 struct movies_t{6 string title;7 int year;8 } mn, ys;9 void pm( movies_t movie );10 int main(){11 string ms;12 mn.title = "2001 A Space Odyssey";13 mn.year = 1968;14 cout << "Enter title: ";15 getline( cin, ys.title);16 cout << "Enter year: ";17 getline( cin, ms );18 stringstream( ms ) >> ys.year;19 cout << "My favorite movie is: ";20 pm( mn );21 cout << "And yours is:\n ";22 pm( ys );23 return 0;24 }25 void pm( movies_t movie ){26 cout << movie.title;27 cout << " (" << movie.year << ")\n";28 }Select one:a.2001 A Space Odysseyb.2001 A Space Odyssey (1968)c.My favorite movie is: 2001 A Space Odyssey 1968d.My favorite movie is: 2001 A Space Odyssey (1968)Clear my choiceQuestion 23Not yet answeredPoints out of 1.00Flag questionTipsQuestion textWhat is the final output of this code?double tmpC[5] = {-10.0, -8.0,-6, -4.0, -2.0};fprintf("%8s %8s\n", "Celsius", "Fahrenheit");for (i=0; i<3; i++) { tmpF = ((tmpC[i] * (9.0/5.0)) + 32.0); fprintf("%10.2f %10.2f\n", tmpC[i], tmpF);}Select one:a.Celsius Fahrenheit -10 23.8 -8 25.8 -6 27.8 -4 29.8 -2 31.8b.Fahrenheit Celsius -10 23.8 -8 25.8 -6 27.8 -4 29.8 -2 31.8c.Celsius Fahrenheit-10.00 23.80 -8.00 25.80 -6.00 27.80d.Celsius Fahrenheit -10.00 23.80 -8.00 25.80 -6.00 27.80 -4.00 29.80 -2.00 31.80

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

Sure, I can do that. Here are the answers to your questions:

Question 21: The correct answer is d. size: 25, length: 25, capacity: 25, max size: 4611686018427387897. The size and length of a string in C++ are the same and represent the number of characters in the string. The capacity is the size of the memory allocated for the string, which is at least as large as the size. The max_size is the maximum number of characters that a string object can hold due to system or library implementation limitations.

Question 22: The correct answer is d. My favorite movie is: 2001 A Space Odyssey (1968). The function pm prints the title and year of the movie in the format "title (year)".

Question 23: The correct answer is c. Celsius Fahrenheit -10.00 14.00 -8.00 17.60 -6.00 21.20. The code converts Celsius temperatures to Fahrenheit and prints them in a table. The conversion formula is F = C * 9/5 + 32. The temperatures are printed with two decimal places.

This problem has been solved

Similar Questions

Time left 1:45:06Question 21Not yet answeredPoints out of 1.00Flag questionTipsQuestion textWhat is the output after this code is compiled and its executable run?#include <iostream>#include <string>using namespace std;int main(){ string str ( "Let us do something crazy" ); cout << "size: " << str.size() << ", "; cout << "length: " << str.length() << ", "; cout << "capacity: " << str.capacity() << ", "; cout << "max size: " << str.max_size() << "\n"; return 0;}Select one:a.size: 2, length: 2, capacity: 2, max size: 25b.size: 5, length: 5, capacity: 5, max size: 4611686018427387897c.size: 25, length: 5, capacity: 25, max size: 25d.size: 25, length: 25, capacity: 25, max size: 4611686018427387897Clear my choiceQuestion 22Not yet answeredPoints out of 1.00Flag questionTipsQuestion textWhat is the output beginning in line 19 after this code is compiled and its executable run?1 #include <iostream>2 #include <string>3 #include <sstream>4 using namespace std;5 struct movies_t{6 string title;7 int year;8 } mn, ys;9 void pm( movies_t movie );10 int main(){11 string ms;12 mn.title = "2001 A Space Odyssey";13 mn.year = 1968;14 cout << "Enter title: ";15 getline( cin, ys.title);16 cout << "Enter year: ";17 getline( cin, ms );18 stringstream( ms ) >> ys.year;19 cout << "My favorite movie is: ";20 pm( mn );21 cout << "And yours is:\n ";22 pm( ys );23 return 0;24 }25 void pm( movies_t movie ){26 cout << movie.title;27 cout << " (" << movie.year << ")\n";28 }Select one:a.2001 A Space Odysseyb.2001 A Space Odyssey (1968)c.My favorite movie is: 2001 A Space Odyssey 1968d.My favorite movie is: 2001 A Space Odyssey (1968)Clear my choiceQuestion 23Not yet answeredPoints out of 1.00Flag questionTipsQuestion textWhat is the final output of this code?double tmpC[5] = {-10.0, -8.0,-6, -4.0, -2.0};fprintf("%8s %8s\n", "Celsius", "Fahrenheit");for (i=0; i<3; i++) { tmpF = ((tmpC[i] * (9.0/5.0)) + 32.0); fprintf("%10.2f %10.2f\n", tmpC[i], tmpF);}Select one:a.Celsius Fahrenheit -10 23.8 -8 25.8 -6 27.8 -4 29.8 -2 31.8b.Fahrenheit Celsius -10 23.8 -8 25.8 -6 27.8 -4 29.8 -2 31.8c.Celsius Fahrenheit-10.00 23.80 -8.00 25.80 -6.00 27.80d.Celsius Fahrenheit -10.00 23.80 -8.00 25.80 -6.00 27.80 -4.00 29.80 -2.00 31.80

Time left 0:13:05Question 1Not yet answeredMarked out of 1.00Flag questionTipsQuestion textWhat will be the output of the program?public class Sample{    public static void main(String [] args)    {        int i = 10;        do while ( i < 10 )        System.out.print("The value of i is " + i);        while ( i > 10 ) ;    }}Select one:a.No output is produced.b.The value of i is 10 The value of i is 10c.Compilation errord.The value of i is 10Clear my choiceQuestion 2Not yet answeredMarked out of 1.00Flag questionTipsQuestion textWhich of the following options remain true for case constants in a switch construct?Select one:a.The code with the switch construct gives a compilation error when there is a duplicate case label   b.If no case matches but there is a default label, then all statements after the matching default label in the switch block are executed in sequence.      c.If no case matches and there is no default label, then no further action is taken and the switch statement completes abnormallyd.If any one of the case constants has a match with the expression, then all statements after the matching case label in the switch block are executed in sequencee.If no case matches and there is no default label, then it will result in a compilation error

Time left 1:48:10Question 16Not yet answeredPoints out of 1.00Flag questionTipsQuestion textTo start the debugger in Eclipse, which command do you use?Select one:a.Run → Debugb.Run As → Debugc.Debug As → Java Consoled.Debug As → Java ApplicationClear my choiceQuestion 17Not yet answeredPoints out of 1.00Flag questionTipsQuestion textGiven the input of 40000 s, 30000 s, and 70000 m, what data would be needed to ensure thorough coverage analysis?cin >> income;cin >> marital_status;if (marital_status == "s") // Condition 1{ if (income <= 30000) // Condition 2 tax = 0.10 * income; // Branch 1 else tax = 3000 + 0.25 * (income - 30000); // Branch 2}else{ if (income <= 60000) // Condition 3 tax = 0.10 * income; // Branch 3 else tax = 6000 + 0.25 * (income - 60000); // Branch 4}Select one:a.60000 mb.65000 mc.20000 sd.50000 s

Time left 0:02:39Question 1Answer savedMarked out of 1.00Flag questionQuestion textComplete the missing sections of the following code so that the following output is printed to the console17 20 23 26 29 32 35 38 41 44 47 50 53 56 59 62 65 68 71 74 77 80 83 86 89 92 95 98for(int i = Answer 1 Question 1; i <= Answer 2 Question 1; i += Answer 3 Question 1) {    print(i + " ");}Question 2Answer savedMarked out of 1.00Flag questionQuestion textComplete the missing sections of the following code so that the following output is printed to the console134 131 128 125 122 119 116 113 110 107 104 101 98 95 92 89 86 83 80 77 74 71 68 65 62 59 56 53 50int i = Answer 1 Question 2 ;while(i >= Answer 2 Question 2) {   print(i + " ");   i-= Answer 3 Question 2 ;}Question 3Answer savedMarked out of 1.00Flag questionQuestion textHow many times is the loop block entered when the following code executes?fоr(int i=16; і < 28; i+=2) {    <code inside loop block>}Answer:Question 3Question 4Answer savedMarked out of 1.00Flag questionQuestion textHow many times does the statement execute in the following code?for(int n = 0; n < 7; n++){ for(int m = 0; m < 7;m++){ statement; }}Answer:Question 4Question 5Answer savedMarked out of 1.00Flag questionQuestion textGiven the following code:for(float len = 2; len < =400; len = len + 75){ rect(400,400,len,len);  }Match the correct term with the corresponding code snippet.len < =400Answer 1 Question 5float len = 2Answer 2 Question 5rect(400,400,len,len);Answer 3 Question 5len = len + 75Answer 4 Question 5Question 6Answer savedMarked out of 1.00Flag questionQuestion textConsider the following code and fill in the blanks:This question is auto-marked and case sensitive. Avoid any spaces in the answer.boolean foo(int urn) {    return false; } int dip(boolean let) {   if(let) {      return 1;   }   else {      return -1;   }}void setup() {   int a = 5;   boolean b = foo(a+5);   float c = dip(4>3);}Formal parameter for foo is Answer 1 Question 6Actual parameter for foo is Answer 2 Question 6Return type of foo is Answer 3 Question 6Formal parameter for dip is Answer 4 Question 6Actual parameter for dip is Answer 5 Question 6Return type of dip is Answer 6 Question 6Question 7Answer savedMarked out of 1.00Flag questionQuestion textConsider the following function definition:What is the value of the result returned by the function above if the statement with the function call is int result = foo(6, 4, 1);result is Answer 1 Question 7Question 8Not yet savedMarked out of 1.00Flag questionQuestion textThe list should show the first 5 function calls in order first to last based on the code above.1. Answer 1 Question 82. Answer 2 Question 83. Answer 3 Question 84. Answer 4 Question 85. Answer 5 Question 8Question 9Not yet savedMarked out of 1.00Flag questionQuestion textGiven the following code snippet:  int n = 172;  n = bar(n);Which of the following is the matching function definition?Question 9Answera.float bar(float i) {  float value = (i*PI)/180.0;  return value;}b.int bar(int a) {  int rem = a%60;  return rem;}c.boolean bar(int n, int m) {  int div = n/m;  return (div*m == n);}d.void bar(float a, float b) {  float scale = a * b;  ellipse(400, 400, scale, scale);}

Time left 0:12:51Question 17Not yet answeredMarked out of 1.00Flag questionTipsQuestion textWhich of the following is NOT usually a visual feature of a text for analysis?Question 17Answera.font sizeb.word choicec.Typographyd.coloure.page layout

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.