interview question collection for amdocs

26
What is the namespace? A namespace allows you to resolve conflict of the global identifiers when you use Describe what a SubClassing? Subclassing allows us to reuse code, which saves us time. It’s also a Technique used to intercept Windows messages What is “inline” function ? inline keyword before name of the function allows the compiler to insert a copy of the function body into each place the function is called. Therefore, the size of the code is increasing, but speed of execution is also increasing. No matter how you designate a function as inline, it is a request that the compiler is allowed to ignore. You have to play with it to see what is best so don’t ignore. Also unlike macros, argument types are checked, and necessary conversions are performed correctly inline functions can prevent thrashing: When f() calls g(), the code might be on two distinct pages of memory, but when the compiler procedurally integrates the code of g() into f(), they are often on the same page, so the working set size (number of pages that need to be in memory at once) may go down even if the executable size goes up. When should I use references, and when should I use pointers? Use references when you can, and pointers when you have to. References are usually preferred over pointers whenever you don't need "reseating"(i.e, Unlike a pointer, once a reference is bound to an object, it can not be "reseated" to another object). This usually means that references are most useful in a class's public interface . Is there another way to tell the compiler to make a member function inline other than using inline keyword? Yep: define the member function in the class body itself: What is a reference? A reference is a quantity that holds the address of an object but behaves syntactically like that object. A reference cannot exist without object and must be initialized. The reference is the referent, so changing the reference changes the state of the referent. A Reference is an "lvalue" (something that can appear on the left hand side of an assignment operator). What happens if you return a reference? The function call can appear on the left hand side of an assignment operator. What's the difference between public:, private:, and protected:? * A member (either data member or member function) declared in a private:section of a class can only be accessed by member functions and friends of that class. Means that base class is sealed-off from subsequent derivations * A member (either data member or member function) declared in a protected:section of a class can only be accessed by member functions and friends of that class, and by member functions and friends of derived classes * A member (either data member or member function) declared in a public: section of a class can be accessed by anyone. Why Do we need Virtual Base Class? InOrder to save space and Avoid Ambiguities in case of multiple inheritence i.e, virtual base class if inherited more than once via different path then only one copy of data member presents which is shared by all the derived classes that use it as a virtual base. Why Virtual Function? Is to have derived classes inherit a function interface as well as a default implementation. But its not mandatory to redefine in its derived class. A virtual function allows derived classes to replace the implementation provided by the base class Why should be base class destructor be virtual? If you destroy an object through a pointer or reference to a base class and the base class destructor is not virtual then the derived class destructor are not executed and the destruction might not be complete. If not it leads to memory leaks.

Upload: abhishek-singh

Post on 26-Oct-2014

101 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Interview Question Collection for Amdocs

What is the namespace? A namespace allows you to resolve conflict of the global identifiers when you use Describe what a SubClassing? Subclassing allows us to reuse code, which saves us time. It’s also a Technique used to intercept Windows messages What is “inline” function ? inline keyword before name of the function allows the compiler to insert a copy of the function body into each place the function is called. Therefore, the size of the code is increasing, but speed of execution is also increasing. No matter how you designate a function as inline, it is a request that the compiler is allowed to ignore. You have to play with it to see what is best so don’t ignore. Also unlike macros, argument types are checked, and necessary conversions are performed correctly inline functions can prevent thrashing: When f() calls g(), the code might be on two distinct pages of memory, but when the compiler procedurally integrates the code of g() into f(), they are often on the same page, so the working set size (number of pages that need to be in memory at once) may go down even if the executable size goes up. When should I use references, and when should I use pointers? Use references when you can, and pointers when you have to. References are usually preferred over pointers whenever you don't need "reseating"(i.e, Unlike a pointer, once a reference is bound to an object, it can not be "reseated" to another object). This usually means that references are most useful in a class's public interface . Is there another way to tell the compiler to make a member function inline other than using inline keyword? Yep: define the member function in the class body itself: What is a reference? A reference is a quantity that holds the address of an object but behaves syntactically like that object. A reference cannot exist without object and must be initialized. The reference is the referent, so changing the reference changes the state of the referent. A Reference is an "lvalue" (something that can appear on the left hand side of an assignment operator). What happens if you return a reference? The function call can appear on the left hand side of an assignment operator. What's the difference between public:, private:, and protected:? * A member (either data member or member function) declared in a private:section of a class can only be accessed by member functions and friends of that class. Means that base class is sealed-off from subsequent derivations * A member (either data member or member function) declared in a protected:section of a class can only be accessed by member functions and friends of that class, and by member functions and friends of derived classes * A member (either data member or member function) declared in a public: section of a class can be accessed by anyone. Why Do we need Virtual Base Class? InOrder to save space and Avoid Ambiguities in case of multiple inheritence i.e, virtual base class if inherited more than once via different path then only one copy of data member presents which is shared by all the derived classes that use it as a virtual base. Why Virtual Function? Is to have derived classes inherit a function interface as well as a default implementation. But its not mandatory to redefine in its derived class. A virtual function allows derived classes to replace the implementation provided by the base class Why should be base class destructor be virtual? If you destroy an object through a pointer or reference to a base class and the base class destructor is not virtual then the derived class destructor are not executed and the destruction might not be complete. If not it leads to memory leaks.

Page 2: Interview Question Collection for Amdocs

Usage of Static Variable? Only one copy is created and shared by all the objects of the class. Defined outside the class, initialized to Zero .Life time will be the entire program. static variables exist without creating an object Static Function: Can access or refer to only static data members of a class, Accessable through a class name instead of an object. If your function is static, it cannot access non static functions Difference between Static and Global Variable? Static Variable: is accessible only to all functions defined in the same file Global Variable: is accessible by all functions defined even from different files. Can we pass class variables to static functions? Yes. A class variable is nothing but a static variable. So from static function, static variables can be very well accessed Explain on Const? Any function of a class which does not modify the data member of class within it should add a const at the end of a function ( it even cannot call any member function that are not constant). It makes the function read-only Note: Keyword Mutable can change the value of data inside a const member function To define a const statement: Const int MAX=100; const distance d3(10,6); //the values 10 and 6 cannot be changed Note: the const members must be initialized in the constructors’ member initializer lists Why we should implement copy constructor? To perform Deep Copy. It allows you to make copies of all fields and makes copies of dynamically allocated memory pointed to by the fields. (Ex. userdefined copy constructor and overloaded Assignment operator) Note: copy constructor will always take a reference to an object of its own class as its argument.If not it will result in calling the copy constructor recursively. And you cannot return a value from it. It is called during a) initialization of one object with another object of same class b) passing an object by value c) returing an object by value. Why Friend Function? If we want to give a non-member function unlimited access to the members of a class we would declare such a function as a friend of that class. (ie friend functions are able to access private and protected data members) Friend property is not Inherited, not transitive and acts only in one direction Note: here you have to pass object as parameter in order to access the class data members. What is an object? A region of storage with associated semantics. What's the difference between the keywords struct and class? The members and base classes of a struct are public by default, while in class, they default to private. struct and class are otherwise functionally equivalent. Define Encapsualtion? Encapsulation puts a firewall around the chunk, which prevents other chunks from accessing it. Designing a clean interface and separating that interface from its implementation merely allows users to use the interface. But encapsulating (putting "in a capsule") the implementation forces users to use the interface. Encapsulation doesn’t provide security, Encapsulation prevents mistakes, not espionage Can one constructor of a class call another constructor of the same class to initialize the this object? No. Is the default constructor for Fred always Fred::Fred()?

Page 3: Interview Question Collection for Amdocs

