must be in c++0 Which of the following is a repetition statement? a. if b. do ..
ID: 3866891 • Letter: M
Question
must be in c++0
Explanation / Answer
1.
ans) b. do..while
why because remaining three(if,switch,if..else) statements are conditional statements. do..while is looping statement.
2.
ans) b. x=+4
it means that x=x+4. and remaining are invalid statements.
3.
ans) c. both a and b are true
unsigned int counter=10;
unsigned int counter={10};
both these statements are acceptable in c++.
4.
ans) d. change total=total-20 to total=total+20.
why because, generally syntactically the code was correct. but if the total was initialized with less number than 1000 .it will execute infinite times. else if the total is assigned with more than 1000 then while loop will not be executed.
so if we change the total=total-20 to total=total+20. it will be executed in the number of times then exited the loop.
and option a and b are totally wrong.
5.
ans) b. can only be used in true and false values.
why because based on the definition of bool type.
6.
ans) b. infinte number of times
why because there is no increment(i++ or i=i+x) statement inside loop.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.