Thursday, 29 January 2015

Pascal Interview Questions and Answers pdf(Part4)

16. Is Pascal designed to be a teaching language?
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.

17. What are the differences between apple Pascal and the standard?
Early Apple Pascal was based entirely on the UCSD system, and the same comments apply to it as to UCSD Pascal above.

18.  How do I make EXE files with Turbo Pascal?
 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.

19. Is it possible to 'decompile' pascal EXEs or TPUs?
 Ans: No. Too much information is lost in the compiling process.

20. How do I debug my Pascal programs?
 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
More Questions & Answers :-

No comments:

Post a Comment