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 prints the integer values 1 to 10 on the screen, is
12345678910
count = 1; while( count <= 10 ) { printf("%d", count); count = count + 1; }
count = 1; while( count <= 10 ) { printf("%d", &count); count = count + 1; }
count = 1; while( count < 10 ) { printf("%d\n", count); count = count + 1; }
count = 1; while( count <= 10 ) { printf("%d\n", count); count = count + 1; }
2. The statement which reproduces the following output, is
1 22 333 4444 55555
a = 1; while( a <= 5 ) { while( b <= a ) { printf("%d\n", a); b = b + 1; } a = a + 1; }
a = 1; while( a <= 5 ) { b = 1; while( b <= a ) { printf("%d", a); b = b + 1; } printf("\n"); a = a + 1; }
a = 1; while( a <= 5 ) { while( b <= 5 ) { printf("%d", a); b = b + 1; } a = a + 1; printf("\n"); }
a = 1; while( a <= 5 ) { printf("\n"); b = 1; while( a <= b ) { printf("%d", a); b = b + 1; } a = a + 1; }
3. The statement that compares the value of an integer called sum against the value 65, and if it is less, prints the text string "Sorry, try again", is
if( sum < "65" ) printf("Sorry, try again" );
if( sum <= 65 ) printf("Sorry, try again" );
if( 65 == sum ) printf("Sorry, try again" );
if( sum < 65 ) printf("Sorry, try again" );
4. The statement that compares total for equality to good_guess, and if equal prints the value of total, and if not equal prints the value of good_guess, is
if( total < good_guess ) printf("%d", total ); else printf("%d", good_guess );
if( total == good_guess ) printf("%d", good_guess ); else printf("%d", total );
if( total = good_guess ) printf("%d", total ); else printf("%d", good_guess );
if( total == good_guess ) printf("%d", total ); else printf("%d", good_guess );
©Copyright B Brown. 1984-1999. All rights reserved.