Need help with 4 questions! Will give medal and be a fan :)
2. Which statement requires an index value? a. if then b. if then else c. switch d. for
3. which statement first prints the result and then it checks for condition? a. do-while** guessing its this b. for c. while d. switch
which statement is used to give the program multiple options? a. for b. do c. switch d. if-then-else
@amistre64
whats your idea on the last one?
I thought it was for because it runs code for each item but i think its do too
do loops while the condition is true
if-then-else can be used in place of a switch command, but the switch command is pretty much the norm for multiple option choices i believe
okay so its switch. am i correct for number 3?
i like #3, i cant verify if its correct tho
and what does an index value do for us?
pair of numbers in the table
waittt i got it
:) i was thinking an index value was used to loop thru a for statement
The other name for an index value is an iterator. To iterate is to "perform or utter repeatedly." So something that deals with repetition.
``` do { Some command } while(test condition) ``` That is the basics of a do-while loop in any language.
for #2 the answer is for loop ie. for(int i = 0; i < n; i++) int i = 0; for #3 you are correct with the do while ie do (something) while(i < 1)this loop will iterate even though i is 0 .the test is while i < 1 for multiple choices the correct answer is the switch statement ie.. swith int case'1' case'2' case'3' default exit statement
do { while(i >1) the loop will iterate if i is 0 i miss typed it
Join our real-time social learning platform and learn together with your friends!