Question

   QUESTION 6 1.   If we wanted something like the python else statement for a counter...

  
QUESTION 6
1.   If we wanted something like the python else statement for a counter controlled loop in Java, what would it look like?
       Since there is no way for a loop in Java to tell you if it completed without breaks or continues, you'd need to set a boolean flag to indicate that and check it after the loop was completed.
       We simply check either break or continue flags to see if either is set
       We simply check break variable to see if used.
       we check the for flag to see if loop terminated correctly  
QUESTION 7
1.   Suppose a new programming language that we are learning does not support short circuit evaluation for boolean expressions. What can a programmer to do to work around it?
Consider the expression:
while ((index < array.length) && (array[index] != target))
       We would use recursion.
       We would simply nest them.
       We could convert the loop into a series of if statements.
       We could write two loops.
  
QUESTION 8
1.   Which operator is not technically necessary but provided to the programmer to allow them to control precedence and associativity of the expressions they write?
       square braces []
       braces {}
       subtraction -
       parenthesis ()

QUESTION 9
1.   Which of the following is NOT a multiple selection statement?
       guarded command
       case
       if-elif-else
       if-else
  
QUESTION 10
1.   Operator overloading is
       extremely common in PL since + works differently for ints and floats but it is uncommon for programming languages to allow the developer to overload operators
       very uncommon in programming languages
       very uncommon in programming languages but some languages allow the programmer to overload all operators
       extremely common in PL since + works differently for ints and floats and it is also common for programming languages to allow the developer to overload operators

Homework Answers

Answer #1

Answer 1:
Since there is no way for a loop in Java to tell you if it completed without breaks or continues, you'd need to set a boolean flag to indicate that and check it after the loop was completed.

Answer 2: We would simply nest them.

Answer 3: parenthesis ()
Answer 4: guarded command
Answer 5: very uncommon in programming languages but some languages allow the programmer to overload all operators


NOTE : PLEASE COMMENT BELOW IF YOU HAVE CONCERNS.
I AM HERE TO HELP YOUIF YOU LIKE MY ANSWER PLEASE RATE AND HELP ME IT IS VERY IMP FOR ME

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT