Are the following statements correct? If so, show the output.
Want to see the full answer?
Check out a sample textbook solutionChapter 2 Solutions
Introduction to Programming with C++
Additional Engineering Textbook Solutions
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
C How to Program (8th Edition)
Starting Out With Visual Basic (7th Edition)
C Programming Language
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
- State what output, if any, results from each of the following statements: a. for (i = 1; i <= 1; i++)cout << "*";cout << endl;b. for (i = 2; i >= 1; i++)cout << "*";cout << endl; c. for (i = 1; i <= 1; i--)cout << "*";cout << endl;d. for (i = 12; i >= 9; i--)cout << "*";cout << endl;e. for (i = 0; i <= 5; i++)cout << "*";cout << endl;f. for (i = 1; i <= 5; i++){cout << "*";i = i 1 1;}cout << endl;arrow_forwardSuppose that x, y, z, and w are int variables and x = 25, y = 3, z = 12, and w = 4. What is the output of the following statements? b. cout << "y != z - 9: " << (y != z - 9) << endl; c. cout<<"x-y==z+10:"<<(x-y==z+10)<<endl; d. cout << "!(z < w): " << !(z < w) << endl;arrow_forwardWrite true if the two statements are equivalent; otherwise write false. 1. ∼(∼p∨q) and p∨∼q 2. p and ∼(∼p)arrow_forward
- write true or false for each of the following statements:arrow_forwardWhat is the output of the following code? int x = 0; if (x < 4) { x = x + 1; } cout<< x;arrow_forwardSuppose that x, y, z, and w are int variables and x = 25, y = 3, z = 12, and w = 4. What is the output of the following statements? a. cout << "x == z: " << (x == z) << endl;b. cout << "y != z - 9: " << (y != z - 9) << endl;c. cout << "x - y == z + 10: " << (x - y == z + 10) << endl;d. cout << "!(z < w): " << !(z < w) << endl;e. cout << "w - y < x - 2 * z: " << (w - y < x - 2 * z)<< endl;arrow_forward
- What is the printout of the following code? int[][] numbers = {{1}, {1, 2}, {1, 2, 3}};System.out.print(numbers.length + ", " + numbers[1].length); A. 3, 1 B. 1, 3 C. 3, 3 D. 3, 2arrow_forwardtrace the following code and give the output. for (int value =3; pow (2, value) <=100; value++) cout << pow (2, value) << ": ";arrow_forwardWhat is the output of the following code segment? int n = 1;do { cout << n << ' '; n++; } while (n >= 5) What is the output of the following code segment? int n = 1;do { cout << n << ' '; n++; } while (n <= 5);arrow_forward
- What is the output of the following code: int main() { test1(); test1(); return 0; } void test1 () { static int x=2; int y = 8; cout<<x<<" "<<y<<endl; x+=2; y++; }arrow_forwardWhat are the return values of the following statements in R (a) 4==4 & 5==5 (b) 5! =5 | 6==6 (c)5==5 | 6 !=6 (d) x<-5 & y<-6arrow_forward1. The following statements shown below will result in the printing of: for (i= 3; i < 15; i += 3) { printf ("%d ", i); ++i; } 2. Complete the following code segments below to display this output. Replace ??? with your answer. 11111 2222 333 44 5 for (int j = 1; j = j; k--) { ???; } printf("\n"); } 3. How many times does the program below prints an *? for (int i = 5; iarrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning