Ans:1
The loop will not execute anymore becuase condition (while(i>19) ) is false as 5>19 is not true.
so ans is zero times.
Ans:2
5
5
5
==============================================================
KIndly Check and Verify Thanks..!!!
C++ 5.How many times will the following loop run? int i=5; while (i19) 6 . What...
How many Iterations will this while loop perform? int ico), j(10); cout << "i = " << i << endl; cout << "j = " << j << endl; while (i > j) { cout << "j-" « j << endl; j += 2; cout << "i = " << i << endl; } cout << "i = << i << endl; cout << "j = " << j << endl; 5 6 C 8 10 Infinite times Does the...
51. What is the output of the following code snippet? int number = 0; int ptr_num -&number ptr_num 60; number-80 cout < "ptr num << endl b, 60 c. 80 d. the address of number Answer 52. What is the output of the following code snippet? double num-0.0; double* ptr = # num = 15.0; ptr ptr 15.0 cout << num <<"ptr <<endl; a. 15 15 b. 15 30 С. 30 15 d. 30 30 Answer: 53. What is the...
in c++ language 1.Re-write the following for loop statement by using a while loop statement: int sum = 0; for(int i=0;i<=1000;i++){ sum+=i; } 1 (b). Following is the main () function of a program. The program asks a user to enter 150 integers and print the largest integer user entered. int main() { int score, highest; //missing portion of the program return 0; } 1(c). Find the missing portion of the following code, so the...
14.3 How many times is the statement cout<<]<<","<</<<","; executed in the following program? int I, ); for (I = 2; I >= 0; I--) { for (] = 1; }<2; J++) cout << ) << ", << I << cout << endl; 11 } Select one O 2.3 0 6.6 O c. 2 d. None of the above are correct
5.2 How many times this for loop will execute? for (i = 0; i <= 100; i++) ANN cout<<i+8<<endl; WA Am } Answer:
Please, explain your answer clearly (step-by-step) What output does this loop generate? int j = 1; do { int value = j * 2; j++; cout << value << ", "; } while (j <= 5); What is the output of the following code snippet? int my_fun (int A[], int size) { int result = 0; for (int i = 0; i < size; i++) { result = result + A[i]; } return result; } int main() { int...
(a)How many times does the code snippet given below display "Hello"? int x = 1; while (x != 15) { System.out.println ("Hello"); x++; } (b)What is the output of the following code fragment? int i = 1; int sum = 0; while (i <= 5) { sum = sum + i; i++; } System.out.println("The value of sum is " + sum); Quie 2 What is the output of the following snipped code? public class Test {...
What will the output be in the following? int a, b, c; a-b-0; c 5; ific< 1011 (a = = 0 &&b != 0)) 3. cout<<True"; else cout<<"False", What will the output be in the following? a. int icount; 4. do count = 0; cout<<"The count is "<cicount<<endl; while(icount<10); int count = 0; do b. cout<<"The count is “<<count<<endl; while++icount<10); c. for(int n 5; n>0; n-) cout<<n;
II. SHORT ANSWER QUESTIONS. (10, 2 POINTS FOR EACH QUESTION) 1. What will the following loop display? int x = 0; while (x <5) cout<<x << endl;
5. What is the output of the following section of a program int a[10] = {2,5,1,6,x,7,0,3,y,8}; for(int i=0;i<9;i++) a[i]=a[i+1]; for(int i=0;i<8;i++) cout<<a[i]<<” “; cout<<endl; 6. What will be shown on the output screen after following statements are executed? char a[ ]="I have a part time job"; int c=x, i=0 while(a[i]!=’\0’){ if(a[i]==' '){ c++; cout<<endl; } else cout<<a[i]; i++; } cout<<c<<endl; 7. After following statements are executed, what are the outputs char a[ ]= "Fresno City College"; for (i...