COMPILER DESIGN

ADVANCED TOPICS IN COMPILER DESIGN

CODE GENERATION FOR OBJECT ORIENTED LANGUAGES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Consider a program written in an object-oriented programming language. Which of the following statements are true if class B is a child class of parent class A?Select all that apply.
A
Public methods in A are accessible in B and can be overloaded by other methods in B
B
Public methods in A are accessible in B and can be overridden by other methods in B.
C
Public methods in B are accessible in A and can be overloaded by other methods in A.
D
Public methods in B are accessible in A and can be overridden by other methods in A.
Explanation: 

Detailed explanation-1: -The correct answers are: Abstract classes are general and may contain methods without any particular implementation. OOP improves debugging and testing as the object definition is contained in one place. OOP promotes code reuse.

Detailed explanation-2: -The correct answer is E. All of the statements are true in object-oriented programming. Classes provide the blueprint of objects to be created while interfaces provide contracts for the classes implementing them. Class attributes represent the state of the object created at any particular time.

Detailed explanation-3: -Significant object-oriented languages include: Ada, ActionScript, C++, Common Lisp, C#, Dart, Eiffel, Fortran 2003, Haxe, Java, JavaScript, Kotlin, logo, MATLAB, Objective-C, Object Pascal, Perl, PHP, Python, R, Raku, Ruby, Scala, SIMSCRIPT, Simula, Smalltalk, Swift, Vala and Visual Basic.NET.

Detailed explanation-4: -9) Which of the following statements is correct regarding the object-oriented programming concept in Python? 10) Which of the following statements is correct in this python code? Explanation: “name1” and “name2” refer to the same object, so id(name1) and id(name2) will have the same value.

There is 1 question to complete.