-
Justify “Delphi is an object oriented language”
Delphi supports all object oriented language features. Namely Data Encapsulation, Inheritance, Polymorphism
-
Explain different segments of a Delphi unit
-
Unit <UnitName>
-
Interface uses clause
-
Interface
-
<Type Declarations>
-
Implemenation uses clause
-
Implementation
-
Initialization
-
Finalization
-
End
Unit name, interface uses Clause (list of units go here) Interface section goes here, implementation uses (list of units go here) Implementation section goes here, initialization (Initialization goes here), finalization (Finalization goes here).
-
Explain the time at which initialization code of unit will be executed
It will be automatically called in the order in which this unit is included
In the uses clause.
-
What is circular reference
For example let us suppose that, if in ‘Unit1’s interfaces use clause’ ‘Unit2’ is included and in ‘Unit2’s Interfaces use clause’, ‘Unit1’ is included. This will lead to circular reference.
Starting from the interface section of a unit, it must never be possible to return to that unit by following references through interface sections of other units
-
What is the difference between abstract class and interface
In abstract class you can declare variable for data storage, In Interface cannot declare variables but can declare properties.
Can create instance of the class, Cannot create any instance of interface.
Class is not reference counted, Interface is reference counted.
All functions and procedures need to be marked with the virtual, abstract directive, By default all function and procedures are virtual abstract.
Can specify the access level, In interface by default public.
-
What is multiple & multilevel inheritance
If Class1 is base class Class2 derived from Class1 and Class3 is derived from Class2 this is called Multilevel Inheritance.Class1, Class2 is base class and Class3 is derived from this classes means Multiple inheritance
-
what is overloading, can two functions can be overloaded where you have difference in the return type only
Two functions or methods is having same name with different parameter signature that is called overloading. No, if return type is different then overloading is not supporting in Delphi.
-
Difference between parent & owner
Parent is the immediate ancestor of a component. It provide context to draw the control.
Owner is the container of all components. It is responsible to free the owned object once it destroys.
-
What is COM
COM stands for Component Object Model. Basically, the Component Object Model is a technology that defines a standard way for a client module and a server module to communicate through a specific interface. Here, module indicates an application or a library (a DLL); the two modules may execute on the same computer or on different machines connected via a network.
-
What are the three functions available in IUnknown
-
_Addref
-
_Release
-
QueryInterface
-
What is the known as reference counting
Every time you retrieve an interface to an object, e.g. IMyInterface: = MyClass; Delphi will automatically increment its reference count using IUnknown's _AddRef function. When an interface falls out of scope, Delphi automatically calls IUnknown's ._Release function.
-
Explain the functionality offered by Query Interface function
The QueryInterface method handles the type information and type compatibility of the objects. QueryInterface usually returns a pointer to the object, using its reference output parameter
-
What is IDispatch interface
Technically, supporting Automation in COM implies implementing the IDispatch interface.
-
GetTypeInfoCount
-
GetTypeInfo
-
GetIDsOfNames
-
Invoke
The first two methods return type information; the last two are used to invoke an actual method of the Automation server.
Actually the invocation is performed only by the last method, Invoke.
GetIDsOfNames is used to determine the dispatch id (required by Invoke) from the method name. When you create an Automation server in Delphi all you have to do is define a type library and implement its interface.
-
Explain static binding and late binding
Methods are by default static. When a static method is called, the declared (compile-time) type of the class or object variable used in the method call determines which implementation to activate.
To make a method virtual or dynamic, include the virtual or dynamic in its declaration. Virtual and dynamic methods, unlike static methods, can be overridden in descendant classes. When an overridden method is called, the actual (runtime) type of the class or object used in the method call - not the declared type of the variable - determines which implementation to activate. To override a method, redeclare it with the override. An override declaration must match the ancestor declaration in the order and type of its parameters and in its result type (if any).
-
Is it possible to initialize a variable while declaring
No, Using const can initialize
-
How we can do a batch update
Using ClientDataset apply updates. Client datasets are specialized datasets that hold all their data in memory. The support for manipulating the data they store in memory is provided by midaslib.dcu or midas.dll. The format client datasets use for storing data is self-contained and easily transported, which allows client datasets to read from and write to dedicated files on disk, acting as a file-based dataset.
-
What are the different db controls used
TDBEdit, TDBGrid, TDBText, TDBCombobox etc.
-
Explain the technical architecture of the product
Mirador is three tire application.
-
Which all third party components were used
ttsGrid(TopGrid), HTML Viewer
-
What is passing by reference
When a variable is passed into a function, the reference of the variable can be passed or a copy of variable can be passed. If changes made to the variable is required for caller, then passing by reference should be chosen.
-
Explain VCL hierarchy of TEdit
TObject -> TPersistent -> TComponenet -> TControl -> TWinControl -> TCustomEdit -> TEdit
-
Are there any properties for TObject
No
-
Difference between TObject & TPersistent
The TObject branch includes all VCL and CLX classes that descend from TObject but not from TPersistent. Much of the powerful capability of the component library is established by the methods that TObject introduces. The ability to respond when object instances are created or destroyed. Class type and instance information on an object, and runtime type information (RTTI) about its published properties. Support for handling messages (VCL applications) or handling notifications (CLX applications).
The TPersistent branch includes all VCL and CLX classes that descend from TPersistent. Persistence determines what gets saved with a form file or data module and what gets loaded into the form or data module when it is retrieved from memory. Because of their persistence, objects from this branch can appear at design time. However, they can't exist independently. Rather, they implement properties for components. Properties are only loaded and saved with a form if they have an owner. The owner must be some component. TPersistent introduces the GetOwner method, which lets the Form Designer determine the owner of the object.
-
Difference between TWincontrol and TGraphicalControl
Every TWinControl object has a Handle property which provides the window handle for the underlying Microsoft Windows screen object. Use the Handle property to bypass the VCL API and directly access the underlying window.
TGraphicControl supports simple lightweight controls that do not need the ability to accept keyboard input or contain other controls. Since lightweight controls do not wrap Windows screen objects, they are faster and user fewer resources than controls based on TWinControl.
TGraphicControl provides a Canvas property for access to the control's drawing surface and a virtual Paint method called in response to paint requests received by the parent control.
-
What is the difference between Component and a control class
Every component is a class derived from TComponent, from one of its more specialized descendants (such as TControl or TGraphicControl), or from an existing component class. The section Creating components describes which class to derive different kinds of components from.
A simple component class is a nonvisual component descended directly from
TComponent.
-
What is the difference between Public & Published
Public directive denotes fields and methods that are freely accessible from any other portion of a program as well as in the unit in which they are defined.
A published field or method is available not only at runtime but at design time too. They have same visibility as that of public members. Infact, every component in Delphi component’s palette has a published interface that is used by some Delphi tools, in particular, the object inspector. A RTTI (run-time type information) is generated for published members, which allows an application to query the fields & properties of an object dynamically and to locate its methods. RTTI is used to access the values of properties when saving and loading form files, to display properties in the Object Inspector, and to associate specific methods (called event handlers) with specific properties (called events).
-
What is the difference between Free & Destroy
Destroy is the virtual destructor and does not check for object reference. An object should not call destroy directly instead it should call Free, which in turns call destroy to deallocate the memory. Free check for object reference before calling destroys for the object.
-
What is the role of type libraries
Type libraries are the interface to communicate with COM server. Client application can use them for static binding.
-
How do we create a COM Application
We have 2 ways to create com application…
-
Static binding – using TLB file
-
Late binding – using OLEVariant datatype
-
What is the difference between in-process and out-of process servers
A library (DLL) running in the same process space as the client, for example, an ActiveX control embedded in a Web page viewed under Internet Explorer or Netscape. Here, the ActiveX control is downloaded to the client machine and invoked within the same process as the Web browser. The client communicates with the in-process server using direct calls to the COM interface.
Another application (EXE) running in a different process space but on the same machine as the client. For example, an Excel spreadsheet embedded in a Word document is two separate applications running on the same machine. The local server uses COM to communicate with the client.
A DLL or another application running on a different machine from that of the client. For example, a Delphi database application is connected to an application server on another machine in the network. The remote server uses distributed COM (DCOM) to access interfaces and communicate with the application server.
-
What is meant by COM+ application *
They are used for transaction servers; frankly I did not find any difference.
-
What is MTS
Delphi uses the term transactional objects to refer to objects that take advantage of the transaction services, security, and resource management supplied by Microsoft Transaction Server (MTS) (for versions of Windows prior to Windows 2000) or COM+ (for Windows 2000 and later). These objects are designed to work in a large, distributed environment. They are not available for use in cross-platform applications due to their dependence on Windows-specific technology.
-
What is OLE
Object linking and embedding. OLE lets you copy data from a server application to a client application, along with information regarding the server or a reference to information stored in the Windows Registry. The raw data might be copied along with the link (object embedding) or kept in the original file (object linking).OLE Controls and interface (lightweight controls) are then used as ActiveX controls for distribution over the internet.
-
What is Activex
An ActiveX control is a software component that integrates into and extends the functionality of any host application that supports ActiveX controls; it can also be deployed on web.
-
What is the difference between process and threads?
Executing instance of a program at any given time is called process.
Currently executing instance of process is called thread.
-
Protected variables
They can be access in the sub class.
-
What is polymorphism?
The concept of using operator and function in different way depending on what they are operating on is called polymorphism. Its of 2 type
Static polymorphism – exhibit by overloaded function
Dynamic polymorphism – exhibit by late binding (Virtual/Dynamic)
In polymorphism, a derived class method can have the same name as that of the base class's method but can have different implementation unlike base class methods. The method name and the signature both should be same in the base class & derived class. The base class's method declaration is followed with virtual or dynamic directive and the derived class's method declaration is followed by the override keyword to qualify for polymorphism.
-
What is Data encapsulation and Data abstraction?
Data encapsulation is preventing access to non essential details where as Data abstraction is delaying the implementation to the sub class.
-
What is the base Library in Delphi?
Visual Component Library is the base Library
-
What is the Pointer and Reference number?
A pointer is a variable that denotes a memory address. When a pointer holds the address of another variable, we say that it points to the location of that variable in memory or to the data stored there. In the case of an array or other structured type, a pointer holds the address of the first element in the structure. If that address is already taken, then the pointer holds the address to the first element.
Pointers are typed to indicate the kind of data stored at the addresses they hold. The general-purpose Pointer type can represent a pointer to any data, while more specialized pointer types reference only specific types of data. Pointers occupy four bytes of memory.
-
What is forward declaration?
If the declaration of a class type ends with the word class and a semicolon with no ancestor or class members listed after the word class - then it is a forward declaration.
Ex: type classname = class;
-
What is the difference between TList and TObjectList?
TList stores an array of pointers, TObjectList maintains a list of (owned) objects.
TList, which stores an array of pointers, is often used to maintain lists of objects. TList introduces properties and methods to add, delete, rearrange, Locate, access and sort objects in the list.
TObjectList to store and maintain a list of objects. TObjectList provides properties and methods to add, delete, rearrange, locate, access, and sort objects. If the OwnsObjects property is set to true (the default), TObjectList controls the memory of its objects, freeing an object when its index is reassigned; when it is removed from the list with the Delete, Remove, or Clear method; or when the TObjectList instance is itself destroyed
-
How can you add an object to TStinglist object?
TStringlist maintains the list of strings. The TStringList object does not own the objects you add this way addobject. Objects added to the TStringList object still exist even if the TStringList instance is destroyed. They must be explicitly destroyed by the application.
45. CompareMem
This performs a binary comparison of two memory images. CompareMem performs a binary compare of Length bytes of memory referenced by P1 to that of P2. CompareMem returns true if the memory referenced by P1 is identical to that of P2.
46. Try except (Exception is the base class)
Exceptions are handled within try...except statements
A try...except statement executes the statements in the initial statements list. If no exceptions are raised, the exception block (exceptionBlock) is ignored and control passes to the next part of the program.
If an exception is raised during execution of the initial statements list, either by a raise statement in the statements list or by a procedure or function called from the statements list, an attempt is made to "handle" the exception:
If any of the handlers in the exception block matches the exception, control passes to the first such handler. An exception handler "matches" an exception just in case the type in the handler is the class of the exception or an ancestor of that class.
If no such handler is found, control passes to the statement in the else clause, if there is one.
If the exception block is just a sequence of statements without any exception handlers, control passes to the first statement in the list.
47. Compiler Directives
A compiler directive is a comment with a special syntax. Its like SWITCH that turn particular compiler features on or off. For example, you can make the same application compiled to support win16 bit and win32 bit. Or interbase and SQL server.
A compiler directive starts with a $ as the first character after the opening comment delimiter, immediately followed by a name (one or more letters) that designates the particular directive.
48. Initialization
To initialize variable at the start of unit. Eg. Change the Locale settings of the program.
49. Finalization
To release the allocated memory in Initialization section, finalization is used.
50. What is the Inheritance?
The process of creating new class called the derived class from the existing class called the base class is called Inheritance.
51. Calling convention
REGISTER, Pascal, Cdect, Stdcal, safecal
52. What is the difference between Dynamic and virtual?
Both are late binding. They are semantically equivalent. They differ only in the implementation of method call dispatching at run time.
53. Overload / override / reintroduce
A method can be redeclared using the overload directive. In this case, if the redeclared method has a different parameter signature from its ancestor, it overloads the inherited method without hiding it.
Overriding a method means extending or refining it, rather than replacing it. A descendant class can override any of its inherited virtual methods.
To override a method in a descendant class, add the directive override to the end of the method declaration.
The reintroduce directive suppresses compiler warnings about hiding previously declared virtual methods.
For example,
procedure DoSomething; reintroduce; // the ancestor class also has a DoSomething method
Use reintroduce when you want to hide an inherited virtual method with a new one.
54. What is Type casting?
Changing one data type to another data type.
55. How many Joints are there?
Three type of joints. Inner, Left and Right Joints
56. Lock
Pessimistic Lock: Ensure that no two user can edit the same resource at the same time.
Optimistic Lock: Any user can supersede any other user’s change.
57. SQL Server Lock
Share Lock: for the operation that don’t change the data. Eg “Select * …”
Exclusive Lock: For data manipulation operation. For eg Update, Delete etc
Update Lock: For update
58. Lock Level
Key, Record, Table and Database
59. How can you unlock lock?
Using UNLOCK command.
60. What is the Identity column?
Identity column is auto increment field it create unique row identifiers.
61. How will you reset identity field?
Drop the field and recreate it else using Alter command.
62. What is Constraint?
CHECK constraints ensure that column values are valid.
63. RTTI operator?
IS and AS. IS using for checking. As using for type casting
64. What is trigger?
Triggers are like store procedure, that automatically get called for specific data base operation like Insert, Update and Delete.
65. What about constrains and triggers?
I have constrains in column (Age) should be less than 100 and same thing can done with trigger.
66. How will you trouble shoot performance in SQL server?
Trace, stopper, which set of query is taking time, normalization/additional index are required/query has to be fine tuned/joins/execution plan
67. What is referential integrity?
Referential integrity ensures that all foreign key should have matching records in the primary key. Referential integrity indicates that the
Relationships between tables have been properly maintained. Data in one table should only point to existing rows in another table; it should not point to rows that do not exist.
68. What are the types of Temp table?
#Tablename, ##Tablename
69. FK/ PK Indexes (Transactional table)
Rowsize in byte 8kb per row; warning for performance Functional store procedure and normal store procedure (out put parameter) you can part of query returns recordset, SP don’t returns recordset A function can be use as part of query.
-
Can you explain about COM
COM is a specification as implementation.
Two software modules which are independent can communicate with each other, if it follows COM Specification. So Every COM Application contains three Major parts.
1. COM Server
2. COM interface
3. COM Client
COM Interface gives provision to establish the communication path.
COM Server implements all functionalities declared in the specification.
COM Client consumes functionalies exposed by server.
Mirador & Connector
--------------------------
LogServer is a COM Server
Plug-in in this case considered as COM Client
TaskBroker dll is a COM Server
Plug-in in this case considered as COM Client
-
How can create COM application?
First create a DLL.
Then Create a COM Object using Wizard
Then Give specification of the com server using type library editor
Then Implement functionalities
Then Register COM Server using regsver32.
COM Server is ready!
72. WHAT IS lOCATE AND FIND IN DELPHI?
Refer Tquery - To identify record in a dataset.
-
What is class method, give an example for a example for a class method in Delphi?
A class method can be called through a class reference or an object reference. When it is called through an object reference, the class of the object becomes the value of Self.
-
Have you worked with ClientDataset? And How u will connect to database?
Yes. TClientDataSet represents an in-memory dataset
-
A fully-functional, stand-alone, file-based dataset for single-tiered database applications.
-
A local in-memory buffer of the records from another dataset.The source dataset can also reside on a separate system when the client dataset supports the client portion of a multi-tiered database application
-
What is the difference between variables in interface and implementation section?
Variables declared in interface section can be access from other units provided this unit should be included in the uses clause.
Variables decalred in implementation section can be accessed with in the unit.
-
What is property?
A property, like a field, defines an attribute of an object. But while a field is merely a storage location whose contents can be examined and changed, a property associates specific actions with reading or modifying its data
-
What is known as method handler?
An event is a link between an occurrence in the system (such as a user action or a change in focus) and a piece of code that responds to that occurrence. The responding code is an event handler, and is nearly always written by the application developer. Events let application developers customize the behavior of components without having to change the classes themselves. This is known as delegation.
-
How good u r in debugging?
Good.
-
What is the use of Tdatamodule?
TDataModule centralizes the handling of nonvisual components in an application.
80. How can connect to Database using ADO Connections?
ADO Connections ADO QUERY Datasource Grid.
ClientDataset DataSetProvider ADO Query Connection
-
How do