Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PART II-MULTIPLE CHOICE Record your answers on the separate answer sheet. Select

ID: 3917977 • Letter: P

Question

PART II-MULTIPLE CHOICE Record your answers on the separate answer sheet. Select the choice that best completes each statement or answers the question Each question is worth 1 point. 18. For the string gr "graduation", what is the result of gr,substring(2,5)tgr,length0+gr.Indexoff"u")? A. aduat 104 B. adualS C. aduat 14 D. adua 104 E. adua14 19. An example of a repetition structure is an) A. if B. doobee/doobee/do loop C. assignment D. while loop E. method 20. An example of a selection structure is a(n) A. if B. algorithm C. do/while loop D. for loop E. comparison 21. An invalid data type for Java is A. char B. float C. decimal D. int E. double 22. What is wrong with the following do/while loop? int sum # 0; int counter 1; do sum t counter; system. out.println (sum); while (counter

Explanation / Answer

19) Repetition statement is a block of code to be executed for a fixed number of times or until a certain condition is met. Out of the given options we can use WHILE and DO LOOP to perform repetition. These loop will work till the condition is true and loop will break when it get false.

20) Selection structure is a programming feature that perform on the basis of Boolean condition, i.e. whether Boolean condition is true or false. Out of the given option we can use IF and COMPARISION statement to perform selection structure.

21) Decimal is the incorrect data type whereas the rest i.e. int, float, char, double are the correct one. Int and float takes bits, double takes bits and char takes 16 bits.

22) It is an infinite loop, since the counter never increases it remains less than 100 and thus the loop will never terminates

*I couldn’t solve the first one but I have answered the rest 4 questions.

*If you have any problem with the answer or want me to edit the answer just let me know in the comments and I will try to get on it as soon as possible. Do give a plus if this answer helps.

19) Repetition statement is a block of code to be executed for a fixed number of times or until a certain condition is met. Out of the given options we can use WHILE and DO LOOP to perform repetition. These loop will work till the condition is true and loop will break when it get false.

20) Selection structure is a programming feature that perform on the basis of Boolean condition, i.e. whether Boolean condition is true or false. Out of the given option we can use IF and COMPARISION statement to perform selection structure.

21) Decimal is the incorrect data type whereas the rest i.e. int, float, char, double are the correct one. Int and float takes bits, double takes bits and char takes 16 bits.

22) It is an infinite loop, since the counter never increases it remains less than 100 and thus the loop will never terminates

*I couldn’t solve the first one but I have answered the rest 4 questions.

*If you have any problem with the answer or want me to edit the answer just let me know in the comments and I will try to get on it as soon as possible. Do give a plus if this answer helps.