Monday, August 30, 2010

Powerbuilder interview question _ part 5

1. What is PowerBuilder?
PowerBuilder is a powerful Windows-based professional client/server application development tool, which allows teams of developers to quickly and easily build sophisticated, graphical applications with access to database information stored locally or on networked servers.

2. What are PowerBuilder features?
A set of tools, known as painters, that provide a graphical point-and-click environment for creating windows, menus, and other objects and for database administration.
• A powerful scripting language, PowerScript, for building event-driven applications.
• Support for all Microsoft Windows objects and Visual Basic custom controls.
• A custom Windows object, the DataWindow object, for database manipulation and reporting.
• Open integration with configuration control tools, such as PVCS.
• Support for Dynamic Data Exchange(DDE), Dynamic Link Libraries(DLL),
and Object Linking and Embedding(OLE).
• Support for importing and exporting popular file formats.
• Extensive on-line help.
3. What are PowerBuilder benefits?
PowerBuilder allows an application developer to:
- Quickly develop object-based windows database applications without coding in C or C++.
- Take advantage of client/server architecture.
- Create attractive, easy-to-use applications taking full advantage of Graphic User Interface (GUI) (GUI) design principles.
- Create applications that can be independent of the database management system being used.

4. What is the strongest and weakest points of PowerBuilder?
Strongest :
1. DataWindow.
2. Inheritance
3. Encapsulation
4. Polymorphism
Weakest :
1. Bad performance
2. Not fully Object-Oriented.
5. What are PowerBuilder applications?
PowerBuilder applications are object-oriented, event-driven applications that execute within Windows, typically within a client/server architecture.

6. What are Windows?
Windows is an operating environment that uses graphics and symbols as a Graphic User Interface (GUI) between the user and the operating system. This interface enables you to select and execute commands by using a mouse to point to and click on illustrations, symbols (icons), or data.

7. What is a menu bar?
To navigate in Windows, you can also select options or activities from a menu bar that run across the top of the window. This menu bar contains items such as File, Edit, Help. By clicking on the item on the menu bar, you access pull-down menus that list more options or commands for an activity.

8. What is Event-driven processing?
In a PB application, the user is responsible for the sequence of processing that takes place, not the programmer. The processing is dependent on the action that the user takes(“event-driven”). Processing can be associated with the application, a window, or objects in a window.

9. What is Object-oriented development?
Object-oriented development views the analysis, design, and implementation of systems from the perspective of objects, which have specific collections of attributes and events.

10. What is object?
Object is an application component that combine characteristics and behaviors. The characteristics are called attributes. The behaviors are called events. Well-designed object is discrete, self-contained package. Often it knows nothing about other object except its name. Objects communicate with one another through messages.
PB applications are developed by combining objects of the following types:
• Application
• Window
• DataWindow
• Function
• Menu
• Query
• Structure
• User Object

11. What are attributes?
Attributes are characteristics of objects. The combination of an object’s attributes primarily defines what the object looks like, but some attributes also prescribe or limit its behavior.

12. What is an event?
An event is the component of an object that permits it to recognize and respond to a Windows message. In PB you write scripts, as needed, to describe the processing that should occur in response to the message. Events often form the connection between the objects in an application system.

13. What is an application object?
An application object is an entry point into an organized collection of windows and other objects that perform these activities. It is a non-visual object that maintains default values for various high-level characteristics or features of the application.

14. What are window objects?
Window objects are visual objects that provide the main interface between the user and PB applications. Windows can display information, request it from a user, and respond to mouse or keyboard actions.
Controls are objects that you place in a window to allow the user to interact with the application. You use different controls for different purposes. For example, some controls may display data, others accept and validate user input, and still others act upon input, such as responding to a mouse click.

15. What is a menu?
A Menu is a visual object that provides the user with lists of commands, or alternate ways of performing a task. The individual commands or options are known as menuitems.

16. What is a DataWindow object?
A DataWindow object is an intelligent object unique to PB, combining data access intelligence with an user interface. You may use DataWindow objects whenever your applications need to display or capture data.

17. What is a query?
A query is a non-visual object consisting of a SQL statement that you associate with a DW object to indicate its data source. Queries enhance developer productivity, since they can be coded once but reused as often as necessary. Thus, they provide flexibility in the development of DW objects.

18. What are user objects?
User objects are custom objects that you build. They typically consist of one or more standard PB objects, with scripts written for particular events to perform processing used frequently in your applications. After you build an UO, you can use it in your applications as you would any PB object. The processing encapsulated in user objects is often generic; thus when you use the UO in an application, you make its processing specific to the application by modifying or extending the scripts for the events in the UO. User objects can be visual or non-visual. They can display information, request it from an user, and respond to mouse or keyboard actions. They extend, enhance, or otherwise customize standard built-in objects and their behaviors.

19. What is a function?
A function consist of a set of PowerScript statements that performs some type of processing and returns a value. There are two types of functions within PB:
• Object-level functions
• Global functions, that is, function objects
Object-level functions, such as a window function, are encapsulated within the object for which they are defined.
Global functions are independent objects, they are not encapsulated within some other object.
Both types of functions may be called from scripts for any other object in an application, however, they are called in different ways.

20. What is a structure?
A structure is a collection of one or more related variables of the same or different data types grouped under one name. Used in scripts, structures allow you to refer to related objects as an unit rather than individually. In some languages, for example Pascal or COBOL, structures are called records.

21. What is a painter?
A painter is a graphical tool within PB that you use to create a PB objects.