No. A "default constructor" is a constructor that can be called with no arguments. One example of this is a constructor that takes no parameters: class Fred { public: Fred(); // Default constructor: can be called with no args // ... }; Another example of a "default constructor" is one that can take arguments, provided they are given default values: class Fred { public: Fred(int i=3, int j=5); // Default constructor: can be called with no args // ... }; Should you use the this pointer in the constructor? Some people feel you should not use the this pointer in a constructor because the object is not fully formed yet. However you can use this in the constructor, but be carefull . Here is something that always works: the {body} of a constructor (or a function called from the constructor) can reliably access the data members declared in a base class and/or the data members declared in the constructor's own class. This is because all those data members are guaranteed to have been fully constructed by the time the constructor's {body} starts executing Here is something that never works: the {body} of a constructor (or a function called from the constructor) cannot get down to a derived class by calling a virtual member function that is overridden in the derived class. If your goal was to get to the overridden function in the derived class, you won't get what you want Can you initialize static member data in the constructor's initialization list? No. Because you must always explicitly define your class's static data members. What's the order that local objects are destructed? First constructed, last destructed . Here b's destructor will be executed first, then a's destructor: void userCode() { Fred a; Fred b; // ... } What's the order that objects in an array are destructed? First constructed, last destructed. Here in the example the order for destructors will be a[9], a[8], ..., a[1], a[0]: void userCode() { Fred a[10]; // ... } Should I explicitly call a destructor on a local variable? NO. The destructor will get called again at the close } of the block in which the local was created What is static binding and dynamic binding? SB:refers to an entity existing in different physical form simultaneously. Binding takes place at compile time based on the type of object.

Page 4: Interview Question Collection for Amdocs

DB:refers to an entity existing changing its form depending on the circumstances. Binding takes place at runtime based on the context of the object. What you cannot inherit ? 1)Construtor & Destructor 2) New & = Operators 3)Friend Relationship 4) Private Data member/ member function Can you instantiate an Abstract Class? No. Because they represent no real objects the only represent Design-objects. These classes are used to store common properties of their subclasses. They will contain pure virtual function. Technically this class is an incomplete class and hence its object cannot be created. Therefore we are forcing derived functions to override that functions. Why we should not return reference or pointer to a local variable? Because with local variable it goes out of scope (since its allocated in the stack) With Pointers, I leads giving raise to a memory leak (since its allocated in the heap). Can you instantiate Cobject? It cannot be instantiated directly since the constructor is the protected member of class.It can only be inherited. It provides support to serialization but does not support RTTI. Why is it important to use reference during "catch" statement? Exception is always thrown by value .If not reference these will invoke copy constructor and copies the exception object unnessarily. Therefore to save space use a references. What are the advantage and disadvantage of using exception handling? Disadvantage: implementing exception-handling mechanism imposes slight overhead. Advantage provides "bullet-proof" program. How procompiled header work in windows? After the header files included in the StdAfx.cpp and StdAfx.h are processesed, the preprocessor saves a snapshot of its internal state as an .PCH file. Since processing all those state headers repeatedly take longs time for compilation, compiler everytime just reloads the prepocessor state from the .PCH file while the compiler complies other .cpp files. What is a Constructor? -> It’s a non-static member function -> These are the functions which have the same name as that of a class. -> These functions are called by itself while creating an object -> used to initialize the data members of a class. -> It has no return type -> It can be overloaded -> a constructor function is not provided in a class, then C++ compiler provides a default constructor What is a Destrutor? -> This function has the same name as that of a class but starts with ~ -> It is called by itself when object goes out of scope -> A destructor destroys an object -> used for memory cleanups, file closing and etc... -> It has no return type -> It cannot be overloaded -> It does not accept any arguments Example on Throw: Int Foo() throw() -> means no exception is thrown from this function Int Foo() throw(x,y) -> means this function will only throw exceptions x & y and exception derived from them. No other exceptions are handled. Int Foo() -> means that this function can throw any exception. Can I free() pointers allocated with new? ()? ------------No! Can I delete pointers allocated with malloc()? ------------No! What is a DownCast? --------------Moves a pointer down a class hierarchy, from a given class to a class derived from it.

Page 5: Interview Question Collection for Amdocs

What is SizeOf() return?----------Returns the number of bytes occupied by the datatype. What does mean int **p? --------Its an - Pointer to pointer to int OR Pointer to array of int Why to use Void Pointer? ----------Used to cast into and back again without any loss of information. Where is Vtable Initialized? ------In Constructor What is a member Function? —Its an ordinary Function- has its own name, a return type and invoked using dot operator. What is a Polymorphic Class? ----Polymorphic class in any class containing a virtual function is a polymorphic What is a conditional Compilation? ---------are the Directives to control what does and does not get compiled. Use of Scope Resolution Operator? ---------used to access the base-class version from the derived What is a “This” pointer? ---------special pointer available within a class alone. It’s used to refer the current object from within the class. How to delete Arrays? CMyObject *pobj = new CObject[128]; delete [] pobj; // must Difference Between Copy Constructor and Assignment operator? Copy Constructor creates a new object whereas Assignment operator assigns the values to an existing object of same class. Difference between Abstract and Interface ? Interface contains no Implementation whereas Abstract may /may-not contains implementation. How will you handle a constructor that fails? Throw an exception. Constructors don't have a return type, so it's not possible to use error codes. The best way to signal constructor failure is therefore to throw an exception. Why should I use new instead of trustworthy old malloc()? Constructors/destructors, type safety, overridability. Constructors/destructors: unlike malloc (sizeof (Fred)), new Fred () calls Fred's constructor. Similarly, delete p calls *p's destructor. Type safety: malloc () returns a void* which isn't type safe. new Fred () returns a pointer of the right type (a Fred*). Overridability: new is an operator that can be overridden by a class, while malloc () is not overridable on a per-class basis. What's the difference between "const Fred* p","Fred* const p" and "const Fred* const p"? You have to read pointer declarations right-to-left. * const Fred* p means "p points to a Fred that is const" -- that is, the Fred object can't be changed * Fred* const p means "p is a const pointer to a Fred" -- that is, you can change Fred object but you can't change pointer p itself. What are templates? Templates are basically used to create generic classes and functions, which operates on diff data types without having to overload the function or create new classes with all the possible datatypes that it is suppose to support. Disadvantage of using Templates? a) Compile/link time increases b) pointer manipulation problems(not freeing memory) c) Efficinecy problem How many ways are there to initialize an int with a constant? int foo = 123; int bar (123);

OOPS

Define ROSE ?

Page 6: Interview Question Collection for Amdocs

Rational Object Oriented Software Engineering, provides the software developer with a complete set of visual modeling tools for development of robust, efficient solutions to real business needs Why OOPS getting popular? OOPs is used to create larger programs with easier and with better quality. Used to Group related data and functions together Explain OO concepts. Polymorphism: ability of a function or operator to act in different ways on different data types is called polymorphism. Inheritance: Process by which objects of one class acquire properties of objects of another class. Encapsulation: wrapping up of data and functions into a single unit is known as encapsulation Abstraction: means the act of representing the essential features of something without knowing its internal details fully. What are Design Patterns? (RISS) So the goal of design pattern is to isolate changes in your code Patterns is used keep changes from being propagated throughout your code when you modify your code. Design patterns represents solutions to problems that arise when developing software within a particular context. Patterns facilitate reuse of successful software architectures and designs Patterns capture the static and dynamic structure and collaboration among key (Actors) participants in software designs. Pattern types:

Creational Patterns -> concerns with object creation ( abstract factory, singleton) Structrual patterns -> concerned with how objects are composed off(adaptor, Bridge, Composite, Decorator, Façade, Flyweight) Behaviour Pattern -> concerned with Algorithms and responsibility between objects

(Iterator, Mediator, Observer) What is MVC? Model (holds Business logic –Beans ) View(holds GUI logic –jsp) Controller (hold basic logic to process user events – servlets) Explain Each: Scalable : A system is said to be scalable- if as the load increases the system should still responds within the acceptable time. Performance: Usually measured in terms of response time for a given Screen per User Maintainablitly: Ability to correct flaws in the existing functionality without impacting other components of the system Explain OMT?(Object Modeling Techniques) OMT Involves analysis and design of a system based on 3 diff Model 1) object 2) dynamic and 3) Functional Object Model: Specify what objects a system contains. It shows the Static Structure and Relationship between them Dynamic Model : Specify when the object changes. It represents the State diagram that interact via events Functional Model: Specify how objects change. Says the result without providing the Internal details using DFD(Dataflow Diagram) Diff Between Association and Link? Association describes the relationship between classes. Link describes the relationship between objects. Explain SOFTWARE LIFE CYCLE? Conceptualization Phase : Define Problem Statement . Generate Requirement Documentation. Identify Usecases holding

happy path

Page 7: Interview Question Collection for Amdocs

Analysis Phase : Analysis on Requirements is done. Generates Specification Document. Generates TestCases. Define usescase holding happy and sorrow path. Map requirement to usecase paths and classes

Design Phase : Generates Design Document. Defines Data Structure, Algorithm, and Program Structure. Error Handling Mechanism, Identify Component Packages Implementation Phase : Coding & Testing Maintenance Phase : Collect Change/ Enhancement request, which is prioritized and grouped for implementing Types : WATER FALL, V, PHASED, EVOLUTIONARY, SPIRAL

WATERFALL -> Problem Defn –Analysis – Design – Coding –Testing –Maintenance Here each phase is considered as discrete phase. Here s/w is developed in sequential phases. There is no overlap and the process is very straight forward. Its very difficult to accommodate changes after the process is underway

SPIRAL -> uses prototyping model to ensure the requirements are captured correctly. Each iteration undergoes risk analysis sector and testing sector. Define Lifecycle - describes the steps followed by the project team to produce a tangible software product Define Process - is a documented way that contribute one/more steps in producing a product Define Process Models – ISO 9001 (applicable to all industries)

