OUTPUT IF:
X = 10 Y = -5
X = 5 Y = -5
X = -15 Y = 5
What does the following code output? int x = 7, y = 10; X -= 30; y *= 5; X += 32; y /= 4; cout << "y = " « y << " and x = " << x << "; " << endl; X -= 10; y /= 5; cout << "x = " << x < " and y = " << y « ";" << 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...
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...
Example (4) Trace the following program and find the output >> SOURCE CODE #include <iostream.h> int main0 // define two integers int x-3; int y = 4; //print out a message telling which is bigger if (x >y) i cout << "x is bigger than y" << endl: else cout << "x is smaller than y" << endl; return 0; Example (5) Write a C++ program that takes from the user a number in SR (Saudi Riyal) then the program...
31. The following code segment is syntactically correct: int number{20}; cout << number << setbase(16) << " " << number << setbase(10) << " " << number << showpos << " " << number << endl; T__ F__ 32. The following statement wants to determine if ‘count’ is outside the range of 0 through 100: if (count < 0 && count > 100) T__ F__ 33. There is...
y-y+2 ; eise iflxc4) Output: else System.out.printin(y) 8. int x-5, y-3 if (xs 10) x x-2 else x-x+2; Output: System.out printin(y): 9. int x -8; while (x 0) system, out .printin ("ні") ; output: - 10. int x 5 do ) while (x > 23) System.out println(x): output: 11. int x 25, y 8 System.out.println (x+ y) 12. int [1 arrayi 12, 4, 6, 8, 10) int value 0; for (int a 0; a array1.1ength; a++) Output value + arrayl...
points): Show the output of the code below as it would appear on the monitor. int main cout <<" <<endl: int wildcat 2: while (wildcat > 5) cout << wildcat <<endl; wildcat++ cout <K*<< endl; int jayhavk 5i do cout << jayhawk <s endl: while (jayhawk0) cout <<*" << endl; int wolverine l: while (wolverine 0 &&wolverine < 10) cout << wolverine <<endl: wolverine2: cout <<" <<endl: for (int zag-4; zag>0; zag_) cout <<****" << endl; for (int i-10; i<-30;...
USE THE TABLE AND OUTPUT TECHNIQUE FOR THIS 8 POINT PROBLEM What is the output from the following SEGMENT: note TYPES OF PARAMETERS AND VARIABLE SCOPES Hint: A table is not necessary but it may help you get the output and its order int (4), C(2): HINT THESE ARE GLOBAL int TestMe(int &Y, int Z) / PROTOTYPE FOR THE FUNCTION int main 0 int A BW: A = 4: B-3 W = Test Me A, B) MI CALL TO THE...
what is the output of the following code segment? C++ g. int arr[3][4]; for (int i = 0; i < 3; i++) for (int j = 0; j < 4; j++) arr[i][j] =i*4 + j; for (int i = 0; i < 3; i++) for (int j = 0; j < 4; j++) cout << arr[i][j] << " "; h. int next(int & x) { x= x + 1; return (x + 1); int main() { int y = 10;...
2. Consider the following recursive function (Chapter 17, #9, modified) void recFun (int x) { if (x > 10) { recFun (x / 10); cout<< X % 10; } else cout<< x; } a) What is printed by the call: recFun (268); b) How can the code be modified so that when a number is input, its digits are printed on separate lines? c) How can the code be modified so that the sum of all digits is printed?