Aspire interview questions for Aspire hiring freshers engineers recruitment procedure Aspire interview questions previously asked
Aspire Interview Questions
Aspire Technical Round:
1. What is abstract class?
Abstract cls contains abstract methods and abstract data members, abstract methods are methods with out definition. Abstract class can also contain non abstract methods ie., method with definition. We cannot create object for abstract cls. Abstract cls are inherited by derived classes and they should implement all the abstract methods of the inherited abstract class.
2. Why we cant create object for abstract class?
To create an object of any class its mandatory to know that how much memory required to load the class so in case of abstract class its can’t be calculated for abstract members thats why we can’t create object of Abstract class
An Abstract class is a partial implementation of a class. In other words, at least some of the operations or methods are implemented, but the full implementation is left up to an inherited class.
Without a full implementation, how could we instantiate the class? What if the client was to call one of the abstract (not defined) operations? Obviously, this would result in a failure.
3. What is Encapsulation?
Encapsulation is the process of grouping up of datamembers and member functions.
4. Give an Example for Encapsulation?
Class encapsulates data member and member function. These function and data members are inaccessible to outside environment.
5. Why java does not support multiple inheritances?
1) First reason is ambiguity around Diamond problem, consider a class A has foo() method and then B and C derived from A and has there own foo() implementation and now class D derive from B and C using multiple inheritance and if we refer just foo() compiler will not be able to decide which foo() it should invoke. This is also called Diamond problem because structure on this inheritance scenario is similar to 4 edge diamond, see below
foo() B C foo()
2) Multiple inheritances does complicate the design and creates problem during casting, constructor chaining etc
6. When finally block will not be executed?
When try or catch block calls System.exit(), then finally block will not be executed.
If the jvm exits while the try or catch code is being executed, then the finally block may not execute. Likewise, if the thread executing the try or catch code is interrupted or killed, the finally block may not execute even though the application as a whole continues.
7. Programs: (Reverse the string without using inbuilt function)
cout<<“Enter the string”;
8. Program: (print triangle in following format)
3 6 9
4 8 12 16
5 10 15 20 25
cout<<“Enter the limit ie the number of rows”;
cin>>n; //here n=5;