Monday, March 22, 2010

quiz 3

1) What will be the output of the following code? Explain.
for(int i=0; i<10; i++);
   cout << "i";

2) What will be the output of the following code? Explain.
for(int i=0; i<10; i++);
   cout << i;

3) What will be the output of the following code? Explain.
for(int i=10; i>0; i--)
   cout << i;

4) Given the following function:
int foo(int bar) { return bar+bar*2; }
How would you call this function from main?
main() {
___________________________;
}

No comments:

Post a Comment