There is given Pascal interview questions and answers that has been asked in many companies. Let's see the list of top Pascal interview questions.
1) What is Pascal?
Pascal is a procedural programming language developed in 1970 by Niklaus Wirth. It is a small and efficient programming language which supports data structure and structured programming.
2) What are some distinguish features of Pascal?
Following are some specific features of Pascal:
- Structured programming language that uses control structures like if-else, repeat-until statement.
- Provide simplicity and modular approach for machine implementation.
- Having different data structures that are included with the records, arrays, files, pointers, etc.
- Offer extensive error checking.
- Support object oriented programming.
3) Why is it named Pascal?
It is named in the honor of a great French mathematician and philosopher Blaise Pascal.
4) What is Pascal sets?
Pascal sets can be specified as a collection of elements of the same type. It facilitates you to define the set data type. The set elements are enclosed in square elements.
5) What is a datatype? What are the different data types included in Pascal?
A datatype specifies a range of values that a variable can store. It also includes the set of operations that are performed on different datatypes.
Different data types included in Pascal
- Integers: It includes whole number, which allows numbers to be written without any decimals.
- Real Numbers: it includes numbers with decimal or without decimals.
- Boolean Data Types: It checks the condition true or false.
- Char Data Type: It allows a single character to be written with the ordered character set.
6) What is the different pointer types used in Pascal?
Following are the different pointer types used in Pascal:
- Record Pointer: It is used to allow the recording of the node and the sub-fields that are used.
- Reference Pointer: It specifies the reference to the dynamically created variables.
- Associate Pointer: They have an associated data type with them that they can check for compatibility with another type.
7) What is IP Pascal?
IP Pascal stands for Interplatform Pascal. It supports the following platform in its current configuration:
- Windows /95/98/ME/NT/2000/XP.
- Linux/86.
8) What is unit in Pascal?
Modules of Pascal programs are referred as units. A module or unit contains some code blocks, which contain variables and type declarations, statement procedures etc. There are many built-in units in Pascal.
9) What is the reason behind using UNITS in Pascal programming?
There are three reasons to use UNITS in programming:
- Simplicity: It simplifies the use of same code in some other programs to do the same job.
- Easy to handle: It makes handling easy because some large programs are split into smaller section.
- Easy to call: Putting codes in UNIT, makes it easy to call and use it again.
10) What are the different Pascal standards?
The first Pascal standard was documented by the author of the Pascal programming language Niklaus Wirth but it was an unofficial Pascal standard.
The first official standard was ISO 7185 issued in 1983. It was followed by the extended standard ISO 10206 in 1990. Another standard Object-Oriented Extension to Pascal was introduced but never completed due to lack of interest.
11) What is constant in Pascal? What constants are declared in Pascal?
Constants are something that remains unchanged during program execution. Pascal declares the following constants:
- Ordinal Types
- Set Types
- Pointer Types
- Real Types
- Char
- String
12) What syntax should be used to declare constants?
The following syntax is used to declare constants:
Const
Identifier = constant_value;13) What are the REPORT methods for which the portability is given in Pascal?
There are two REPORT methods for portability:
Application: It contains a guideline which facilitates you to use implementation and features according to the compiler, to make the application more portable.
Compiler: It is used to implement the language that is likely to implement the features like determining of the types compatible with one another.
14) How would you define a string in Pascal?
In Pascal, strings can be defined in different ways:
- Character Arrays
- String Variables
- Short Strings
- Null Terminated Strings
- ANSI Strings
15) What is the control structure used in Pascal?
- Pascal uses structure programming language to display the flow of control in a structured manner.
- Pascal uses the goto statement as a standard statement that allows the control to be given to the main program in a recursive manner.
- Pascal provides more easy way to represent them without using the semicolon to end the statements written in one line.
- Pascal uses loops as a control structure to represent the statements and uses assignment operators to assign the values to the variables.
16) What is the usage of Extension in Pascal?
Extension makes the program more clean and portable to use by providing the interfaces to be used in programs.
17) How file is handled in Pascal?
TIn Pascal, a file is a sequence of components, and file is determined by the type of the components.
type
file-name = file of base-type;
The base type determines the type of the component. It could be anything like Boolean, subrange, integer, record, arrays etc.
18) How can you make EXE file with Turbo Pascal?
To make EXE file with Turbo Pascal, follow these instructions:
- Go to compile menu in turbo Pascal
- Select COMPILE TO MEMORY
- Open the menu again
- Compile to disk will appear
- Select compile
- Select compile
19) What is Constructor and Destructors for Pascal Object?
Constructors:Constructor is a special type of method, which is called automatically whenever an object is formed. You can create a constructor in Pascal just by declaring a method with keyword. This method is known as Init method.
Destructors:Destructor is a method, which is used to destroy the memory allocation created by constructors
20) What are the types of loops in Pascal?
There are three types of loops in Pascal:
- Fixed Repetition: It specifies that the loop is repeated only a fixed number of times.
- Pretest: It first tests the Boolean expression, and then goes into a loop if the condition is TRUE.
- Posttest: It executes the loop first, and then tests the Boolean expression.
21) Is Pascal designed to be a teaching language?
Or
Why Pascal is called teaching language?
It is often said that Pascal is a toy language and not to built for real-world programming. Check, what the father of Python Niklaus Wirth said:
"Occasionally, it has been claimed that Pascal was designed as a language for teaching. Although it is correct, its use in teaching was not the only goal. In fact, I don't 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
22) What is the difference between apple Pascal and UCSD Pascal?
- UCSD Pascal: UCSD Pascal is a Pascal programming language system, run on UCSD p-system a portable, highlymachine-independent operating system.
- Apple Pascal:Apple Pascal is a language and operating system based on the UCSD Pascal system.
23) What is the difference between Turbo and Standard Pascal?
- The Turbo Pascal uses dynamic variables and pointers to show the standard procedures like new, mark and release. Whereas, standard Pascal doesn't use dynamic variables and uses procedures like new and dispose.
- Turbo Pascal is more efficient, faster and doesn't require the support code that offers the compatibility factor. Whereas, Standard Pascal doesn't, accept the record specifications for their standard procedures.
- Turbo Pascal is using the local variables that are handled in the recursion phase and it also passes the recursive calls to others. Whereas, Standard Pascal doesn't, make use of recursion for their subprograms.
- Turbo Pascal doesn't use the Get and Put methods but instead of that there is a use of Read and write procedures that extend the functionality of the I/O methods. Whereas, it supports the use of get and put methods.
- Turbo Pascal doesn't implement the standard page procedure as the operating system doesn't define the form-feed character.
24) What is the difference between Modern Pascal and Standard Pascal?
- Standard Pascal is less secure and more ambiguous while programming or coding. Whereas, Modern Pascal provides more securities and fewer ambiguities while programming or coding.
- Modern Pascal provides backward compatibility by the use of functions and procedures with their parameters. Whereas, standard Pascal doesn't provide this kind approach and doesn't follow the backward compatibility.
- Modern Pascal provides Var parameters to be used with the procedures and functions and make advancement over the standard Pascal.
- Modern Pascal provides the definitive type of compatibility with its parameters and the symbols used. Whereas, standard Pascal doesn't provide anything related to the symbols.
- Modern Pascal allows the removal of the length of the symbol that is limited. Whereas, standard Pascal doesn't remove the symbol length limit.
25) What are the different insecurities involved in Pascal?
Following are the main insecurities involved in Pascal:
- Infinite loop: This is an area that makes the program to run for a longer period of time and it becomes hard to control and terminate it.
- Insecure variants: the variants used should be able to change the pointer to an integer or vise versa this can create errors when writing big programs.
26) Is there any Freeware Pascal compiler?
Yes. One of the most recent and active freeware Pascal compilers is FPK Pascal. It is a 32 bit Turbo Pascal compatible compiler system for DOS and OS/2.27) What is the Pascal compiler used on HPCVL machines?
The Pascal compiler installed on the Sun Fire system of HPCVL is the Gnu Pascal Compiler (GPC). It is a public-domain compiler that has a great deal of extensions and compatibility features built within it. It is portable.
0 comments:
Post a Comment