{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Test1 Class Revision - Exercice Chapter#2 1 What is the...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Exercice Chapter #2 1 What is the output of the following program? #include <iostream.h> void main ( ) { int x=1; for ( ; ; ) { if (x++ % 15 == 0) break; if (x % 5 != 0) continue; cout<< x << “ “; } } What is the output of the following program? #include <iostream.h> void main ( ) { int x=10; while ( x ) //>0 { if ( --x == 5 ) break; cout << x << “ “; } } What is the output of the following program? #include <iostream.h> void main ( ) { int x=10; while ( x ) //>0 cout<< --x << “ “; } What is the output of the following program? #include <iostream.h> void main ( ) { int j; for (j=1; j<=10; j++) { if (j>5 && j<=7) cout<< j <<endl; } cout<<endl; }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Exercice Chapter #2 2 What is the output of the following program? #include <iostream.h> void main ( ) { int j; for (j=1; j<=10; j++) { if (j>5 || j<=7) cout<< j <<endl; } cout<<endl; } What is the output of the following program? #include <iostream.h> void main ( ) { int j; for (j=1; j<=10; j++) { if (j<5 || j>=7) cout<< j <<endl; } cout<<endl; } What is the output of the following program? #include <iostream.h> void main ( ) { int j; for (j=1; j<=10; j++) { if (!(j<5 || j>=7)) cout<< j <<endl; } cout<<endl; } What is the output of the following program?
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}