- CMM ( applicable to software industry alone) Define CMM ? CMM stands for Capability Maturity Model. Software Engg Institute developed CMM for software industry. (Version 1.0 was released in 1992 and now Ver 1.1 currently available) CMM establishes a framework for performing software process Assesment and software capability Evaluation. Software process Assesment : focus on identifying improvements within company software processes Software capability Evaluation : focus on identifying risks associated with a particular project. Note: Evaluation may be performed on existing projects to monitor their process performances with the intent of identifying potential improvement with software process of the project. CMM provides a conceptual structure for improving the management and development of S/W products in a disciplined and consistent way. It does not guarantee that software products will be successfully build or that all problems in a software process will be resolved. CMM identifies practices for a mature software processes. Note : Matured organization addresses all the issues essential to a successful project including –People, Technology and Processes. Maturity of an organization’s software process helps to project a project’s ability to meet its goal. Levels of CMM – INITIAL – REPEATABLE – DEFINED – MANAGED – OPTIMIZING LEVEL 1 : Organization has no process. (Customer Req. are uncontrolled and no project management practices followed) LEVEL 2 : tracks the processes that fetches performance and quality (Management reacts to problems only when they occurs. Establishes a basic project management processes) LEVEL 3 : Organization defines the processes for execution of its day-to-day function.(Everyone and management knows their roles and responsibilities. Management prepares risk management plan) LEVEL 4 : Organization defines the framework to capture and analyses the metrics. Using Metrics S/W quality is laid. Here we quantify the quality level and processes (Management measure the progress and problems and predict the outcome precisely)

Page 8: Interview Question Collection for Amdocs

LEVEL 5 : Here the processes are continually fine-tuned to achieve still more better results as they go along. Here inefficient activities are identified which are then replaced or revised. Here productivity and quality are improved in a controlled manner. (here we follow change management process and Technology change management processes) Define Metrics ? Measuring your progress in order to know where you are and what mid-course correction you need to take to achieve goals. Metrics are of 2 types (1) in-process metrics and (2) end-result metrics Road Map to Metrics are PLAN -> DO -> CHECK -> ACT ->>>> PLAN >>> During metrics we track Time-Bound Targets and Result Oriented Targets should be measured and We Define the UCL and LCL and Mean-Value of a metric Difference between quality Control and Quality Assurance? Quality Control refers to testing a product after a given phase to find out if it has any defects and in case it does have defects to employee corrective measures to remedy the same. Quality Control is done after the product is build. It Oriented towards defect detection rather than defect prevention. (Ex: Testing, Test cases, Tractability matrix) Quality Assurance if focuses on the prevention of defect from the very start. . Its defect prevention oriented rather than defect deduction oriented. (Ex: Inspection / Review and Audits) What does SQA means? SQA S/W Quality Analyst is a person whose role is to take care of QA and QC What does NC means? NC: Non-Conformance are the process that escape from SQA evaluation. Explain Different types of TESTING ? Black Box : This is a FUNCTIONAL TEST. Needs no knowledge of internal design/code. Since tests are based on requirements and functionality. White Box : This is a STRUCTUAL TEST . Needs knowledge of the internal design/code. Since tests are based on coverage of code statements, conditions and paths. Unit : used to test particular function/ module. Done by programmer Incremental Integration : continious testing of an application as new functionality is added. Done by the programmer Integration : testing after combining several parts of an application to determine if they function together correctly. Regression : re-testing after fixes or modifications of the s/w is done. Acceptance : Final testing based on the specification of end-user , over some limited period of time. To detemine whether the s/w is satisfactory to the customer Load : testing an application under usual heavy loads. To find out the maximum sustainable load that the system can handle . Stress : testing an application under unusal heavy loads. ( when running shortage of resource, ram, disk ect) Useablilty : testing the application by a thirdperson to judge the user-friendliness of the application Compatibility : testing how well s/w performs in a particular h/w or s/w or o/s or network ect environments Alpha : testing of an application when development is nearing completion .Done by end-user Beta : testing when development is completed and final bugs and problems need to be found before final release. Done by end-user. Define UML? UML: The Unified Modeling Language (UML) is considered the de facto standard object modeling language in the industry. The UML is the evolution of early approaches to object-oriented analysis and design. Based on the seminal works by Grady Booch, Ivar Jacobson, and Jim Rumbaugh in the Booch, OOSE, and methods, these three Rational experts have

Page 9: Interview Question Collection for Amdocs

provided the basis for the next generation of visual software modeling. The UML details the application modeling language for:

• Business process modeling with use cases • Class and object modeling • Component modeling • Distribution and deployment modeling

UML is to specify, Visualize and document the artifacts of an object oriented system under development. UML consists of

1) modeling elements (Static and Dynamic) (static – classes, attributes, relationship & dynamic- objects, Messages and state)

2) Relationship (Dependency, Association, Generalization and Realization) 3) Extensibility (Stereotype, Tagged value and Constraints) 4) Diagrams (Static View and Dynamic view) Static View – use case, component, deployment, class and object & Sequence Diagram -> Time oriented, Collaboration -> Message oriented,

DATABASE How do you run SQL statements from VC++? By using CDatabase class and using the method ExecuteSQL () you can run SQL Statements directly from VC++ What is a Trigger? Trigger defines an action the database should take when some database-related events (insert/update/delete) occurs. The code within Trigger called the trigger-body is made up of PL/SQL blocks. Triggers are executed by Database. Note: When enforcing business rules first relay on declarartive referential integrity Only Use Triggers to enforce those rules that cannot be coded through referential integrity. Types of Triggers is classified based on type of triggering transaction and based on level at which triggers are executed. They are 1) Row level Triggers (triggers executed once for each row in a Tx)2) Statement level Triggers (triggers executed once for each Tx) 3) Before and After Triggers(inserts/updates/deletes) 4) Instead-of Triggers (redirection takes place) 5) Schema Triggers (events during create/alter/drop tables) 6) DB level Triggers (events when errors, logon, logoff, startup and shutdown). Rather can calling large block of code within a trigger body you can save the code as a stored procedure and call the procedure from within the trigger by using a call command To enable trigger use -> alter trigger abc enable; To enable all triggers of a table -> alter table abc enable all triggers; To disable triggers -> alter trigger abc disable /alter table abc disable all triggers To drop triggers -> drop trigger abc; In short -Its an PL/SQL block that fires with DML command. It is not called explicitly. It is executed automatically when the associated DML is issued. 2Types -> Row Level and Statement level Triggers Example: CREATE or REPLACE TRIGGER my_customer_audit BEFORE UPDATE On my_customer FOR EACH ROW BEGIN INSERT INTO update_check Values('Updating a row', sysdate); END; Explain each:

DDL -> Create , Alter, Drop, Truncate DML -> Insert, Delete, Select, Update ( all have implicit cursors) DCL (Data Control Language) -> Commit, Rollback and SavePoint View ->its an logical table (not a physical table). You can only insert / Delete but you

cannot update.

Page 10: Interview Question Collection for Amdocs

What is Normalization? To eliminate data redundancy, to eleminate inconsistent dependency , actually to speedup your application, to incorporate the flexibility in the design so as to easily adopt to new changes What is outer join? Outer Joins are almost similar to Inner Joins, but in Outer Joins all the records in one table are combined with records in the other table even if there is no corresponding common value. SELECT * FROM table1 LEFT OUTER JOIN table2 ON table1.name = table2.name/ What is a Cursor? When a SQL statement is executed oracle opens a private workspace area in the system called Cursor. There are 2 types Implict Cursor(all DML statement uses) Explicit Cursor (only used by the SELECT statement when returning multiple records) What is the Diff between Procedure and Function? Both are PL/SQL named blocks used to perform a specific task . Only difference is a Procedure may or may not return a value whereas Function must return a value. Note: Procedures:-Sophisticated Business logic and application logic can be stored as procedures within oracle. Unlike procedures, functions can return a value to the caller. What is an Index table? Its based on a sorted ordering of the values. Index table provide fast access time when searching. Explain the Levels Normalization Process? First Level : Eliminate repeating of groups of data in each table by creating separate tables for each group of related data. Identify each set of related data with a primary key Second Level : Releate tables using Foreign key Third Level : Eliminate fields/columns that do not depend on the key Fourth Level: in many-to- many relationship independent entites cannot be stored in the same table (most developers ignore this rule) Fifth Level : the Original Table must be reconstructed from the tables into which it has been broken down. Its only useful when dealing with large data schema Zero Form : If a DB which does not complains to any of the Normalization forms. This type is usefull only for data ware housing. Explain Different KEYS available in DB? CANDIDATE KEY - an attribute that uniquely identifying a row. There can be more than one candidate key in a table PRIMARY KEY - a Candidate key that you choose to identify rows uniquely is called primary key. There is only one PK for a given table. ALTERNATE KEY -the Candidate keys that was not chosen as primary key. COMPOSITE KEY: when a key is made of more than one candidate keys FOREIGN KEY : used to relate 2 tables using a common attribute. When a primary key in one table is available as an attribute in another related table is called FK. Define Entity Integrity ? It ensures that each row can be uniquely identified by an attribute called the primary key which cannot be NULL. Define Referential Integrity ?

