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 = 5; i >=0; i--)
cout<<a[i];
int i=0;
char a[ ]= "Fresno City College";
cout<<a[0];
while(a[i]!==’\0’){
if(a[i]==’ ‘&&a[i+1]!=’\0’)
cout<<a[i+1];
i++;
}
Answer 5
***********
x and y can not be int type so i need to be removed or replaced by values
Answer 6
***********
need to declare x with some value and termination symbol at second line int c=x, i=0;
Answer 7
***********
int i ; need to be declare
Answer 8
*************
while(a[i]!=='\0') to while(a[i]!='\0')
int i=0;
char a[ ]= "Fresno City College";
cout<<a[0];
while(a[i]!='\0')
{
if(a[i]==' '&&a[i+1]!='\0')
cout<<a[i+1];
i++;
}
if you have any doubt then please ask me without any hesitation
in the comment section below , if you like my answer then please
thumbs up for the answer , before giving thumbs down please discuss
the question it may possible that we may understand the question
different way and we can edit and change the answers if you argue,
thanks :)
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}; ...
5. (6 pts) What is the outputs of following section of a program? int a[10] = {1,2,3,2, 5, 6, 7, 8 , 9, y): int i - 0, 30: while (i<10) coutくく3くくendl ; 6. (6 pts) What is output of following set of instructions in a C++ program: (In this problem both x and y represent positive integers) int a[10]={-1, 3=0; 2, 7, -4, 11, -2, 3, -9); x, -y, int for (int i-0:i<10:i++) if (a [1]<0) s+ai] coutくく3(くend-; 7....
5. (7 pts) What wil display on the output screen after following program is executed? includeciostream using namespace std int b 40 int A function(int a) int main (void) int c 7, b 15 cout<cA function (e) <cendla return 6 int A function (int a) int i cout<<b<<endl; if (a>-0) else return i i-ai i--ai Ans5 6. (7 pts) Show what will appear on the output screen after the following program is executed tincludeciostream> using namespace std; void A function...
howthe output of the following 4 program segments (a) const int SIZE=8; int values[SIZE] = {10, 10, 14, 16, 6, 25, 5, 8}; int index; index=0; res = values[index]; for (int j=1; j<SIZE; j++) { if (values[j] > res) { res = values[j]; index = j; cout << index << res << endl; } } cout <<...
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;
What is the output of the following code snippet? (If there is some kind of syntax error indicate this by marking "error" in your answer choice) 1. int fly = 5; int x; if (fly-- > 5) x = 5; else x = 2; if (x++ > 3) cout << x; cout << fly << endl; 2. int i = 0; bool b = i == 0 || i++ > 0; if (!b) cout << i << endl; else cout...
[10pts] 7) What is the output of the following program? In other words, what is printed to the screen when you run it? #include <iostream> #include <queue> using namespace std int main) char qu[5] ('a, 'b',c'd','e' queue <char> q int N = 4; char ch for(int í - 0:ì < 5;++1) q.push(qu (]) for (int ǐ 0;i < N;++i) { = ch q.front); q push(ch): q.pop while(!q.emptyO) f cout << q.front ) <<endl; q.pop )
OUTPUT IF: X = 10 Y = -5 X = 5 Y = -5 X = -15 Y = 5 Consider the following code segment, clearly showing a blank with a carat (™). What are the outputs? int x, y; cout << "This summer I am going to learn"; if (x > 10) cout << "swimming,"; else if (y > 0) cout << "surfing." else if (x > 0) cout << "dancing."; if (x <-10) cout << "spinning,"; else cout...
What is the output of the program? int function1( int x, int& y) { if( x % 2 == 0) { x = x + y; } y = y - x; return x; } int main() { int a, b, result; cin >> a >> b; result = function1(a, b); cout << "a = "<< a << ", b = " << b << endl; cout << "result = " << result << endl; } Please make comments...
12. What is the output of the following C++ code? int x; int y; int *p = &x; int *q = &y; *p = 35; *q = 98; *p = *q; cout << x << " " << y << endl; cout << *p << " " << *q << endl; 13. What is the output of the following C++ code? int x; int y; int *p = &x; int *q = &y; x = 35; y = 46; p...
18 C++ 1. What is the output of the following program segment? int y-22: while ((y 3) != 0) cout << y<< "": y=y-2; The output is 2. Suppose that the input is 100, 20,-8, 50, 20. What is the output of the following C++ code? int sum0 int num: int j cin >> num: if (num < 0) continue зит зит + num; cout<< sum << endl; The output is