(answers on page 607 - 627 of the pdf)
Write a program that reads characters from the keyboard until a dot is received. Have him count the number of spaces. Report the total at the end of the program.
Show the general form of the if-else-if ladder.
Given the code below, what if is the last else associated with?
Show the for statement of a loop that counts from 1000 to 0 in intervals of -2.
Is the following fragment valid?
Explain what break does. Be sure to explain its two forms.
In the following fragment, after the break statement is executed, what is displayed?
What does the fragment below display?
The iteration expression of a for loop does not always need to change the loop control variable according to a fixed value. Instead, the control variable can change in some arbitrary way. Using this concept, write a program that uses a for loop to generate and display the progression 1, 2, 4, 8, 16, 32,
and so on.
ASCII lowercase letters are separated from uppercase letters by an interval equal to 32. Therefore, to convert a lowercase letter into uppercase, we have to subtract 32 from it. Use this information to write a program that reads characters from the keyboard. It should convert all lowercase letters to uppercase and all uppercase letters to lowercase, displaying the result. Don't
changes to any other characters. The program will terminate when the user enters a point. In the end, it should display how many changes occurred in the letter box.
What is an infinite loop?
When using break with a label, must it be in a block that contains break?
The above is the detailed content of Chapter 3 Test. For more information, please follow other related articles on the PHP Chinese website!