Urgenthomework logo
UrgentHomeWork
Live chat

Loading..

ICS 211 Introduction to Computer Science II | Free Sample

  95 Download     📄   3 Pages / 610 Words

Questions:

1.Describe a plausible scenario in which a programmer might wish to avoid short-circuit evaluation of a Boolean expression.

2.Consider the following expression in C: a/b > 0 && b/a > 0. Whatwill be the result of evaluating this expression when a is zero? What will be the result when b is zero? Would it make sense to try to design a language in which this expression is guaranteed to evaluate to false when either a or b (but not both) is zero? Explain your answer.

3.Rubin [Rub87] used the following example (rewritten here in C) to argue in favor of a goto statement: int first_zero_row = -1; /* none */ int i, j; for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { if (A[i][j]) goto next; } first_zero_row = i; break; next: ; }

3.The intent of the code is to find the first all-zero row, if any, of an n × n matrix. Do you find the example convincing? Is there a good structured alternative in C? In any language?

Answers:

1.There are two plausible scenarios that a programmer can opt to circumvent short-circuit appraisal of Boolean expression

Every logic that is likely to be implemented as part of the conditions that is bypassed is not to be executed that is to have either condition one or condition two where condition is appraised to be TRUE. Hence appraisal is short-circuited and condition two will not be appraised. Thus in this case, condition two was a technique that is supposed to finalize a stage in processing. If not appraising condition two then a programmer is not invoking the said technique and missing a portion of execution.  In the case of java it has two Boolean operators |(OR) and &(AND). Both of these Boolean expression are not short-circuited. Utilizing operators such as these java programmers can circumvent this disadvantage.   

In some compliers new checks intended for short-circuits require extra execution cycles themselves hence the code of implementation tends to be less efficient with short-circuit execution paths. In addition a branch of projection intends to become inefficient in some contemporary processors when short-circuiting is utilized.  

2.The result of appraising of this expression when a = 0

When a = 0 then

It will be false because 0/b = 0, 0 > 0 and the immediate short circuit will take place (0 && anything) = 0.

The result of the evaluation when b = 0

In the case when b = 0 the complier provides a floating point exclusion since a/b will be dividing by 0.

What sense will it make when trying to outline a language in that the expression is guaranteed to assess to false when either a or b is zero but not both.

It will not make sense. When one want to circumvent dividing by zero error, one will have to switch from appraisal and short circuiting from left-to-right.  

3.I find the example convincing since common utilization of togo statements has been apprehended by new-fangled control systems.  
Does the code has a good structure

Yes, the code has a good structucture as it has the to Do loop, togo loop and the exit loop early.
Is they any alternative in any language

Yes there is an alternative that is a java programming since it has in-built data type for manipulating integers, strings, Boolean and real numbers.  

References

Bracha, G., & Ungar, D. (2015). OOPSLA 2004: mirrors: design principles for meta-level facilities of object-oriented programming languages. ACM SIGPLAN Notices, 50(8), 35-48.

Watanabe, T., & Yonezawa, A. (2014). Reflection in an object-oriented concurrent language. In Concurrent Objects and Beyond (pp. 44-65). Springer, Berlin, Heidelberg.


Buy ICS 211 Introduction to Computer Science II | Free Sample Answers Online

Talk to our expert to get the help with ICS 211 Introduction to Computer Science II | Free Sample Answers to complete your assessment on time and boost your grades now

The main aim/motive of the management assignment help services is to get connect with a greater number of students, and effectively help, and support them in getting completing their assignments the students also get find this a wonderful opportunity where they could effectively learn more about their topics, as the experts also have the best team members with them in which all the members effectively support each other to get complete their diploma assignments. They complete the assessments of the students in an appropriate manner and deliver them back to the students before the due date of the assignment so that the students could timely submit this, and can score higher marks. The experts of the assignment help services at urgenthomework.com are so much skilled, capable, talented, and experienced in their field of programming homework help writing assignments, so, for this, they can effectively write the best economics assignment help services.

Get Online Support for ICS 211 Introduction to Computer Science II | Free Sample Assignment Help Online

Resources

    • 24 x 7 Availability.
    • Trained and Certified Experts.
    • Deadline Guaranteed.
    • Plagiarism Free.
    • Privacy Guaranteed.
    • Free download.
    • Online help for all project.
    • Homework Help Services

Copyright © 2009-2023 UrgentHomework.com, All right reserved.