It ensures that all the values in the foreign key matches with the primary key values is called referential integrity Define ER Diagram ?

It’s a graphical representation of DB Structure. It has 3 things Entity (Table Name); Attribute (Column Name); and RelationShip

Diff between Calloc and Malloc? Malloc -> Takes one parameter / single block of memory is allocated / holds garbage / needs typecasting

Page 11: Interview Question Collection for Amdocs

Calloc -> Takes two parameter / multiple blocks of memory is allocated / holds zero / needs typecasting Int* p = (int*)malloc(n*2) / int p =( int*)calloc(n,2) Diff between CallbyValue and CallbyReference ? CbV : here values are copied CbR : here address are copied Diff between While and Do-While? While -> first tests the codition and if true executes its statement Do-While -> First executes the statement and then tests the condition What are Enum and TypeDef? Enum is an user-defined data type that is limited to a fixed list of integer values alone. Internally compiler treats enumerated variables as integers alone. TypeDef allows to rename a datatype(both defined and user defined datatypes) Enum A { one, two, three }; enum A a; a = one; Typedef unsigned long tl; tl var1; ++a -> abc abc::Operator++() a++ -> abc abc::Operator++( int x)

{ I++; return *this; } { abc d; d= * this; I++; return d; } What is a smart pointer? A smart pointer is a class that overrides operator ->. The smart pointer class contains pointer to another object. They delegates the call to the object pointed to by the contained pointer. Smart pointer is a smart pointer that contains a pointer to an interface Coolest thing about smart pointer is that we don’t have to remember to call Release. When the smart pointer goes out of scope it automatically calls Release in its destructor. You shouldn’t call Release on the smart pointer. Only you should should assign the pointer to NULL. (spIx = NULL;) Overloading : Different Signature, Same Scope , Same Name and Virtual Not Required

Used when we want the object to operate on Different types Overridding : Same Signature, Different Scope , Same Name and Virtual Required

Used when the existing implementation has to be replaced / modified in the subclass NEW OPERATOR : allocates memory , initialize the object , returns the correct pointer type and it can be overloaded PASS BY REFERENCE - > 1) Memory consumption 2) Avoids Slicing Problem (context of the object is used instead of object type when invoking functions) . Pass By Reference means the passing the address itself rather than passing the value. Passby Value means passing a copy of the value to be passed. //-----------------------------THUMB RULE------------------------------------------------------ INTERFACE ALONE - PURE VIRTUAL FUNCTION IMPLEMENTATION ALONE – PRIVATE INHERITANCE INTERFACE + DEFAULT IMPLEMENTATION - VIRTUAL FUNCTION INTERFACE + MANDATORY IMPLEMENTATION - NON- VIRTUAL FUNCTION 1. What is UML? The Unified Modeling Language (UML) is the industry-standard language for specifying, visualizing, constructing, and documenting the artifacts of software systems. Using UML, programmers and application architects can make a blueprint of a project, which, in turn, makes the actual software development process easier. 2. Who created UML? UML was created at Rational Software by methodologists Grady Booch, Ivar Jacobson, and Jim Rumbaugh with input from other leading methodologists, many software vendors, as well as end-users. Its aim is to unify the various existing systems into a best-of-breed modeling language. Explain the diff between DBMS and RDBMS? DBMS : a computer program that manages a permanent , self-descriptive repository of data

Page 12: Interview Question Collection for Amdocs

RDBMS : a computer program that provides an abstraction of relational tables to the user. It provides 3 kinds of functionality 1) present data in the form of table 2) provide operators for manipulating the tables and 3) support integrity rules on tables. Software Models Waterfall Model 1)This model is simple to use 2) by dividing the project into different phases the lining up of skill set required for the requirement become possible 3)only disadvantage is only very few projects can be divided into such water-tight phases. 4) this model is based on reactive error correction rather than proactive error prevention. This reactive mechanism is more expensive that proactive approach 5) In projects where requirements are changing rapidly then this model is useless. Since lot of reworking and chances of propagated errors increases significantly. Spiral Model 1) Here the project software life cycle is visualized in terms of phases and sectors. 2) Each iteration starts from a particulat sector and returns to that sector at a higher level than its starting point 3) It strikes a good balance mechanism for early problem identification and correction while not missing out proactive problem prevention. 4) Each iteration has a risk analysis sector that evaluates alternatives for proactive problem avoidance. Also each iteration has a testing / Customer acceptance sector that takes care of error correction at that level. 5)this model more suits to general purpose or system software development. RAD RAD Model = Prototype Model + Waterfall Model waterfall model, it impose some structure in quality assurance and req capturing. But RAD is faster and responsiveness. Disadvantage : For development it requires modeling tools and CASE tools, Continuous Customer involvement Advantage : Component re-use and Building blocks a What's the deal with operator Overloading?

overloading allows C/C++ operators to have user-defined meanings Can I overload operator== so it lets me compare two char[] using a string comparison? NO. Should I design my classes from the outside (interfaces first) or from the inside (data first)? Outside first Can I use realloc() on pointers allocated via new ? Do I need to check for NULL after p = new Fred ()? No. In C++, if the runtime system cannot allocate sizeof(Fred) bytes of memory during p = new Fred(), a std::bad_alloc exception will be thrown. Unlike malloc(), new never return NULL Do I need to check for NULL before delete p? No. The C++ language guarantees that delete p will do nothing if p is equal to NULL In p = new Fred(), does the Fred memory "leak" if the Fred constructor throws an exception? No. If an exception occurs during the Fred constructor of p = new Fred(), the C++ language guarantees that the memory sizeof(Fred) bytes that were allocated will automagically be released back to the heap. What if I forget the [] when deleteing array allocated via new T[n]? Leads to Heap corruption is a likely result. Or worse. Your program will probably die Is it legal (and moral) for a member function to say delete this?

As long as you're careful, it's OK for an object to commit suicide (delete this). What does "const Fred& x" mean?

It means x aliases a Fred object, but x can't be used to change that Fred object. Does "Fred& const x" make any sense? No, it is nonsense. But that is redundant, since references are always const. You can't reseat a reference. What does "Fred const& x" mean?

Page 13: Interview Question Collection for Amdocs

Fred const& x is functionally equivalent to const Fred& x. What is a "const member function"? A member function that inspects (rather than mutates) its object. What does "const int* p" means ? Because "const int* p" means "p promises not to change the *p When should my destructor be virtual? When someone will delete a derived-class object via a base-class pointer How do I separate interface from implementation in C++? Use an abstract base class. At the programming language level, an ABC is a class that has one or more pure virtual member functions. You cannot make an object (instance) of an ABC. What is a "pure virtual" member function? How can I set up my member function so it won't be overridden in a derived class? How can I tell if an integer is a power of two without looping?

inline bool isPowerOf2(int i) { return i > 0 && (i & (i - 1)) == 0; } Is the type of "pointer-to-member-function" different from "pointer-to-function"?

• Its type is "int (*)(char,float)" if an ordinary function • Its type is "int (Fred::*)(char,float)" if a non-static member function of class Fred

Note: if it's a static member function of class Fred, its type is the same as if it was an ordinary function: "int (*)(char,float)". What is a "parameterized type"? pproach Interview Questions Q: Why is Java not platform dependent like C++? A: Java programs are not platform dependent because they run on there own virtual machine. Q: Can a Java file be both an Applet and an Application? If so how is this done? A: Yes, this can be done if the file has both a "main" and "init" methods. When ran as an Applet, the "main" is ignored, and when ran as an Application, the "init" is ignored. Q: How do you represent Strings in C++? A: You represent Strings in C++ as a "char array" that terminates with a null character. Q: What is one advantage and one disadvantage of using Java Applets? A: One advantage of using Java Applets is that the server has less processes to run on it's side. The Java Applet is ran on the client side so the server side does not need to use it's own resources to run it. One disadvantage of Java Applets is that not all browsers support all features of Java 2 Applets, so they cannot be viewed on all browsers the same way. For example, IE does not fully support Java 2 Applets. Q:Break this URL down into it's individual parts? <http://www.abc.com/clothes/shirts/formal.html#top> A: http:// --> protocol www.abc.com/ --> domain name clothes/ --> subdirectory name shirts/ --> subdirectory name formal.html --> document name (Web Page) #top --> anchor

