Dear Readers, Welcome to Pascal Programing Interview Questions and Answers have been designed specially to get you acquainted with the nature of questions you may encounter during your Job interview for the subject of Pascal Programing. These Pascal Programing Questions are very important for campus placement test and job interviews. As per my experience good interviewers hardly plan to ask any particular questions during your Job interview and these model questions are asked in the online technical test and interview of many IT companies.
Pascal was named after the French mathematician Blaise Pascal, who created a calculating machine (not a true computer).
Pascal is one of a series of languages put forth by one of the most prolific computer language creators, Niklaus Wirth, a professor at Institut fur informatik, ETH, Zurich, Switzerland. Professor Wirth participated in various versions of Algol, a language put forth by international cooperation that introduced the basic concepts of structured programming to the world. Wirth terms Pascal as a descendant of Algol 60 (for Algol, 1960 standard). The "official" descendant of Algol 60 was Algol 68, famous for having assignment as an expression operator (a basic feature of the later language C). Wirth felt that the design committee for Algol, after Algol 60, was losing focus and creating an unnecessarily complex language.
While Algol W has had it's fans, the language Pascal was considered to be a new high of consistent language design. The first draft of Pascal was created in 1968. The first compiler was operational in 1970, and the language was generally published in 1971. In 1973, after two years of testing and use, the language was revised into it's final form. That was detailed by "The Pascal User Manual and Report".
Pascal is in the Algol family of languages. Algol, whose first version was called IAL or "International Algebraic Language", was the first language created by international committee. The resulting language was rather odd for its time. The committee had the goal of designing a unified computer language, but also saw Algol as a way to cleanly express computer algorithms, and so was not directly concerned with creating a practical language for compilation. That is, the language would serve a purpose even if it was only used for publishing algorithms, not running them.
This resulted in Algol not having many data types, or built in I/O. Also, Algol was generally free of the limits common to programming languages of that time, such as number of array dimensions. One of the goals of Algol was for it to be as close to mathematical notation as possible. In particular, Algol used a special operator for assignment, ':=', because '=' had a different meaning in mathematics.
The original Pascal standard was an unofficial standard documented by the author, Niklaus Wirth, in "The Report". The first official standard was ISO 7185 issued in 1983. This was followed by the extended standard, ISO 10206, in 1990. Another standard was the Object-Oriented Extension to Pascal. However, this standard was never finished, and was basically abandoned for lack of interest.
In 1989, ISO 7185 was revised to correct various errors and ambiguities found in the original document. This resulted in ISO 7185:1990.
There have been many implementations of Pascal, both those that follow and those that don't follow the ISO 7185 standard. For the most part, ISO 7185 was followed on large computer installations during the early days of Pascal (1973-1990), and some installations on microcomputers. The other dialect that became popular was the UCSD (University of California at San Diego) Pascal, followed by Borland's Turbo Pascal. Although there are virtually no current implementations of UCSD Pascal, Borland's products exist today for advanced IBM-PC compatibles under Borland's Delphi name.
When the IBM-PC became 32 bit with the introduction of the Intel 80386, virtually all of the 32 bit implementations of Pascal on the PC were ISO 7185 conforming. However, there was a large shakeout of compiler vendors in the early 1990's that removed many of these installations from the market.
A. IP is an interplatform Pascal. It supports the following platforms in its current configuration:
1. Windows/95/98/ME/NT/2000/XP.
2. Linux/86.
A port for Mac OS X is under way, and a port for Sun Solaris/Sparc is planned.
IP both provides, and itself is run, on a set of porting modules that allow IP, and its client programs, to run on any of the supported platforms without source change. To move within operating systems on the same machine type, only a relink is required. To move within different CPU based systems, a recompile and link is required.
A few Turbo Pascal "units" that aid program porting have been created, and these have shown to dramatically simplify porting from that language. Similar procedures will be used for other Pascals. However, these are just rapid porting aids, and these Pascals do not enjoy full language compatibility. There will always be a minimum amount of work required to change programs to work under IP. Further, porting using these units won't give you a program that takes advantage of the features of IP, and I consider it to be only a step in the process of fully porting a program to IP.
IPs main focus is to be a language that is not tied to any operating system or hardware, and IP will, therefore, always be unable to fully emulate the machine dependent features of many Pascal implementations. The failure of many Pascals that are single machine based has shown that the future lies in very portable Pascal languages and compilers.
ISO 7185 standard is the original language as created by N. Wirth, more precisely defined and more secure than the original. The standard makers refrained from making large improvements or extensions to the language. In fact, because Pascal is one of the most carefully designed languages and also one of the most carefully standardized, there is a high degree of ability to determine, unambiguously, if a given program construct is legal according to ISO 7185 rules.
Pascal, almost from the first of its use, was widely extended and changed. One reason for this may be that the language was also very popular in compiler classes, and tended to produce many experimental versions.
The original language, Pascal/1972 or J&W Pascal, has been around since 1972, standardized in 1982, and only minor changes were required to programs to bring them into compliance with it (see below). The basis of the language is still very strong, and the ISO 7185 standard is freely available. Further, there are many books written with the standard in mind.
A. IP Pascal was designed to follow the original Pascal standard since 1980, following Niklaus Wirth's "The Pascal User Manual and report" [Jensen and Wirth] from 1974. In 1983, the ISO 7185 standard was released, and the minor changes to J&W Pascal were implemented in IP Pascal.
Unfortunately, none of the Borland products followed either the "User Manual and Report" nor the ISO 7185 Pascal standard, even though it preceeded Borland® implementations by a decade. Borland® products have a large user base, and we respect that, and hope to provide tools to convert user's Borland® compatible products to IP Pascal for interoperation.
For IP Pascal to have been compatible with Borland® products, considerable changes away from standard Pascal would have been required. Also, since there is no official published Borland® language standard, there would be no way to guarantee perfect compatibility with Borland® products. Finally, IP Pascal is directed at a long term standard implementation. Borland® products have traditionally been machine and operating system dependent. The different Borland products, Turbo Pascal, Borland® Pascal, Borland® Windows Pascal, Delphi® and Kylix, are not completely compatible with each other, and would have been a moving target during the many years IP Pascal has been in operation.
IP was never coined to be a particular acronym. Present definitions are Internet Pascal, Intellectual Property Pascal, InterPlatform Pascal. The name IP Pascal was chosen to represent the flavor of today's machine and process independent design processes. As some of you may know, I am heavily involved in the networking industry. Internet Protocol was originally envisioned as a way to "bridge" different networks together. The principle was that one carefully constructed standard would be able to bridge any number of different networks together, and the overhead of a second level protocol would only be incurred once. This is much like saying that designing one standard plug, then designing a series of adapters to that plug from other plug types, can unify incompatible systems.
IP Pascal is definitely designed to do just that
No. IP Pascal originated in 1980. IP Pascal is used here in electronic integrated circuit CAD programs. IP Pascal was written as a core in assembly language, but the majority of the system rewritten in Pascal by 1985. In 1987, like many other developers, I moved to the IBM-PC and began using off the shelf standard ISO/ANSI compilers. By 1990, I started to have extensive problems with Pascal vendors not keeping up with changing technologies, and foresaw the fallout of many existing vendors from the market.
At that time, I made a decision whether I would stay with my extensive code base in Pascal, or move to a more generally accepted language, most likely C. I decided that I would stay with Pascal, and take back control of our compiler as it was abandoned in 1987. That work was completed in 1995, in time for the advent of Windows 95. Since that year, the platform for IP has been extensively expanded.
Unlike many commercial products, IP Pascal is not designed according to the "hit software" mentality. I use IP Pascal here, I am its first customer. Because of this, I won't be creating phone support for the product. IP Pascal will be supported by email, web site, and usenet forum without charges or restrictions. Emails will be typically answered within 48 hours.
Because this support model does not require hiring large support staffs (and then firing them later as demand decreases), there is no plans to limit or charge for support.
Recently, I have had some folks email me that they are surprised I am supporting advanced extentions for Pascal.
Pascal always had extentions. The original compiler created by Niklaus Wirth had extentions specific to the CDC 6000 series computers. The idea of the standard was never to forbid extentions, but rather that the basic implementation be as standardized across processors and implementations as possible.
In the old days of the mainframe and line printers, there was actually a chance that a program completely coded within the language standard would be all that was needed. Now, with advanced graphics and sound, and advanced devices like video editing, the general portable program is thought by many to be dead. I would say that nothing is further from the truth. We need clean and portable interfaces and programs more than ever. What has changed is that we rely more on library construction and interfaces. Windows, OS X and Linux/X Windows can be thought of as advanced intefaces with somewhat limited portability. Advanced graphics libraries such OpenGL are paving the way to new levels of functionality and portabilty.
Pascal is a structured language, using if-then-else, while, repeat-until, and for-to/downto control structures. It differs primarily from proceeding languages in that data structures were also included, with records (a feature borrowed from COBOL), arrays, files, sets and pointers.
Pascal is also unusual for forging an effective compromise between language simplicity, power, and matching of language structures to underlying machine implementation.
Pascal also has many features for compiler writers. The language is constructed to have a minimum of ambiguity. Pascal, with few exceptions, can be processed "forward" with all of the smaller elements (like constants, types, etc) being defined before they are used. Pascal requires the types and exact sizes of operands to be known before they are operated on, again leading to simplified language processing and efficient output code (although this feature has often been called a problem). For this reason, Pascal still remains a popular language to implement compilers for as part of a compiler science class.
This assertion has often been used to imply that Pascal is a toy language. I can't state the answer any better than Niklaus Wirth himself did:
"Occasionally, it has been claimed that Pascal was designed as a language for teaching. Although this is correct, its use in teaching was not the only goal. In fact, I do not believe in using tools and formalisms in teaching that are inadequate for any practical task." - Niklaus Wirth, from the 1984 ACM A.M. Turing award lecture.
Early Apple Pascal was based entirely on the UCSD system, and the same comments apply to it as to UCSD Pascal above.
Ans: In Turbo Pascal, in the compile menu, select COMPILE TO MEMORY. Open the menu
again, and it should say COMPILE TO DISK. Then select COMPILE, and it will
create the file XXX.EXE, where XXX is the name of your .PAS file.
Ans: No. Too much information is lost in the compiling process.
Ans: In any cases where your program is longer than a few hundred lines, you will need to be able to run it through a debugger. Pascal programs compiled with GPC can be debugged via the GNU debugger dbg which we have installed on our Sun Fire system. However, the debugger is designed for C-code, and is rather kloncky if used with Pascal. But it is the only debugger available that works with GPC.
To be able to use the debuuger with your Pascal code, you have to include the -g option in your compilation. Since this option and optimization of the code (i.e. the -O options) are mutually exclusive, you will have to remove any -O directives from your compile command lines. Then you can start the debugger by typing "gdb name_of_executable". The debugger is operated by typing in commands such as
run Start the program from the beginning
stop Stop the program from executing
break Insert a break at a given line of the code, or in a specific subroutine or function
cont Continue from the present position in the code until the next break is encountered
list List the code around the present break point
print Show the value of a variable
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
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.
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
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
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.
Ans: Certainly. One of the most recent and active is FPK Pascal, a 32 bit
Turbo Pascal compatible compiler system for DOS and OS/2. Comes with
full Pascal source, and compiles itself. The author intends to extend it
to work under Linux too. Note that currently the documentation is in
German only,
Ans: ISO 7185 standard is the original language as created by N. Wirth, more precisely defined and more secure than the original. The standard makers refrained from making large improvements or extensions to the language. In fact, because Pascal is one of the most carefully designed languages and also one of the most carefully standardized, there is a high degree of ability to determine, unambiguously, if a given program construct is legal according to ISO 7185 rules.
Pascal, almost from the first of its use, was widely extended and changed. One reason for this may be that the language was also very popular in compiler classes, and tended to produce many experimental versions.
The original language, Pascal/1972 or J&W Pascal, has been around since 1972, standardized in 1982, and only minor changes were required to programs to bring them into compliance with it (see below). The basis of the language is still very strong, and the ISO 7185 standard is freely available. Further, there are many books written with the standard in mind.
Ans: IP is an interplatform Pascal. It supports the following platforms in its current configuration:
1. Windows/95/98/ME/NT/2000/XP.
2. Linux/86.
A port for Mac OS X is under way, and a port for Sun Solaris/Sparc is planned.
IP both provides, and itself is run, on a set of porting modules that allow IP, and its client programs, to run on any of the supported platforms without source change. To move within operating systems on the same machine type, only a relink is required. To move within different CPU based systems, a recompile and link is required.
Ans: No, there is not.
Ans: IP was never coined to be a particular acronym. Present definitions are Internet Pascal, Intellectual Property Pascal, InterPlatform Pascal. The name IP Pascal was chosen to represent the flavor of today's machine and process independent design processes.
As some of you may know, I am heavily involved in the networking industry. Internet Protocol was originally envisioned as a way to "bridge" different networks together. The principle was that one carefully constructed standard would be able to bridge any number of different networks together, and the overhead of a second level protocol would only be incurred once. This is much like saying that designing one standard plug, then designing a series of adapters to that plug from other plug types, can unify incompatible systems.
IP Pascal is definitely designed to do just that
Ans: IP was never coined to be a particular acronym. Present definitions are Internet Pascal, Intellectual Property Pascal, InterPlatform Pascal. The name IP Pascal was chosen to represent the flavor of today's machine and process independent design processes. As some of you may know, I am heavily involved in the networking industry. Internet Protocol was originally envisioned as a way to "bridge" different networks together. The principle was that one carefully constructed standard would be able to bridge any number of different networks together, and the overhead of a second level protocol would only be incurred once. This is much like saying that designing one standard plug, then designing a series of adapters to that plug from other plug types, can unify incompatible systems.
IP Pascal is definitely designed to do just that
Ans: This assertion has often been used to imply that Pascal is a toy language. I can't state the answer any better than Niklaus Wirth himself did:
"Occasionally, it has been claimed that Pascal was designed as a language for teaching. Although this is correct, its use in teaching was not the only goal. In fact, I do not believe in using tools and formalisms in teaching that are inadequate for any practical task." - Niklaus Wirth, from the 1984 ACM A.M. Turing award lecture.
Ans: he original Pascal standard was an unofficial standard documented by the author, Niklaus Wirth, in "The Report". The first official standard was ISO 7185 issued in 1983. This was followed by the extended standard, ISO 10206, in 1990. Another standard was the Object-Oriented Extension to Pascal. However, this standard was never finished, and was basically abandoned for lack of interest.
Ans: Pascal is one of a series of languages put forth by one of the most prolific computer language creators, Niklaus Wirth, a professor at Institut fur informatik, ETH, Zurich, Switzerland. Professor Wirth participated in various versions of Algol, a language put forth by international cooperation that introduced the basic concepts of structured programming to the world. Wirth terms Pascal as a descendant of Algol 60 (for Algol, 1960 standard). The "official" descendant of Algol 60 was Algol 68, famous for having assignment as an expression operator (a basic feature of the later language C). Wirth felt that the design committee for Algol, after Algol 60, was losing focus and creating an unnecessarily complex language.
While Algol W has had it's fans, the language Pascal was considered to be a new high of consistent language design. The first draft of Pascal was created in 1968. The first compiler was operational in 1970, and the language was generally published in 1971. In 1973, after two years of testing and use, the language was revised into it's final form. That was detailed by "The Pascal User Manual and Report".
Ans: A. IP Pascal was designed to follow the original Pascal standard since 1980, following Niklaus Wirth's "The Pascal User Manual and report" [Jensen and Wirth] from 1974. In 1983, the ISO 7185 standard was released, and the minor changes to J&W Pascal were implemented in IP Pascal.
Unfortunately, none of the Borland products followed either the "User Manual and Report" nor the ISO 7185 Pascal standard, even though it preceeded Borland? implementations by a decade. Borland? products have a large user base, and we respect that, and hope to provide tools to convert user's Borland? compatible products to IP Pascal for interoperation.
For IP Pascal to have been compatible with Borland? products, considerable changes away from standard Pascal would have been required. Also, since there is no official published Borland? language standard, there would be no way to guarantee perfect compatibility with Borland? products. Finally, IP Pascal is directed at a long term standard implementation. Borland? products have traditionally been machine and operating system dependent. The different Borland? products, Turbo Pascal, Borland? Pascal, Borland? Windows Pascal, Delphi? and Kylix, are not completely compatible with each other, and would have been a moving target during the many years IP Pascal has been in operation.
Ans: Delphi32 is for Windows 95 and Windows NT. It is not a DOS product. It
will create 32-bit console mode apps, but it will not create DOS apps.
Ans: Delphi32 is for Windows 95 and Windows NT. It is not a DOS product. It
will create 32-bit console mode apps, but it will not create DOS apps.
Ans: Pascal is a structured language, using if-then-else, while, repeat-until, and for-to/downto control structures. It differs primarily from proceeding languages in that data structures were also included, with records (a feature borrowed from COBOL), arrays, files, sets and pointers.
Pascal is also unusual for forging an effective compromise between language simplicity, power, and matching of language structures to underlying machine implementation.
Pascal also has many features for compiler writers. The language is constructed to have a minimum of ambiguity. Pascal, with few exceptions, can be processed "forward" with all of the smaller elements (like constants, types, etc) being defined before they are used. Pascal requires the types and exact sizes of operands to be known before they are operated on, again leading to simplified language processing and efficient output code (although this feature has often been called a problem). For this reason, Pascal still remains a popular language to implement compilers for as part of a compiler science class.
Ans: A few Turbo Pascal "units" that aid program porting have been created, and these have shown to dramatically simplify porting from that language. Similar procedures will be used for other Pascals. However, these are just rapid porting aids, and these Pascals do not enjoy full language compatibility. There will always be a minimum amount of work required to change programs to work under IP. Further, porting using these units won't give you a program that takes advantage of the features of IP, and I consider it to be only a step in the process of fully porting a program to IP.
IPs main focus is to be a language that is not tied to any operating system or hardware, and IP will, therefore, always be unable to fully emulate the machine dependent features of many Pascal implementations. The failure of many Pascals that are single machine based has shown that the future lies in very portable Pascal languages and compilers.
Ans: upport for the product. IP Pascal will be supported by email, web site, and usenet forum without charges or restrictions. Emails will be typically answered within 48 hours.
Because this support model does not require hiring large support staffs (and then firing them later as demand decreases), there is no plans to limit or charge for support.
Ans: Pascal is in the Algol family of languages. Algol, whose first version was called IAL or "International Algebraic Language", was the first language created by international committee. The resulting language was rather odd for its time. The committee had the goal of designing a unified computer language, but also saw Algol as a way to cleanly express computer algorithms, and so was not directly concerned with creating a practical language for compilation. That is, the language would serve a purpose even if it was only used for publishing algorithms, not running them.
This resulted in Algol not having many data types, or built in I/O. Also, Algol was generally free of the limits common to programming languages of that time, such as number of array dimensions. One of the goals of Algol was for it to be as close to mathematical notation as possible. In particular, Algol used a special operator for assignment, ':=', because '=' had a different meaning in mathematics.
Ans: A. IP is an interplatform Pascal. It supports the following platforms in its current configuration:
1. Windows/95/98/ME/NT/2000/XP.
2. Linux/86.
A port for Mac OS X is under way, and a port for Sun Solaris/Sparc is planned.
IP both provides, and itself is run, on a set of porting modules that allow IP, and its client programs, to run on any of the supported platforms without source change. To move within operating systems on the same machine type, only a relink is required. To move within different CPU based systems, a recompile and link is required.
Ans: There have been many implementations of Pascal, both those that follow and those that don't follow the ISO 7185 standard. For the most part, ISO 7185 was followed on large computer installations during the early days of Pascal (1973-1990), and some installations on microcomputers. The other dialect that became popular was the UCSD (University of California at San Diego) Pascal, followed by Borland's Turbo Pascal. Although there are virtually no current implementations of UCSD Pascal, Borland's products exist today for advanced IBM-PC compatibles under Borland's Delphi name.
When the IBM-PC became 32 bit with the introduction of the Intel 80386, virtually all of the 32 bit implementations of Pascal on the PC were ISO 7185 conforming. However, there was a large shakeout of compiler vendors in the early 1990's that removed many of these installations from the market.
Ans: Pascal was named after the French mathematician Blaise Pascal, who created a calculating machine (not a true computer).
Ans: In 1989, ISO 7185 was revised to correct various errors and ambiguities found in the original document. This resulted in ISO 7185:1990.