What is the value in sum, after the execution of the following statements? a) 15
ID: 3834194 • Letter: W
Question
What is the value in sum, after the execution of the following statements? a) 15 b) 16 c) 0 d) 1 For the following function, choose the correct answers a) fives (25) = 0; fives(36) = 1; b) fives(25) = 1; fives(36) = 0; c) fives(25) = 1; fives(36) = 1; d) fives(25) = 0; fives(36) = 0; e) None For the following function, choose the correct answers: a) Pos(5, 0, 0, -1) = 2; Pos(5, 2, 0, 0) = 4; b) Pos(5, 0, 0, -1) = 3; Pos(5, 2, 0, 0) = 4; c) Pos(-1, 0, -1, 0) = 2; Pos(-5, 2, 0, 0) = 3; d) Pos(0, 0, -1, 0) = 2; Pos(0, 0, -2, -1) = 0; e) None What is the number of iteration in the following for loops, respectively? a) 11, infinity, 1 b) 10, 4, infinity c) 10, 4, 1 d) 11, infinity, 0 e) None What is the value of a, b, sum, count after the execution of the following code: a) a = 30; b = 0; sum = 10; count = 16 b) a = 30; b = 0; sum = 40; count = 16 c) a = 30; b = 0; sum = 40; count = 15 d) a = 30; b = 30; sum = 40; count = 16 e) NoneExplanation / Answer
14)in the first iteration the value of k=0 so the array[0][0] value is 2 and sum =0 then sum =sum +2
and then k value is incremented and k=1 now k[1][1]=6 now sum +6 after addition of sum+2
and k= value is incremented and k[2][2]=7
now sum=15
15)The corrrect option is a) because the value 25 is not deivided by 6 and it will return 0 and the value 36 is divided by 6 so it will return value1
16)
the correct option is a)
because the value of a =5 so the value of count is incremented by 1 and now count value is 1
now check the value of b the value of b is 0 the condition is false
so the value of count is 1 and now check the value of c the value of c is equal to 0 so the value of count is incremented now the count value is 2
17)the correct option is e the first loop will execute even once condition is false and the second loop will execute 2 time
18) the correct answer is d
a value is 30 and t=it is less than 40 the value of count will incrememt an now count value is 16 .and sum value is 40 and the value of b is 30 and the sum value is 40 so the condition is false.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.