What is the difference between "overloading" and "overriding"? Overloading is the practice of supplying more than one definition for a given function name in the same scope. The compiler is left to pick the appropriate version of the function or operator based on the arguments with which it is called. Overriding refers to the virtual functions, i.e. functions that ensure that the correct function is called for an object, regardless of the expression used to make the function call. For example, if the same function with virtual attribute is declared in base and derived class, the function from the

Page 14: Interview Question Collection for Amdocs

derived class is invoked for objects of the derived class, even if it is called using a pointer or reference to the base class.

What is a singleton? Write a simple implementation of a singleton. Singleton is a class that can have only one instance. For singleton example, see Singleton pattern in "Design Patterns" of E.Gamma, etc.

What is a pure virtual method (function)? What is the syntax for a pure virtual method? What is an abstract class?

Pure virtual function is a function that declared with "=0;" specifier. Pure virtual function does not have body and must be overridden in the derived class. The syntax for pure virtual function is virtual void foo() = 0; Abstract class is a class with at least one pure virtual function.

What is a reference? A reference is a quantity that holds the address of an object but behaves syntactically like that object. A reference cannot exist without object and must be initialized.

What is a friend class/function? Why would you need it? Shortly, friend class or function is a class or a function that declared friend of an other class. The idea behind friend class is to provide the access to the private and protected members or member functions of the friend class. There is a lot of controversial opinions on this topic and you should not usually use friends as it is a hole in your design. One of the examples where it's used is a momento design pattern.

What is the difference between a virtual function and a non-virtual function? Virtual attribute for a functions assumes that its body will be possibly overridden in the derived class. Non-virtual function is always called from the class where it is defined. You may also say that "virtual" functions implement polymorphism (by the way, it is highly recommended to put all you know about virtual and polymorphism in the answer. Do not follow blindly to all these answers.) Again, it is quite important that you demonstrate the understanding of the intent of virtual function to be overwritten in the derived class.

What is the role of static member variables? Static member variables are the same value for all instances of the class.

What is the role of static member functions? Static member functions are not really the members. The idea is that you may call the static member function from any other class, if you specify the base class name where the static member function was declared. Of course, static member function cannot change the members of the class.

What are the advantages of templates in C++? Templates have several advantages. Firstly, they allow to avoid inappropriate multiple inheritance, where one of the inherited classes is just type to be managed. Secondly, they allow to inherit from "unknown" type, therefore creating "management" class for unknown type. Thirdly, templates allow to create "general" classes that is especially useful for all kind of type-safe collection classes. One good use is building framework classes that unite and hide several internal implementation classes (which can be non-template). This makes it easy for a beginner to use a big integrated complex functional class and still allows advanced users to rewrite portions of actual implementation. Drop me email if you think about more advantages. This is pretty open discussion.

How many templates have you ever written? You may think I am kidding. No, this is one of the question I was actually asked at the interview. I was quite puzzled by this question. Say some numbers: 100, 1000. Number does not matter. What does matter in this case is your real knowledge of templates and you will either fail during further questions or succeed.

Difference: Activity Diagram and Sequence Diagram. Activity diagram is activity oriented whereas sequence diagram is time oriented.

Page 15: Interview Question Collection for Amdocs

(Activity diagram shows the flow from activity to activity). What is association?

It’s a relationship that specifies that objects of onething be connected to objects of another class. Here you can navigate from one object to another and vice-versa

What do you mean by "Realization" and Generalization? Generalization: use this relationship when you want to show child-parent relationship. Its called an “is-a-kind-of” relationship. Here the child is substitutable for the parent. (Its represented using solid-line with hallow diamond) Realization: is a semantic relationship between classifier wherein one classifier specifies a contract that another classifier guarantees to carryout

1. Difference between Composition and Aggregation. Aggregation: used when you model whole-part relationship. It represents “has-a” relationship means that objects of whole has an objects of part Composition: a form of aggregation with strong ownership & coincident lifetime of part with whole. Parts once created they live and die with the whole. (Tightly coupled)

2. Difference: Sequence Diagrams, Collaboration Diagrams. Sequence Diagram is associate with Time oriented whereas collaboration diagram is associated with message oriented

3. Difference: 'uses', 'extends', 'includes' Uses: one class uses another class (holds no relationship) Extends: nothing but inheritance Includes: nothing but composition (contains)

4. What shall I go for Package Diagram? Package is nothing but a set of related classes logically grouped together. It’s a mechanism for arranging elements into groups.

1. Difference between "ORACLE" and "MICROSOFT ACCESS" databases. Access is a DBMS whereas Oracle is RDBMS.

2. Explain the diff between DBMS and RDBMS? DBMS : a computer program that manages a permanent , self-descriptive repository of data RDBMS : a computer program that provides an abstraction of relational tables to the user. It provides 3 kinds of functionality 1) present data in the form of table 2) provide operators for manipulating the tables and 3) support integrity rules on tables.

GENERAL: The ORDER BY clause allows for sorting output by selected columns or expressions The GROUP BY clause is used to generate subtotals in the output. The HAVING clause acts like a WHERE clause for the summarized GROUP BY rows.

• It's only relevant when used in association with a GROUP BY clause. • It acts on the expressions that are enclosed in the grouping functions of the SELECT

clause, not on the expressions in the GROUP BY clause. For example, SELECT name, count(*) FROM EMP GROUP BY name HAVING count(*) > 20;

3. What is a "trigger"? Trigger is an action that DB should take when some DML statements takes place. Its executed by the DB. 4. Difference - Primary Key and Aggregate Key The cadidate key that is not selected as primary key is called Aggregate Key 5. What are the different types of joins?

Inner and outer (Left Join and Right Join). General - SELECT s.sid, R.bid FROM Sailors S JOIN Reserves R Leftouter joint - SELECT s.sid, R.bid FROM Sailors S LEFT OUTER JOIN Reserves R. RightOuter Join - SELECT s.sid, R.bid FROM Sailors S RIGHT OUTER JOIN Reserves R

Page 16: Interview Question Collection for Amdocs

DBMS/RDBMS 1. DBMS - Database Management Systems Companies need to process a large amount of data. Manual storage of this data wastes a lot of time while retrieving it. It also requires tedious clerical hours to arrange the data in the form required by top management. Storing this data in a way to facilitate easy access is very important and that is why computers are used in organizations. This is possible using DBMS. DBMS, besides allowing you to store large amounts of data, allows you to retrieve information easily whenever and in whichever format it is desired. 2. RDBMS - Relational Database Management Systems The functionality of RDBMS is the same as DBMS except that the features offered for data storage and retrieval are very advanced. These systems are based on mathematical SET theory. A RDBMS ensures that the data stored in the database is accurate and relevant. Excellent security features are offered by these systems. RDBMS packages are used in medium to large-scale organizations, especially, those where data has to be made available on distributed networks. These systems have capability to store a very large amount of data and have quick data retrieval mechanisms. They also have elaborate database administration for handling multi-users, storage, and failures. An RDBMS uses SQL (Structures Query Language) to access data from database. This is a standard language commonly used across different RDBMS. 3.What is the difference between RDBMS & DBMS? DBMS are for smaller organizations with small amount of data, where security of the data is not of major concern. Also DBMS are not necessarily client server based systems. With DBMS, one can develop a complete application, starting from processing inputs to generating output. RDBMS are designed to take care of large amounts of data and also the security of this data. They are also client server based systems. To create a complete application, one requires client software like VB, Developer 2000. 4. What is Oracle? What are its future trends? Oracle is the most popular RDBMS among the IT organizations due to the features offered. The current version of Oracle is Oracle 8i which is web enabled. More than 50% of web applications use Oracle as their Database Server. Oracle 8i also supports Java. What's the difference between a primary key and a unique key? Both primary key and unique enforce uniqueness of the column on which they are defined. But by default primary key creates a clustered index on the column, where are unique creates a nonclustered index by default. Another major difference is that, primary key doesn't allow NULLs, but unique key allows one NULL only. Define candidate key, alternate key, composite key? A candidate key is one that can identify each row of a table uniquely. Generally a candidate key becomes the primary key of the table. If the table has more than one candidate key, one of them will become the primary key, and the rest are called alternate keys. A key formed by combining at least two or more columns is called composite key. What is a transaction and what are ACID properties? A transaction is a logical unit of work in which, all the steps must be performed or none. ACID stands for Atomicity, Consistency, Isolation, Durability. These are the properties of a transaction. For more information and explanation of these properties, see SQL Server books online or any RDBMS fundamentals text book. What is a self join? Explain it with an example. Self join is just like any other join, except that two instances of the same table will be joined in the query. Here is an example: Employees table which contains rows for normal employees as well as managers. So, to find out the managers of all the employees, you needaself join.

Page 17: Interview Question Collection for Amdocs

