Express 3FH in decimal, octal, and binary.
How many kilobytes is 2Gb? You may express your answer in powers of 2.
Name the 3 standard I/O libraries used to open/close files,
and the differences among them.
Name at least two procedures from each library.
Write a complete program module that does the following:
- Declare a list of 30 students -- each student has a name string,
a CARDINAL student ID, and a REAL GPA.
- Initialize the list to default values using a single statement.
- Write out the list to a file in binary format.
- Display the size of the output file in LOCs.
- Read back in from the file only the entry for the 17th student.
PROCEDURE NewPos (cid: ChanID;
chunks: INTEGER; chunkSize: CARDINAL;
from: FilePos): FilePos;
Rewrite the following FOR loop code snippet as a general LOOP.
Don't worry about the rest of the module (IMPORT, VAR, etc.).
FOR idx := 0 TO LENGTH (name)
name[idx] := CAP (name[idx]);
What is output from executing the following program module?
(sysException is the exception that is raised in
Stonybrook when dividing an integer by zero.)
FROM M2EXCEPTION IMPORT
M2Exceptions, IsM2Exception, M2Exception;
FROM EXCEPTIONS IMPORT
FROM STextIO IMPORT
FROM SRealIO IMPORT
PROCEDURE FloorDivide (num, denom : REAL) : REAL;
RETURN FLOAT ( INT (num) / INT (denom) );
IF IsExceptionalExecution() AND
(M2Exception() = sysException) THEN
WriteString (" div-by-zero!");
WriteFixed ( FloorDivide ( 14.2, 5.9 ), 0, 0 );
WriteFixed ( FloorDivide ( 1.5, 0.5 ), 0, 0 );
WriteFixed ( FloorDivide ( 6.8, 2.1 ), 0, 0 );
IF IsExceptionalExecution() THEN
WriteString (" bummer!");