"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > Chapter 3 Test

Chapter 3 Test

Published on 2024-07-30
Browse:428

(answers on page 607 - 627 of the pdf)

  1. 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.

  2. Show the general form of the if-else-if ladder.

  3. Given the code below, what if is the last else associated with?
    Image description

  4. Show the for statement of a loop that counts from 1000 to 0 in intervals of -2.

  5. Is the following fragment valid?
    Image description

  6. Explain what break does. Be sure to explain both forms.

  7. In the following fragment, after the break statement is executed, what is displayed?

Image description

  1. What does the fragment below display?
    Image description

  2. 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.

  3. 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. Do not do
    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 case.

  4. What is an infinite loop?

  5. When using break with a label, it must be in a block that contains break?

Release Statement This article is reproduced at: https://dev.to/devsjavagirls/teste-do-capitulo-3-59e0?1 If there is any infringement, please contact [email protected] to delete it
Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3