CREATETABLE emp ( empid int, mgrid int, empname char(10) ) INSERT emp SELECT 1,2,'Vyas' INSERT emp SELECT 2,3,'Mohan' INSERT emp SELECT 3,NULL,'Shobha' INSERT emp SELECT 4,2,'Shridhar' INSERT emp SELECT 5,2,'Sourabh' SELECT t1.empname [Employee], t2.empname [Manager] FROM emp t1, emp t2 WHERE t1.mgrid = t2.empid Here's an advanced query using a LEFT OUTER JOIN that even returns the employees without managers (super bosses) SELECT t1.empname [Employee], COALESCE(t2.empname, 'No manager') [Manager] FROM emp t1 LEFT OUTER JOIN emp t2 ON t1.mgrid = t2.empid . What are the differences between an applet and an application. A4. An application has no security restrictions, and is run like a normal application using java. An applet has security restrictions and is run either in an applet viewer or Web Browser. There is no main, as the applet viewer/Web Browser is the application and it instantiates the applet class instance you provide it. Q5. What is swing. A5. Swing is an enhanced version of AWT that provides light weight graphical components. These components are suitable for Applets that are going to be run within Web Browsers. What is the difference between the >> and >>> operators? The >> operator carries the sign bit when shifting right. The >>> zero-fills bits that have been shifted out. Is sizeof a keyword? The sizeof operator is not a keyword. What are wrapped classes? Wrapped classes are classes that allow primitive types to be accessed as objects. 27. Does garbage collection guarantee that a program will not run out of memory? Garbage collection does not guarantee that a program will not run out of memory. It is possible for programs to use up memory resources faster than they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection . What is the purpose of the wait(), notify(), and notifyAll() methods? The wait(),notify(), and notifyAll() methods are used to provide an efficient way for threads to wait for a shared resource. When a thread executes an object's wait() method, it enters the waiting state. It only enters the ready state after another thread invokes the object's notify() or notifyAll() methods. What is the difference between the String and StringBuffer classes? String objects are constants. StringBuffer objects are not. What is the purpose of garbage collection? The purpose of garbage collection is to identify and discard objects that are no longer needed by a program so that their resources may be reclaimed and reused. What restrictions are placed on method overriding? Overridden methods must have the same name, argument list, and return type.

Page 18: Interview Question Collection for Amdocs

The overriding method may not limit the access of the method it overrides. The overriding method may not throw any exceptions that may not be thrown by the overridden method. What are three ways in which a thread can enter the waiting state? A thread can enter the waiting state by invoking its sleep() method, by blocking on I/O, by unsuccessfully attempting to acquire an object's lock, or by invoking an object's wait() method. It can also enter the waiting state by invoking its (deprecated) suspend() method. What is a Java package and how is it used? A Java package is a naming context for classes and interfaces. A package is used to create a separate name space for groups of classes and interfaces. Packages are also used to organize related classes and interfaces into a single API unit and to control accessibility to these classes and interfaces. What are synchronized methods and synchronized statements? Synchronized methods are methods that are used to control access to an object. A thread only executes a synchronized method after it has acquired the lock for the method's object or class. Synchronized statements are similar to synchronized methods. A synchronized statement can only be executed after a thread has acquired the lock for the object or class referenced in the synchronized statement. 195. What are the two basic ways in which classes that can be run as threads may be defined? A thread class may be declared as a subclass of Thread, or it may implement the Runnable interface.

SQL Q1. What is the basic difference between a join and a union? A1. A join selects columns from 2 or more tables. A union selects rows. Q2. What is normalization and what are the five normal forms? A2. Normalization is a design procedure for representing data in tabular format. The five normal forms are progressive rules to represent the data with minimal redundancy. Q3. What are foreign keys? A3. These are attributes of one table that have matching values in a primary key in another table, allowing for relationships between tables. Q4. Describe the elements of the SELECT query syntax. A4. SELECT element FROM table WHERE conditional statement. Q5. Explain the use of the WHERE clause. A5. WHERE is used with a relational statement to isolate the object element or row. Q6. What techniques are used to retrieve data from more than one table in a single SQL statement? A6. Joins, unions and nested selects are used to retrieve data. Q7. What is a view? Why use it? A7. A view is a virtual table made up of data from base tables and other views, but not stored separately. Q8. Explain an outer join. A8. An outer join includes rows from tables when there are no matching values in the tables. Q9. What is a subselect? Is it different from a nested select? A9. A subselect is a select which works in conjunction with another select. A nested select is a kind of subselect where the inner select passes to the where criteria for the outer select. Q10. What is the difference between group by and order by? A10. Group by controls the presentation of the rows, order by controls the presentation of the columns for the results of the SELECT statement. Q11. What keyword does an SQL SELECT statement use for a string search? A11. The LIKE keyword allows for string searches. The % sign is used as a wildcard. Q12. What are some sql aggregates and other built-in functions?

Page 19: Interview Question Collection for Amdocs

