kindly solve all question Assignment 3 is related to Chapter 7 and 8 Page 194-19
ID: 3908744 • Letter: K
Question
kindly solve all question
Assignment 3 is related to Chapter 7 and 8 Page 194-195 Problem 7.2, 7.4, 7.13 7.2 Give other kinds (beyond those illustrated in the previous question) of C/C++ statements that are syntactically valid but whose meaning can not bee reasonably defined in the semantics of a programming language. 7.4 Consider the expression x + y/2 in the language C. How many different meanings dose this expression have, depending on the types of x and y? 7.13 Using Web-based sources, examine the C++ and Ada exception handling models in more detail (a) How does the C++ model for exception handling diffe from the Java model discussed in this chapter? (b) How does the Ada model for exception handling differ from the Java model? Page 222 -223 Problem 8.5 8.5 Modify the definition of the operators && and || so that they do not use short circuit evaluation. Give the new semantic rule. Discuss the needed modifications to the implementation.Explanation / Answer
Question 7.2
Case 1:
x=0
z=15/x
In this a number cannot be divided by 0.
Case 2:
for(i=1;i>0;i++)
System.out.println("Value of i: "+i);
In this case it is an infinte loop whose value will start from 1 and it is having no end point
Question 7.4
The given expression is x+y/2
First of all if the value of y is positive then we will be able to get a answer.But in case the value of y is 0 then it will pop and error stating that the 0 cannot be divided by 2.Also suppose if y is float and the x is integer type then the resultant will be on the float that is it will be converted to the higher data type.
Question 7.13 a
i.In java only throwable object can be thrown as exception but whereas in C++ all can be thrown staring from the primitive type to pointer.
ii.C++ contains only the unchecked exception but java has both checked and unchecked exception
iii.C++ has catch all type of catch statement which can catch all the exception.This special catch statement is not there in Java.
Question 7.13 b
i.In case of Ada exceptiom caonstant name should declared explicitylt but Java doesn't have such restrictions.
ii.In case of Ada every block can be structered handlers but in case of Java all block cannot be the exception handlers.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.