Professional Documents
Culture Documents
CSC422 Group 57-95 Answers
CSC422 Group 57-95 Answers
1 :: Left to Right
JAVA
Precedence Rule
PRECEDENCE OPERATOR ASSOCIATIVITY
1 ++ - - Left to Right
3 +- Left to Right
5 == != Left to Right
PYTHON
Precedence Rule
PRECEDENCE OPERATOR ASSOCIATIVITY
1 () Left to Right
2 ** Left to Right
4 +, - Left to Right
3. Find out languages that support short circuiting and find out reasons why the language
may be liked or disliked
Languages that support short circuiting include:
i. C++
ii. C#
iii. Python
Reasons:
i. C++: In C++ short-circuiting occurs while evaluating ‘&&’ (AND) and ‘||'(OR) logical
operators. While evaluating ‘&&’ operator if the left-hand side of ‘&&’ gives false, then
the expression will always yield false irrespective of the value of the right-hand side of
‘&&’, so checking right-hand side of ‘&&’ makes no sense.
ii. C#: It makes our true/false conditions more efficient since not every expression has to be
evaluated. And short-circuiting can even prevent errors because it skips part of the code.
iii. Python: It stops the execution when the truth value of the expression is determined.
Always the expression of evaluation is from left to right.
4. Java Switch and C# switch which do you prefer using design control?
Java switch case is preferable because it is used in Multiple conditions which has different
statements like if-else. Java switch can check only equality of the conditional floating point but
value cant be checked by the switch.
Its syntax
Switch(variable)
{
Case 1:
Statement;
Case 2:
Statement;
Default :
Statement:
}
5. Find out how python,java,C# or C++ handle inheritance.
Programmming Languages Support for Inheritance
Python The child classes in Python also inherits
methods and attributes from the parent class.
Java Inheritance in Java is implemented using
Extend keywords. It is the method to create a
hierarchy between classes by inheriting from
other classes.
C# In C# inheritance allows the user tp create a
new class from an existing class.
The derived class inherits the fie;d and
methods of the base class.
C++ It’s a process in which new classes are created
from existing classes. The new class created
is called “Derived Class” or “Child Class”
and the existing class is known as the “Base
Class or Parent class”, The derived class is
now said to be inherited from the base class.