This browser does not support JavaScript. In order to use this test, please update your browser to a JavaScript compatible browser, or choose the CGI version of this test. Internet Explorer browsers are updated by http://www.microsoft.com/ie/, and Netscape browsers updated by accessing http://www.netscape.com/
1. The statement which declares a character based array called letters of ten elements is,
2. Assign the character value 'Z' to the fourth element of the letters array
3. Use a for loop to total the contents of an integer array called numbers which has five elements. Store the result in an integer called total.
for( loop = 0, total = 0; loop >= 4; loop++ ) total = total + numbers[loop];
for( loop = 0, total = 0; loop < 5; loop++ ) total = total + numbers[loop];
for( loop = 0, total = 0; loop <= 5; loop++ ) total = total + numbers[loop];
4. Declare a multidimensioned array of floats called balances having three rows and five columns.
5. Write a for loop to total the contents of the multidimensioned float array balances, as declared in question 4.
for( row = 0, total = 0; row < 3; row++ ) for( column = 0, total = 0; column < 5; column++ ) total = total + balances[row][column];
for( row = 0, total = 0; row < 3; row++ ) for( column = 0; column < 5; column++ ) total = total + balances[row][column];
for( row = 0, total = 0; row < 3; row++ ) for( column = 0; column < row; column++ ) total = total + balances[row][column];
6. Assign the text string "Hello" to the character based array words at declaration time.
7. Assign the text string "Welcome" to the character based array stuff (not at declaration time)
8. Use a printf statement to print out the third element of an integer array called totals
9. Use a printf statement to print out the contents of the character array called words
10. Use a scanf statement to read a string of characters into the array words.
11. Write a for loop which will read five characters (use scanf) and deposit them into the character based array words, beginning at element 0.
for( loop = 0; loop < 5; loop++ ) scanf("%c", &words[loop] );
for( loop = 0; loop <= 5; loop++ ) scanf("%c", words );
for( loop = 0; loop < 5; loop++ ) scanf("%c", &words[0] );
©Copyright B Brown. 1984-1999. All rights reserved.