Thursday 29 January 2015

Interview Questions for Pascal Programming(Part5)

21. What are the Borland Pascal Products
 Ans: In essence, Borland Pascal is the 'professional' product, whilst the
Turbo Pascals are 'hobbyist' products.
Current Versions are (excluding fixes):
Borland Pascal 7 (Dos/Win/Prot)
Turbo Pascal 7 (Dos)
Turbo Pascal for Windows 1.5 (Win)
There is an update to TP and BP to v7.01. This can be obtained by
contacting Borland. These still have VER70 defined.
Borland Pascal can do everything that both Turbo Pascals can do, plus:
 . Compile for 16 bit DOS Protected mode (less memory constraints)
. Full Run Time Library Source code
. Lots of assorted debugging and programming tools

22. Is there a way to run my Pascal programs in parallel?
 Ans: There is indeed, but it's not going to be easy. One way of "parallelizing" your programs is to include "message passing" in the code. Different portions of the code are thereby executed by different processors, and information is shared by passing messages between the processors. The most widely used method to do this is called Message Passing Interface (MPI), and is available in the form of libraries on the SUN Fire muti-processor machines of HPCVL. However, MPI works only with FORTRAN and C directly. The libraries consist of subroutines that can be called from code written in those two languages. In order to write parallel code in Pascal, you therefore have to do the following things.
* Write your code in a "single code multiple data" manner by inserting calls to message-passing functions. The interface with these functions will have to be designed by you.
* Implement the message-passing functions in C and use the C-bindings of the MPI library inside of those functions.
* Compile your Pascal routines with GPC, and your C-routines with the native C-compiler to produce object code. Include the proper header files in the C functions via the "-I" option. Collect the C-functions in a library using the ar command.
* Link the object code with GPC, including the C-functions in the form of a library. MPI is linked in by specifying "-l", "-L", "-R", and "-I" options.

23. What is the Pascal compiler used on HPCVL machines?
 Ans: The Pascal compiler installed on the Sun Fire system of HPCVL is the Gnu Pascal Compiler (GPC). This is a public-domain compiler that has a great deal of extensions and compatibility features built into it, and is designed to be very portable. The versions are at present:
GNU Pascal version 20000707, based on gcc-2.95.2 19991024 (for SUN Sun Fire).
This compiler supports ISO-7185 Standard Pascal and ISO-10206 Extended Pascal, as well as Borland Pascal 7.0 and parts of Pascal-SC. For more detailed specifications which features are available, see the the language specification page of GPC. GPC is located in the /usr/local directory hierarchy. It makes use of some features of the Gnu C Compiler (GCC) and therefore needs access to libraries and header files from that distribution. Its close relationship with GCC also enables it (to some degree) to use the GNU debugger

24. How do I run gpc?
 Ans: This FAQ is not meant as a manual for the GNU Pascal Compiler. The usage of the compiler is very straightforward, though. The command gpc is used both for compiling and linking the programs. For linking, it will invoke the system-supplied ld feature with the appropriate switches and environment variables. To use GPC you have to have to have "/usr/local/bin" in your PATH. It might in some cases be necessary to set the system environment variable LD_LIBRARY_PATH to "/usr/local/lib:/usr/lib" in order for your executable to find the proper dynamic libraries at runtime. GPC uses command-line options to guide the compilation. These options are often very standard, such as -c to avoid linking and produce only object files, -O# to specify optimization levels, -o to specify the name of the output (executable of object) file. Almost all options are documented in HTML format. For a complete list, obtain the GNU Pascal Manual . There are no useful Unix man pages for this compiler. Because of its close relationship with the GNU C-compiler GCC, almost all of the options that are available for the latter are also part of the Pascal compiler command set. Another effect of this is that there is usually no problems with using C-routines in conjunction with the Pascal compiler. This comes in handy when you are trying to compile Pascal programs to run in parallel mode on a multi-processor system

25. Why Pascal?
 Ans: Pascal is a computer language that was designed for teaching purposes. It makes extensive use of function and subroutine calls and allows code do be written in a very "readable" manner. Pascal is one of the precursors of the arguably most successful programming language C. Many people learned programming with Pascal, and a good deal of code exists that was written in this language. In recent times, Pascal has been extended a great deal, and with those extensions, the language can compete with more modern programming languages such as C/C++ or Java. We provide a Pascal compiler to enable those of our users who have "legacy code" in Pascal, or want to use modern programming techniques without having to learn a new programming language. However, Pascal is not supported as such by Sun/Solaris or IBM/AIX, i.e. there is no native Pascal compiler for our systems. Instead we use a portable public-domain compiler.
More Questions & Answers :-

No comments:

Post a Comment