For the program segment given below, which of the following are true? program…
GATE · 1993 · CS · Question 7 subpartsModified — slightly modified from the official paper; see the solution
For the program segment given below, which of the following are true?
program main (output);
type link = ^data;
data = record
d : real;
n : link
end;
var ptr : link;
begin
new (ptr);
ptr:=nil;
ptr^.d:=5.2;
writeln(ptr^.d)
end.
- A.
The program leads to compile time error
- B.
The program leads to run time error
- C.
The program outputs 5.2
- D.
The program produces error relating to nil pointer dereferencing
- E.
None of the above
Attempted by 18 students.
Sign up free to check your answer
Sign up freeLoading lesson…