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);}
Question
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 = (iPI)/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 (divm == n);}d.void bar(float a, float b) { float scale = a * b; ellipse(400, 400, scale, scale);}
Solution
Sure, I can help with that. Here are the answers to your questions:
Question 1: Answer 1: 17 Answer 2: 98 Answer 3: 3
Question 2: Answer 1: 134 Answer 2: 50 Answer 3: 3
Question 3: The loop block is entered 6 times.
Question 4: The statement executes 49 times.
Question 5: Answer 1: Condition Answer 2: Initialization Answer 3: Statement Answer 4: Update
Question 6: Answer 1: int urn Answer 2: a+5 Answer 3: boolean Answer 4: boolean let Answer 5: 4>3 Answer 6: int
Question 7: The value of the result returned by the function is not provided in the question.
Question 8: The code for the function calls is not provided in the question.
Question 9:
The matching function definition is:
b. int bar(int a) {
int rem = a%60;
return rem;
}
Similar Questions
Complete 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 + " ");}
Time left 0:15:27Question 11Answer savedMarked out of 1.00Flag questionQuestion textIf A=1’b1,B=2’b01,C=2’b00 y={4{A},2{B},C} equalsa.Noneb.10’b1111010100c. 8’b11110100d.9’b111101010Clear my choiceQuestion 12Not yet answeredMarked out of 1.00Flag questionQuestion textIn the given code snippet, statement 2 will executed at a.25b.15c.0d.30Clear my choiceQuestion 13Not yet answeredMarked out of 1.00Flag questionQuestion textIf A= 4b`001x and B= 4b`1011, then result of A+B will bea.110x b.1111c.xxxxd.1100Clear my choiceQuestion 14Not yet answeredMarked out of 1.00Flag questionQuestion textIn Verilog `d1234 is aa.32 bit decimal number b.It is invalid notationc.4 bit decimal number d.16 bit decimal number
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: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 leftShowQuestion 80Not yet answeredMarked out of 1.00Flag questionTipsQuestion textWhat will be the output of the following pseudocode?Integer p, q, r, s Set p=1, q = 1for (each r from 0 to 2 ) for (each s from -4 to -2 ) p = p + 2if(p > r) Continue End if p = 1if(p > s) Jump out of the loop End if End for End for Print p + qQuestion 80AnswerA.20B.24C.35D.13
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.