1. What are the data types included in Pascal?
- Data type defines a range of values that a variable can store. It also includes set of operations that are performed on different data types.
- There is predefined data type as:
- Integers are the whole numbers that allow only the numbers to be written without any decimal points.
- The real numbers are treated as floating point numbers that can have decimals as well with the non-decimal digits.
- Boolean data types define only the two values either it is true or false. In programming it can be used when there is a decision need to be made between the two entities.
- Char data type allows the single character to be written in an ordered form with the ordered character set.
2. What are sub-range types and sub-types in Pascal language?
- The sub-range allows defining the implementation of the functions that provides the data conversions to be performed on the data types like real to integer, etc.
- The sub-ranges of the data type can be made using the ordinary data type which will be as follows:
var
x : 1..10;
y : 'a'..'z';
z : Apple..Mango;
- Set provides a way to group the things and the objects using the mathematical algorithm. The set can hold the values that will make it faster.
- The set types are used to have a set in which there are some values that needs to be defined.
- This is shown as:
var
Set1 : set of 1..10;
Set2 : set of 'a'..'z';
Set3 : set of Apple..Mango;
- Set operators can be used to implement the machine code operations that involve smaller domains.
3.What are the different pointer types used in pascal?
- Record pointers are the pointers that allow the recording of the node and the sub-fields that are being used.
- Reference pointers: Pointers are the reference to the dynamically created variables that doesn�t allow the references to be done in static or local variables.
- Associate type pointers: Pointers have an associated data type with them so that one type can be check for compatibility with another type.
- It helps in eliminating the security concern and allows easy implementation of the pointer used in the language.
- This allows the risk to be removed in case of using the dangling pointers and it dynamically allows the use of Dispose function that manages the risk.
- Example of the pointer is as follows:
type
pNode = ^Node;
Node = record
a : integer;
b : char;
c : pNode {extra semicolon not strictly required}
end;
var
NodePtr : pNode;
IntPtr : ^integer;
- The NodePtr is a variable pointer that is pointing to the data type of Node that is a record. Pointers are used before they are declared.
4. What is the control structure used by Pascal?
- Pascal uses structure programming language to display the flow of control in an structured manner.
- It uses the goto statement/command as standard statements that allow the control to be given to the main program in a recursive manner.
- It provides more easy way to represent them without using the semicolon to end the statements written in one line.
- It uses loops as a control structure to represent the statements and uses assignment operators to assign the values to the variables.
- The example of it is as follows:
while (a <> b) do WriteLn('Waiting');
if (a > b) then WriteLn('Condition met')
else WriteLn('Condition not met');
for i := 1 to 10 do
WriteLn('Iteration: ', i);
repeat
a := a + 1
until (a = 10);
case i of
0 : Write('zero');
1 : Write('one');
2 : Write('two');
else begin Write('?'); exit; end
end;
5. What are the procedures and functions used in Pascals?
- Procedures and functions both are different in their own sense and both are required the program construct.
- Procedures and functions are the main part of the logical block and they can be nested to any depth in the code.
- It has its own declarations like goto labels, constants, types, variables and other defining entity that allow them to keep every function in order.
- The ordering of the functions are required to allow the efficient compilation process using the single pass.
- The example of it is shown below:
program Mine(output);
var i : integer;
procedure Print(var j : integer);
begin
...
end;
begin
...
Print(i);
end
6. Why are semicolons as statement separators used in Pascal?
- Pascal uses the semicolon as separators which have been taken from one of the features of the ALGOL language.
- Semicolon as a statement terminator is used so that other statements can be preceded or other statements can be executed.
- There is no semicolon that is required before the keyword end as it defines the record type declaration.
- A block and a case statement also don�t require any semicolon as they needs to be carried on and gets executed.
- The semicolon in the language is not used immediately before the keyword else if the �if� statement is used as, the else statement is treated a single statement.
- The semicolon gets applied to the sequence of statement that is written in more than one statement.
7. Why Pascal is used without extensions?
- Pascal uses extensions to extend the features used in the language and to overall implementation of the code.
- The implementation is standardized to many processors and implementations when it is possible.
- Program that is coded with the language doesn�t use much extension due to the fact that it doesn�t require high performances.
- Extensions make the program more clean and portable to use by providing the interfaces to be used in programs.
- Library construction has become easy to use due the features of advanced interface and the portability that is being increased.
8. What are the features that make Pascal a good language in modern programming?
- Pascal is a very structured language and uses the control structures like if-else, repeat-until statements, etc.
- It is having different data structures that are included with the records, arrays, files, pointers, etc.
- Pascal provides simplicity and provides a modular approach for machine implementation. It allows the features to be related to the compiler.
- Pascal uses minimum ambiguity to represent the data and its structure it is processed with some exceptions and provides smaller elements with their definitions.
- Pascal provides the exact sizes used by the operands and operators to perform on them. It provides a way to process and use the efficient code.
9. What are the differences between standard Pascal and modern Pascal?
- Modern Pascal uses more securities and fewer ambiguities while programming or coding. Whereas, Standard Pascal have been using less security and more ambiguity 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.
10. What are the changes being made in P-machine Pascal?
- P-machine Pascal is the variant of the Pascal and it allows the implementation to be done of standard Pascal language.
- The changes made to the P-machine are as follows:
- Procedures and functions are not treated as parameters in the Pascal language. It also doesn�t simplify the use of it.
- The statements like Goto have no reference targets mainly outside the procedure/function bodies.
- The file types that are in the form of text can be used as an input or output and the special files can be compiled by itself.
- P-machine allows the use of pre-defined identifiers like maxint, round, page, disclose, etc. that are not present.
- Dispose is not being implemented in the P-machine Pascal and is replaced by the �mark� and �release� keywords.
- Data type defines a range of values that a variable can store. It also includes set of operations that are performed on different data types.
- There is predefined data type as:
- Integers are the whole numbers that allow only the numbers to be written without any decimal points.
- The real numbers are treated as floating point numbers that can have decimals as well with the non-decimal digits.
- Boolean data types define only the two values either it is true or false. In programming it can be used when there is a decision need to be made between the two entities.
- Char data type allows the single character to be written in an ordered form with the ordered character set.
2. What are sub-range types and sub-types in Pascal language?
- The sub-range allows defining the implementation of the functions that provides the data conversions to be performed on the data types like real to integer, etc.
- The sub-ranges of the data type can be made using the ordinary data type which will be as follows:
var
x : 1..10;
y : 'a'..'z';
z : Apple..Mango;
- Set provides a way to group the things and the objects using the mathematical algorithm. The set can hold the values that will make it faster.
- The set types are used to have a set in which there are some values that needs to be defined.
- This is shown as:
var
Set1 : set of 1..10;
Set2 : set of 'a'..'z';
Set3 : set of Apple..Mango;
- Set operators can be used to implement the machine code operations that involve smaller domains.
3.What are the different pointer types used in pascal?
- Record pointers are the pointers that allow the recording of the node and the sub-fields that are being used.
- Reference pointers: Pointers are the reference to the dynamically created variables that doesn�t allow the references to be done in static or local variables.
- Associate type pointers: Pointers have an associated data type with them so that one type can be check for compatibility with another type.
- It helps in eliminating the security concern and allows easy implementation of the pointer used in the language.
- This allows the risk to be removed in case of using the dangling pointers and it dynamically allows the use of Dispose function that manages the risk.
- Example of the pointer is as follows:
type
pNode = ^Node;
Node = record
a : integer;
b : char;
c : pNode {extra semicolon not strictly required}
end;
var
NodePtr : pNode;
IntPtr : ^integer;
- The NodePtr is a variable pointer that is pointing to the data type of Node that is a record. Pointers are used before they are declared.
4. What is the control structure used by Pascal?
- Pascal uses structure programming language to display the flow of control in an structured manner.
- It uses the goto statement/command as standard statements that allow the control to be given to the main program in a recursive manner.
- It provides more easy way to represent them without using the semicolon to end the statements written in one line.
- It uses loops as a control structure to represent the statements and uses assignment operators to assign the values to the variables.
- The example of it is as follows:
while (a <> b) do WriteLn('Waiting');
if (a > b) then WriteLn('Condition met')
else WriteLn('Condition not met');
for i := 1 to 10 do
WriteLn('Iteration: ', i);
repeat
a := a + 1
until (a = 10);
case i of
0 : Write('zero');
1 : Write('one');
2 : Write('two');
else begin Write('?'); exit; end
end;
5. What are the procedures and functions used in Pascals?
- Procedures and functions both are different in their own sense and both are required the program construct.
- Procedures and functions are the main part of the logical block and they can be nested to any depth in the code.
- It has its own declarations like goto labels, constants, types, variables and other defining entity that allow them to keep every function in order.
- The ordering of the functions are required to allow the efficient compilation process using the single pass.
- The example of it is shown below:
program Mine(output);
var i : integer;
procedure Print(var j : integer);
begin
...
end;
begin
...
Print(i);
end
6. Why are semicolons as statement separators used in Pascal?
- Pascal uses the semicolon as separators which have been taken from one of the features of the ALGOL language.
- Semicolon as a statement terminator is used so that other statements can be preceded or other statements can be executed.
- There is no semicolon that is required before the keyword end as it defines the record type declaration.
- A block and a case statement also don�t require any semicolon as they needs to be carried on and gets executed.
- The semicolon in the language is not used immediately before the keyword else if the �if� statement is used as, the else statement is treated a single statement.
- The semicolon gets applied to the sequence of statement that is written in more than one statement.
7. Why Pascal is used without extensions?
- Pascal uses extensions to extend the features used in the language and to overall implementation of the code.
- The implementation is standardized to many processors and implementations when it is possible.
- Program that is coded with the language doesn�t use much extension due to the fact that it doesn�t require high performances.
- Extensions make the program more clean and portable to use by providing the interfaces to be used in programs.
- Library construction has become easy to use due the features of advanced interface and the portability that is being increased.
8. What are the features that make Pascal a good language in modern programming?
- Pascal is a very structured language and uses the control structures like if-else, repeat-until statements, etc.
- It is having different data structures that are included with the records, arrays, files, pointers, etc.
- Pascal provides simplicity and provides a modular approach for machine implementation. It allows the features to be related to the compiler.
- Pascal uses minimum ambiguity to represent the data and its structure it is processed with some exceptions and provides smaller elements with their definitions.
- Pascal provides the exact sizes used by the operands and operators to perform on them. It provides a way to process and use the efficient code.
9. What are the differences between standard Pascal and modern Pascal?
- Modern Pascal uses more securities and fewer ambiguities while programming or coding. Whereas, Standard Pascal have been using less security and more ambiguity 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.
10. What are the changes being made in P-machine Pascal?
- P-machine Pascal is the variant of the Pascal and it allows the implementation to be done of standard Pascal language.
- The changes made to the P-machine are as follows:
- Procedures and functions are not treated as parameters in the Pascal language. It also doesn�t simplify the use of it.
- The statements like Goto have no reference targets mainly outside the procedure/function bodies.
- The file types that are in the form of text can be used as an input or output and the special files can be compiled by itself.
- P-machine allows the use of pre-defined identifiers like maxint, round, page, disclose, etc. that are not present.
- Dispose is not being implemented in the P-machine Pascal and is replaced by the �mark� and �release� keywords.
No comments:
Post a Comment