Aspire Systems Placement Paper - Chennai, July 21, 2013
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;
3i Infotech - AAI - ABACUS - ABB - Accel Frontline - Accenture - Aditi - Adobe - ADP - Agreeya - Akamai - Alcatel Lucent - Allfon - Alumnus - Amazon - Amdocs - AMI - Andhra Bank - AppLabs - Apps Associates - Aricent - Ashok Leyland - Aspire - Atos Origin - Axes - Bajaj - Bank of Maharashtra - BEL - BEML - BHEL - BirlaSoft - Blue Dart - Blue Star - BOB - BPCL - BPL - Brakes - BSNL - C-DOT - Cadence - Calsoft - Canara Bank - Canarys - Capgemini - Caritor - Caterpillar - CDAC - CGI - Changepond - Ciena - Cisco - Citicorp - CMC - Consagous - Convergys - CORDYS - Crompton - CSC - CTS - Cummins - Dell - Deloitte - Delphi-TVS - DeShaw - Deutsche - Dotcom - DRDO - EDS - EIL - ELGI - ELICO - ERICSSON - Essar - Fidelity - Flextronics - Freescale - FXLabs - GAIL - GE - Genpact - Geodesic - Geometric - Globaledge - GlobalLogic - Godrej - Google - Grapecity - HAL - HCL - Hexaware - Honeywell - HP - HPCL - HSBC - Huawei - Hughes - IBM - IBS - ICICI - iGate - Impetus - iNautix - Indian Airforce - Indian Airlines - Infosys - Infotech - Intec - Integra - Intergraph - IOCL - iSOFT - ISRO - Ittiam - JSW - Keane - Kenexa - L & T - L & T Infotech - LG Soft - Lifetree - LionBridge - Mahindra Satyam - Mastek - Maveric - McAfee - MECON - Microsoft - MindTree - Miraclesoft - Mistral - Motorola - Mphasis - MTNL - NIC - Nokia Siemens - Novell - NTPC - Nucleus - ORACLE - Patni - Perot - Polaris - Ramco - Robert Bosch - Samsung - SAP - Sapient - Sasken - SBI - Sierra Atlantic - Sonata - Sony India - Sutherland - Syntel - TCS - Tech Mahindra - VeriFone - Virtusa - Wipro - Zensar.