A12. The common aggregate, built-in functions are AVG, SUM, MIN, MAX, COUNT and DISTINCT. Q13. How is the SUBSTR keyword used in sql? A13. SUBSTR is used for string manipulation with column name, first position and string length used as arguments. Eg. SUBSTR (NAME, 1 3) refers to the first three characters in the column NAME. Q14. Explain the EXPLAIN statement. A14. The explain statement provides information about the optimizer's choice of access path of the sql. Q15. What is referential integrity? A15. Referential integrity refers to the consistency that must be maintained between primary and foreign keys, ie every foreign key value must have a corresponding primary key value. Q16. What is a NULL value? What are the pros and cons of using NULLS? A16. A NULL value takes up one byte of storage and indicates that a value is not present as opposed to a space or zero value. It's the DB2 equivalent of TBD on an organizational chart and often correctly portrays a business situation. Unfortunately, it requires extra coding for an application program to handle this situation. Q17. What is a synonym? How is it used? A17. A synonym is used to reference a table or view by another name. The other name can then be written in the application code pointing to test tables in the development stage and to production entities when the code is migrated. The synonym is linked to the AUTHID that created it. Q18. What is an alias and how does it differ from a synonym? A18. An alias is an alternative to a synonym, designed for a distributed environment to avoid having to use the location qualifier of a table or view. The alias is not dropped when the table is dropped. What is the advantage of OOP? You will get varying answers to this question depending on whom you ask. Major advantages of OOP, IMHO, are: 1. simplicity: software objects model real world objects, so the complexity is reduced and the program structure is very clear; 2. modularity: each object forms a separate entity whose internal workings are decoupled from other parts of the system; 3. modifiability: it is easy to make minor changes in the data representation or the procedures in an OO program. Changes inside a class do not affect any other part of a program, since the only public interface that the external world has to a class is through the use of methods; 4. extensibility: adding new features or responding to changing operating environments can be solved by introducing a few new objects and modifying some existing ones; 5. maintainability: objects can be maintained separately, making locating and fixing problems easier; 6. re-usability: objects can be reused in different programs What are the main differences between Java and C++? Everything is an object in Java( Single root hierarchy as everything gets derived from java.lang.Object) Java does not have all the complicated aspects of C++ ( For ex: Pointers, templates, unions, operator overloading, structures etc..) The Java language promoters initially said "No pointers!", but when many programmers questioned how you can work without pointers, the promoters began saying "Restricted pointers." You can make up your mind whether it’s really a pointer or not. In any event, there’s no pointer arithmetic. There are no destructors in Java. (automatic garbage collection) Java does not support conditional compile (#ifdef/#ifndef type). Thread support is built into java but not in C++.

Page 20: Interview Question Collection for Amdocs

Java does not support default arguments. There’s no scope resolution operator :: in Java. Java uses the dot for everything, but can get away with it since you can define elements only within a class. Even the method definitions must always occur within a class, so there is no need for scope resolution there either. There’s no "goto " statement in Java. Java doesn’t provide multiple inheritance (MI), at least not in the same sense that C++ does. Exception handling in Java is different because there are no destructors. Java has method overloading, but no operator overloading. The String class does use the + and += operators to concatenate strings and String expressions use automatic type conversion, but that’s a special built-in case. Java is interpreted for the most part and hence platform independent What are interfaces? Interfaces provide more sophisticated ways to organize and control the objects in your system. The interface keyword takes the abstract concept one step further. You could think of it as a “pure” abstract class. It allows the creator to establish the form for a class: method names, argument lists, and return types, but no method bodies. An interface can also contain fields, but The interface keyword takes the abstract concept one step further. You could think of it as a “pure” abstract class. It allows the creator to establish the form for a class: method names, argument lists, and return types, but no method bodies. An interface can also contain fields, but An interface says: “This is what all classes that implement this particular interface will look like.” Thus, any code that uses a particular interface knows what methods might be called for that interface, and that’s all. So the interface is used to establish a “protocol” between classes. (Some object-oriented programming languages have a keyword called protocolto do the same thing.) What is the difference between StringBuffer and String class? A string buffer implements a mutable sequence of characters. A string buffer is like a String, but can be modified. At any point in time it contains some particular sequence of characters, but the length and content of the sequence can be changed through certain method calls. The String class represents character strings. All string literals in Java programs, such as "abc" are constant and implemented as instances of this class; their values cannot be changed after they are created. Strings in Java are known to be immutable. What it means is that every time you need to make a change to a String variable, behind the scene, a "new" String is actually being created by the JVM. For an example: if you change your String variable 2 times, then you end up with 3 Strings: one current and 2 that are ready for garbage collection. The garbage collection cycle is quite unpredictable and these additional unwanted Strings will take up memory until that cycle occurs. For better performance, use StringBuffers for string-type data that will be reused or changed frequently. There is more overhead per class than using String, but you will end up with less overall classes and consequently consume less memory. Describe, in general, how java's garbage collector works? The Java runtime environment deletes objects when it determines that they are no longer being used. This process is known as garbage collection. The Java runtime environment supports a garbage collector that periodically frees the memory used by objects that are no longer needed. The Java garbage collector is a mark-sweep garbage collector that scans Java's dynamic memory areas for objects, marking those that are referenced. After all possible paths to objects are investigated, those objects that are not marked (i.e. are not referenced) are known to be garbage and are collected.

Page 21: Interview Question Collection for Amdocs

(A more complete description of our garbage collection algorithm might be "A compacting, mark-sweep collector with some conservative scanning".) The garbage collector runs synchronously when the system runs out of memory, or in response to a request from a Java program. Your Java program can ask the garbage collector to run at any time by calling System.gc(). The garbage collector requires about 20 milliseconds to complete its task so, your program should only run the garbage collector when there will be no performance impact and the program anticipates an idle period long enough for the garbage collector to finish its job. Note: Asking the garbage collection to run does not guarantee that your objects will be garbage collected. The Java garbage collector runs asynchronously when the system is idle on systems that allow the Java runtime to note when a thread has begun and to interrupt another thread (such as Windows 95). As soon as another thread becomes active, the garbage collector is asked to get to a consistent state and then terminate. What's the difference between == and equals method? equals checks for the content of the string objects while == checks for the fact that the two String objects point to same memory location ie they are same references. What are abstract classes, abstract methods? Simply speaking a class or a method qualified with "abstract" keyword is an abstract class or abstract method. You create an abstract class when you want to manipulate a set of classes through a common interface. All derived-class methods that match the signature of the base-class declaration will be called using the dynamic binding mechanism. If you have an abstract class, objects of that class almost always have no meaning. That is, abstract class is meant to express only the interface and sometimes some default method implementations, and not a particular implementation, so creating an abstract class object makes no sense and are not allowed ( compile will give you an error message if you try to create one).

An abstract method is an incomplete method. It has only a declaration and no method body. Here is the syntax for an abstract method declaration: abstract void f(); If a class contains one or more abstract methods, the class must be qualified an abstract. (Otherwise, the compiler gives you an error message.). It’s possible to create a class as abstract without including any abstract methods. This is useful when you’ve got a class in which it doesn’t make sense to have any abstract methods, and yet you want to prevent any instances of that class. Abstract classes and methods are created because they make the abstractness of a class explicit, and tell both the user and the compiler how it was intended to be used. What is the difference between a Vector and an Array. Discuss the advantages and disadvantages of both? Vector can contain objects of different types whereas array can contain objects only of a single type. - Vector can expand at run-time, while array length is fixed.

- Vector methods are synchronized while Array methods are not What gives java it's "write once and run anywhere" nature? Java is compiled to be a byte code which is the intermediate language between source code and machine code. This byte code is not platorm specific and hence can be fed to any platform. After being fed to the JVM, which is specific to a particular operating system, the code platform specific machine code is generated thus making java platform independent. What are native methods? How do you use them? Native methods are methods written in other languages like C, C++, or even assembly language. You can call native methods from Java using JNI. Native methods are used when the implementation of a particular method is present in language other than Java say C, C++.

Page 22: Interview Question Collection for Amdocs

To use the native methods in java we use the keyword native public native method_a() This native keyword is signal to the java compiler that the implementation of this method is in a language other than java. Native methods are used when we realize that it would take up a lot of rework to write that piece of alerady existing code in other language to java. What is JDBC? Describe the steps needed to execute a SQL query using JDBC. We can connect to databases from java using JDBC. It stands for Java DataBase Connectivity. Here are the steps: 1. Register the jdbc driver with the driver manager 2. Establish jdbc connection 3. Execute an sql statement 4. Process the results 5. Close the connection Before doing these do import java.sql.* JDBC is java based API for accessing data from the relational databases. JDBC provides a set of classes and interfaces for doing various database operations. The steps are: Register/load the jdbc driver with the driver manager. Establish the connection thru DriverManager.getConnection(); Fire a SQL thru conn.executeStatement(); Fetch the results in a result set Process the results Close statement/result set and connection object. How many different types of JDBC drivers are present? Discuss them. There are four JDBC driver types. Type 1: JDBC-ODBC Bridge plus ODBC Driver: The first type of JDBC driver is the JDBC-ODBC Bridge. It is a driver that provides JDBC access to databases through ODBC drivers. The ODBC driver must be configured on the client for the bridge to work. This driver type is commonly used for prototyping or when there is no JDBC driver available for a particular DBMS. Type 2: Native-API partly-Java Driver: The Native to API driver converts JDBC commands to DBMS-specific native calls. This is much like the restriction of Type 1 drivers. The client must have some binary code loaded on its machine. These drivers do have an advantage over Type 1 drivers because they interface directly with the database. Type 3: JDBC-Net Pure Java Driver: The JDBC-Net drivers are a three-tier solution. This type of driver translates JDBC calls into a database-independent network protocol that is sent to a middleware server. This server then translates this DBMS-independent protocol into a DBMS-specific protocol, which is sent to a particular database. The results are then routed back through the middleware server and sent back to the client. This type of solution makes it possible to implement a pure Java client. It also makes it possible to swap databases without affecting the client. Type 4: Native-Protocol Pur Java Driver These are pure Java drivers that communicate directly with the vendor's database. They do this by converting JDBC commands directly into the database engine's native protocol. This driver has no additional translation or middleware layer, which improves performance tremendously. What does the "static" keyword mean in front of a variable? A method? A class? Curly braces {}? static variable - means a class level variable static method:

Page 23: Interview Question Collection for Amdocs

-does not have "this". It is not allowed to access the not static members of the class. can be invoked enev before a single instance of a class is created. eg: main static class: no such thing. static free floating block: is executed at the time the class is loaded. There can be multiple such blocks. This may be useful to load native libraries when using native methods. eg: native void doThis(){ static{ System.loadLibrary("myLibrary.lib"); ..... } Access specifiers: "public", "protected", "private", nothing? Unfortunately I believe that buturab is discussing Static vs. non-Static methods and variables. In the case of Public, Private and Protected, that is used to describe which programs can access that class or method: Public – any other class from any package can instantiate and execute the classes and methods Protected – only subclasses and classes inside of the package can access the classes and methods Private – the original class is the only class allowed to executed the methods. What does the "final" keyword mean in front of a variable? A method? A class? FINAL for a variable : value is constant FINAL for a method : cannot be overridden FINAL for a class : cannot be derived A final variable cannot be reassigned, but it is not constant. For instance, final StringBuffer x = new StringBuffer() x.append("hello"); is valid. X cannot have a new value in it,but nothing stops operations on the object that it refers, including destructive operations. Also, a final method cannot be overridden or hidden by new access specifications.This means that the compiler can choose to in-line the invocation of such a method.(I don't know if any compiler actually does this, but it's true in theory.) The best example of a final class is String, which defines a class thatcannot be derived. Does Java have "goto"? No. Why "bytecode"? Can you reverse-engineer the code from bytecode? you can get the sourcecode from ur class file. u get a free JAD here What types of index data structures can you have? An index helps to faster search values in tables. The three most commonly used index-types are: - B-Tree: builds a tree of possible values with a list of row IDs that have the leaf value. Needs a lot of space and is the default index type for most databases. - Bitmap: string of bits for each possible value of the column. Each bit string has one bit for each row. Needs only few space and is very fast.(however, domain of value cannot be large, e.g. SEX(m,f); degree(BS,MS,PHD) - Hash: A hashing algorithm is used to assign a set of characters to represent a text strig such as a composite of keys or partial keys, and compresses the underlying data. Takes longer to build and is supported by relatively few databases. The Four Storage Classes

Page 24: Interview Question Collection for Amdocs

• auto: the default. Variables are automatically created and initialized when they are defined and are destroyed at the end of the block containing their definition. They are not visible outside that block.

• register: a type of auto variable. a suggestion to the compiler to use a CPU register for performance.

• static: a variable that is known only in the function that contains its definition but is never destroyed and retains its value between calls to that function. It exists from the time the program begins execution.

extern: a static variable whose definition and placement is determined when all object and library modules are combined (linked) to form A namespace declaration identifies and assigns a name to a declarative region. The identifier in a namespace declaration must be unique in the declarative region in which it is used. The identifier is the name of the namespace and is used to reference its members. Q20. When are copy constructors called? A20. Copy constructors are called in three cases: when a function returns an object of that class by value, when the object of that class is passed by value as an argument to a function, and, finally, when you construct an object based on another object of the same class (Circle c1=c2;). Q26. What is the difference between a pointer and a reference? A26. A reference must always refer to some object and, therefore, must always be initialized; pointers do not have such restrictions. A pointer can be reassigned to point to different objects while a reference always refers to an object with which it was initialized.. What is the difference between const char *myPointer and char *const myPointer? A33. Const char *myPointer is a non constant pointer to constant data; while char *const myPointer is a constant pointer to non constant data.

OS 1. What is the CPU Scheduling algorithm used by the Unix Operating System? a) Pre-emptive b) Non-Premptive c) Pre-emptive with Dynamic Priority d) Pre-emtive with Static Priority. Ans: a 2. Unix Operating System is based On? a) Monolithic b) Micro - kernel c) Multithreded d) Multitasking. ans: c 3. Unix Operating System on Pentium is based on ? a) Real Mode b) Protected Mode c) Application Mode d) Virtual 86 mode. Ans: d 4. Protection level of Unix kernel under pentium architecture? a) 00-level b)01-level c) 02-level d) 03-level. Ans: 5. Under windows 2000 architecture, file system is implemented as? a) User Process in Kernel mode b) User Process in User mode c) Kernel Process in Kernel Mode d) Kernel Process in User mode. ans: d 6. Most efficient server today is ? Dont remember the options correctly. if anybody knows pls do mail me.with the correct answer. Ans: Apache/IIS 7. Hypermedia Document contains? a) Textonly b)Images only c)Text and Images d)Text,Images,Audio,and Video. ans: d 8. Oracle is intrinsically? a) Relational based b) Object Oriented c)Hierachical d) Network based. ans: a/b(8i) 9. Oracle server architecture is?

