Exam 2 Review Quiz 09

5 return x2 whatdoesthefollowingcodeprint int x 5

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 
snippet
of
code
print?
 for (int i = 1; i < 3; i++) { for (int j = 1; j <= 2; j++) { cout << i+j << " "; } cout << endl; }
 (b) What
does
this
snippet
of
code
print?
 
 int a[6] = {5, 8, 7, 9, 13, -1}; cout << a[4] << endl; (c) If
the
following
function
is
defined
somewhere
in
the
program
and
 prototyped
above
main….
 
 int square(int& x) { return x*x; } 
 …what
does
the
following
code
print?
 
 int x = 5; int y = square(x); cout << x << endl; cout << y << endl; 
 (d) For
the
snippet
of
code…
 
 float f[50];
 
 …what
is
the
datatype
of
f[15]?
 
 
 
 
 
 
 
 
 (e) If
the
following
function
is
defined
somewhere
in
the
program
and
 prototyped
above
main….
 
 int my_function (int x, float array) { array[1...
View Full Document

This note was uploaded on 02/08/2014 for the course CS 115 taught by Professor Staff during the Fall '08 term at Sonoma.

Ask a homework question - tutors are online