Wu's Castle Post-Survey

*
1. Please enter your name.
*
2. Given the following code segment:
for ( int j = 0; j <= 3; j++ ) 
{ 
   cout << j << " ";
   for ( int k = 0; k <=1; k++ ) 
   { 
      cout << k << “ “;     // Line A
   } 
   cout << endl; 
} 
Please write the output of this code:
*
3. How many times will Line A be executed?
*
4. Given the following code segment:
int Num[10];
for ( int k = 0; k < kMax; k++ )  
{
   Num[k] = 1; 
} 
Which values of kMax will cause an out-of-bounds error?
*
5. Given this declaration:
int Num[7]={0,0,1,2,3,4,5};
What are the values of the expressions below?
*
6. Given the following code segment:
int x=7;
int Num[3][2];
for ( int j = 0; j <= 2 ; j++ ) 
{ 
   for ( int k = 0; k <= 1 ; k++ ) 
   { 
      Num[j][k] = x; 
      x++;
   } 
} 
Which of the following shows the values in the last row of Num?
*
7. Given the following code segment:
int Num[100];
for ( int k = 0; k < 100; k++ )  
{
   Num[k] = 1;    // Line A
   if ( k > 10 )
      break;
} 
How many times will Line A be executed?
*
8. Given the array below:
	9 8 7 6 5
	4 3 2 1 0
	1 2 3 4 5
	6 7 8 9 0
	5 5 5 5 5
What are the values for each of the expressions below?