a) Client - server b) peer to peer c) Both client server and peer to peer b) d) None of the above. ans: c

10. The most primitive process in Unix is? a) the INIT process b) and some more options ans: a 11. After serving a page fault the control returns to ? a) The Next Instruction b) The Same Instruction c) The same instruction but the program halts d) The same instruction but the program hangs. ans: d

Page 25: Interview Question Collection for Amdocs

12. While running a process, Pressing Control + C , invokes which system call? a) SYSILL b) SYS GEV and two more options. Ans: SIGINT 13. A normal user may become a super user temporarity by executing ? a) a sup uid () system call owned by the super user. b) a sup gid() syscall owned by the user himself. c) a sup uid () system call owned by the user himself d) a non sup uid () syscalls owned by the super user. ans: su uid 14. A page daemon in Unix is a) super user process with pid = 2 b) Ordinary user process with pid = 1 c) Ordinary user process with pid = 2 D) Ordinary user process with pid = 1. 15. The privilaged instruction executed in kernel mode is? a) INT X b) IN X c) MOV A B d) CALL X. ans: INT X 16. A program written using one of the following datastructures results in minimum page faults.? a) Stack b) Hash Queue c) Priority Qs d) Priority Lists. ans: c 17. Code sharing is not possiblein ? a) Partion based memory management. b) Paged memory management. c) segmented memory management d) Demand Paging memory management. 18. Virtual memory is implemented by ? a) Simple paging b) Demand paging c) Static Partioned Memory management d) Dynamic Partition memory management. 19. Procedure sharing is possible in? a) segmented b) paging c) demand paging d) partition. 20. In unix, file is a - ? a) sequence of bytes. b) sequence of bits c) sequence of 8 bit bytes. d) sequence of chars. 21. Windows NT is designed as ? a) RISC b) CISC c) Both RISC and CISC d) None of the above. ans: b 22.Windows NT supports? a) symmetric b) assemetric c) both symmetric and assemetric d) 23. Windows NT is designed on ? a) 16 bit os b) fully 32 bit os c) 48 bit os d) 64 bit os. ans: b 24. Windows NT uses ? a) 16 bit priority levels. b) 32 bit priority levels c) 48 bit priority levels d) 64 bit priority levels. ans: 25. What is the unit of scheduling in Windows NT? a) process b) program c) thread d) system call. ans: c 26. Windows NT 5.0 supports? a) FAT 16 and NTFS b) FAT 32 and NTFS c) Only NTFS d) Only FAT 32. ans: b 27. In Windows NT, under Pentium architecture, DOS runs in a) Real mode b) Protected mode c) Paging mode d) Virtual 86 mode. ans: d 28. A graphics file is stored as a) ASCII file b) EBCDIC file c) bit map d) UNI code. ans: c 29. Which of the following OS may run POSIX, DOS and OS2 application? a) Windows NT b) Windows 98 c) Windows 95 d) UNIX. 30. ISQL is? a) front end program for oracle b) backend program for oracle c) server program for oracle d) GUI program for oracle. ans:d 31. Central mechanism of Microsoft's DCOM protocol is? a) Local Procedure call b) Remote procedure call c) Multi programming d) Multithreading. 32. Web client talks to web server through? a) TCP port 80 b) TCP port 21 c) UDP port 80 d) UDP port 1. When and in what condition a destructor is called?

There is only one destructor exists for a class. There can be two condition when the destructor is called. When attempt is made to delete the object and when user closes

Page 26: Interview Question Collection for Amdocs

the application. When the application is being closed, all the objects are being deleted first and destructor corresponding to all the objects are called.

2. When does a programmer need a virtual destructor? A good design should provide scope to override the destructors of all the classes. Destructor is the function that controls Pure virtual function and Abstract class: Pure virtual functions are the functions that are not being implemented in the class where it is being defined. An abstract class is a class that contains one or more than one pure virtual functions.

What is the return parameter of a constructor and why? Constructor in never being called directly. It is being called automatically by the compiler when an object in being created (or copied). Hence it can’t return any parameter. Logically thinking, if it would have been made to return a parameter, how do we put the code to create an object?

Are the “default constructor” and “constructor with default parameter” same? Default constructor is a constructor, which can be called with no argument. So a constructor with all the parameters as default argument can be called as default constructor. A constructor with one or more default parameters (but not all the parameters) can be called “constructor with default parameter” but that won’t be the default constructor. If a constructor with no argument and a constructor with all default arguments are being implemented then object-creation will generate an ambiguity regarding which constructor is to be called. Destructor : Destructor function can be treated as the inverse of constructor functions. They are called when objects are destroyed (de-allocated) or program exits from application. Designate a function as a class’s destructor by preceding the class name with a tilde (~). There are several FAQs that a programmer comes across, some of which are explained below: Does a class provide default Copy Constructor? Yes! The default copy constructor is being provided automatically by the compiler if not implemented separately. In this, it puts the code for coping the data members and other variables that stay in stack. If something is being created by malloc or new in the heap, those are not being copied by the default copy constructor provide by the compiler. 2. What does a default Copy Constructor do?

A default copy constructor is being provided by the compiler, when an attempt to copy an existing object is made. In this case the control goes to the default copy constructor. It generates a new object, and makes the values of data members of the new object which are in the stack, same as the parent object. It doesn’t copy the variables that are created in the heap. Simply speaking, a compiler supplied default copy constructor doesn’t take care of the things in an object, that are being created using malloc/calloc or new. 3. Can a program have a virtual constructor?

Generally we don’t need an overridable constructor. So constructor should not be declared as virtual. But in a class, we can make a static method, which will call the private/protected constructor and create an object. In that case the constructor is called as virtual constructorConstructors and Copy Constructor: Constructors are special type of member function in a class which has the same name as the class itself. Constructor with no parameter is called default constructor. Any number of constructors can be declared and overloaded. Copy Constructor is a typical overloaded constructor that can accept a single argument of reference to same class type. The significance of this specific constructor is pretty high in the OO design aspect. There are several FAQs on this topic some of which are described and explained below. What is the virtual destructor.

When and why do you need it? (Be surprised if you are not asked this question!) Destructor implemented by declaring a base class's destructor with the keyword virtual. A virtual destructor ensures that, when delete is applied to a base class pointer or reference, it calls the destructor implemented in the derived class, if an implementation exists.