Two procedures can have procedure-level variable whose names are same.

TRUE
nan
nan
nan

The correct answer is False.

Two procedures cannot have procedure-level variables whose names are the same. This is because procedure-level variables are local to the procedure in which they are declared. This means that they cannot be accessed from other procedures in the program.

If two procedures had procedure-level variables with the same name, it would be unclear which variable was being referenced. This could lead to errors in the program.

For example, consider the following code:

“`
procedure foo()
var x: integer;
begin
x := 1;
end;

procedure bar()
var x: integer;
begin
x := 2;
end;

begin
foo();
bar();
writeln(x);
end.
“`

This code would print 2, because the variable x in the bar procedure is the one that is referenced. However, if the two procedures had procedure-level variables with the same name, it would be unclear which variable was being referenced. This could lead to errors in the program.

To avoid this problem, it is important to give procedure-level variables unique names. This will help to ensure that the code is clear and easy to understand.

Exit mobile version