CSCE 3600 FINAL REVIEW QUESTIONS & ANSWERS
Optimization of a program that works within a single basic block of code it called -
answers - local transformation/optimization
Any macros specified in source code are expanded by the - answers - preprocessor
Macros - answers - are expanded not calculated. The expansion will be given directly to
the compiler
What is the role of optimizing the compiler - answers - to optimize the code
Program compilation process - answers - a c program consists of one or more source
files. The c compiler driver passes the source code through several stages to translate it
into machine code. A source file is sometimes called a translation unit. The compiler is
the only part of the toolchain that understands c. It understands:
The semantics of c, the capabilities of the machine
It uses these things to transform c into assembly
Which gcc compiler optimization flag optimizes the generated code for both size and
speed - answers - -o3
-g - answers - debug no optimization
-o0 - answers - default no optimization
-o1 - answers - -do optimizations that don't take too long
-cp, cf, cse, dce, licm, inlining small functions
-o2 - answers - -take longer optimizing, more aggressive scheduling
-o3 - answers - -make space/speed trade-offs: loop unrolling, more inlining
-os - answers - optimize program size
What symbol is used at the beginning of the line in python to add comments - answers -
#
Which of the following are false in python - answers - none of the above.
What is output from the following python code snippet x='b' print(chr(1+ord(x))) -
answers - c
List, tuple, and ranges are of ____ datatypes - answers - sequence types
Optimization of a program that works within a single basic block of code it called -
answers - local transformation/optimization
Any macros specified in source code are expanded by the - answers - preprocessor
Macros - answers - are expanded not calculated. The expansion will be given directly to
the compiler
What is the role of optimizing the compiler - answers - to optimize the code
Program compilation process - answers - a c program consists of one or more source
files. The c compiler driver passes the source code through several stages to translate it
into machine code. A source file is sometimes called a translation unit. The compiler is
the only part of the toolchain that understands c. It understands:
The semantics of c, the capabilities of the machine
It uses these things to transform c into assembly
Which gcc compiler optimization flag optimizes the generated code for both size and
speed - answers - -o3
-g - answers - debug no optimization
-o0 - answers - default no optimization
-o1 - answers - -do optimizations that don't take too long
-cp, cf, cse, dce, licm, inlining small functions
-o2 - answers - -take longer optimizing, more aggressive scheduling
-o3 - answers - -make space/speed trade-offs: loop unrolling, more inlining
-os - answers - optimize program size
What symbol is used at the beginning of the line in python to add comments - answers -
#
Which of the following are false in python - answers - none of the above.
What is output from the following python code snippet x='b' print(chr(1+ord(x))) -
answers - c
List, tuple, and ranges are of ____ datatypes - answers - sequence types