22. How can you configure your toolbar?
You may configure your PainterBar and the PowerBar in several ways:
• Choose Toolbars... from the Window menu; the Toolbars response window appears.
• Click the right mouse button on the toolbar to display the popup menu of options.
Both methods provide the same options.

23. Where are PB objects stored?
PB objects are stored in PB library files (.PBL).

24. Which of the following can be PUBLIC?
-function -Yes
-script
-instance variable
-window
-application

PowerBuilder

25. Why is PowerBuilder a client/server application development tool ?
Because PowerBuilder Applications request services from a server Database through SQL statements.

26. What is event-driven processing ?
The user is responsible for the sequence of processing that takes place, not the programmer. The processing is dependent on the action that the user takes (“event-driven”)

27. What is Object-Oriented?
You can say that the programming language is object-oriented if it has 3 main features:
1. Inheritance.
2. Encapsulation.
3. Polymorphism.
PowerBuilder has all of these features.
It speeds up the development process and improves code quality and efficiency.

3.What two qualities do all objects have?
Attributes are the characteristics of objects, which collectively define an object’s appearance.
Events are the components of an object that permit it to recognize and respond to a Windows message.

4.List at least four of the eight PowerBuilder objects.
Application object
Queries
Windows
User objects
Menus
Functions
DataWindow objects
Structures




What is a painter ?
A painter is a graphical tool within PB that we use to create a PB object.

6. What is the Power Panel? What is Power Bar?
They are a collection of icons through which we have an access to a painter.

7. Where are all PowerBuilder objects stored?
PowerBuilder objects are stored in PowerBuilder library files. Many different objects may be stored in the same library.

8. What is Client/Server architecture?
Client/Server architecture is when an application requests services from a server DB through SQL statements. DB can be located anywhere once the data requested has been passed to the client processing takes place at the client level. The data available to many users but processing takes place locally.

9. Where in PowerBuilder can you do interactive SQL?
-database painter in data manipulation
-DataWindow painter
-query painter
-script
PART 1

9. What is new in PowerBuilder 5.0?
Windows 95 controls
compiled code
new DataWindows
event can have value and return value using return keyword
Function can be overloaded.
may not use SetActionCode( ) function – became RETURN
new syntax for Modify( )
Class Library (pfc)—PowerBuilder Foundation Class Library
Functions that became obsolete:

Instead of New in PB5 Event
SetActionCode return n Clicked
DB Error
ItemChanged
ItemError
Print Page
RetrieveRow
Retrieve Start
Update Start
Get SQL Preview() SQL Syntax
DB Error
SQL Preview

GetUpdateStatus(r, buff) r = row DB Error
ec=DBErrorCode() SQLDBCode DB Error (it also became an Object
argument in Transaction)
DBErrorMessage() SQLErrorText DB Error
GetClickedColumn() IF dwo.type="column"
THEN c = integer(dwo.ID)
ELSE c=0
END IF Clicked
Double Clicked
GetMessageText s = text Custom Event for
pbm_dwnmessagetext
GetClickedRow() r = row Clicked
Double Clicked
3. What is an object? a class? an instance? Class is a group of objects that have common characteristics and behavior Object is an instance of the class. Instance is a copy of an object in memory. When we declare copies of window class in PowerBuilder, we are declaring window instances. The instances do not actually exist, however, until we open them. The window definition simply indicates what the window will look like, once it is instantiated (opened).
Is PowerBuilder an object-oriented language? Why?

Yes. You can say that a programming language is object-oriented if it has 3 main features:
Inheritance.
1. Encapsulation.
2. Polymorphism.
PowerBuilder has all of these features. PB is a Client/Server application development tool, which allows us to build a new graphical appl. with access to the DB that could be stored locally or at network system.

5. What is an object? (Encapsulation)
An object is a collection of variables programmed and packaged together as a single, self-contained unit. The contents of an object are protected from the outside world. The program-ming inside the object can see and change the variables, but no programming outside the object can do so. The programming inside the object is similarly protected: programming outside the object can execute the object’s programming only under strictly limited conditions. In a PB application everything is an object: a window, a button, a DW, a transaction object. A window, for example, is an encapsulation of variables and programming. The variables in the window object describe the window: its size, position, the text in its title bar, whether it has maximize and minimize buttons… The programming in the window object can perform such tasks as max, min, moving, and resizing the window. A button is an object. It is an encapsulation of variables and programming. The object’s variables describe the button…A DW is an object. Actually, there are two kinds of DW objects: the object created with the DW painter—named “DW Object”, and the DW Control which is the control object on a window. Each of these objects is an encapsulation of variables and programming, and they work together to provide the DW functionality in an application. A Transaction Object (e.g. SQLCA), is an object. It is a special PB variable that connects to a DB and serves as the interface between your scripts and the DB. A Transaction object is different from other PB objects in that it is a non-visual object.
EMBEDDED SQL

1. How do we refer to the PB variables inside SQL statements?
We have to precede them by colon, for example: Insert into Employee (salary)
Values (:sal_var)

2. How do we use SELECT statement in PB?
If we expect only one row to in our Result Set, we use single SELECT, for example:
Select employee Emp_lName, employee EMP_FNAME
into :sle_LNAME.text, sle_FNAME.text
from Employee
where Employee EMP _nbp=:Emp_num
If we expect multiple rows we use cursor statements. Declare cursor as a select statement, then OPEN the Cursor and then fetch rows(with fetch statement). Usually we do fetching
in the LOOP while SGLCA.SQLCODE=0

No comments:

Custom Search