C++ Questions Answers-C++ loops(PartI)

C++ loops(PartI)

1. The purpose of using a loop is to
a.repeat operation(s) many times b. make decision Check answer 2. Which of the C++ loops is not a pretest loop?
a. for loop   b. while loop   c. do while loop Check answer 3. The break command is used to exit a loop.
a.True b. False Check answer 4. Which of the followings is not a nested loop?
a. for(i=0;i<10;i++)
b. for(i=0;i<10;i++)
    for(j=1;j<i+2;j++) cout<<"j="<<j;
c. for(i=0;i<10;i++)
        while(j%2!=0){ cout<<j<<"\t";j++;}
Check answer 5. Which of the following statements about the while loop is not true?
a.The while loop is a posttest loop.
b.Testing condition is made before each iteration.
c.The while loop statement must terminate with a semi-colon.
Check answer


samuel comment


An international mobile phone company has three different rate plans for its customers:

Rate Plan Description
A For $19.95 per month 200 minutes of call time are provided. Additional usage costs $0.08 per minute.
B For $34.95 per month 500 minutes of call time are provided. Additional usage costs $0.06 per minute.
C For $59.95 per month unlimited call time is provided.

Write a program that calculates a customer’s monthly bill. It should input customer name, mailing address, telephone number, the month, which package the customer has purchased, and how many minutes were used during the month. It should then create a bill that includes the input information and the total amount due. As an incentive from the mobile phone company to its customers, the program should also display how much money Package A customers would save if they purchased packages B or C, and how much money package B customers would save if they purchased package C. If there would be no savings, no message should be printed.
Input Validation: Be sure the user only selects package A, B, or C.

ocrup comment


your exercises are very helpful in understanding
thx a lot!


This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.