Docsity

CSCE 3600 Final Exam: Compiler Optimization, Python, and Unix/Linux, Exams of Social Sciences

Toggle sidebar
bg1
CSCE 3600 FINAL EXAM QUESTIONS & ANSWERS
Optimization of a program that works within a single basic block of code is called
_________________. - Answers - local transformation / optimization
Any macros specified in source code are expanded by the - Answers - preprocessor
What is the role of optimizing the compiler? - Answers - minimize a program's execution
time, memory footprint, storage size, and power consumption
In a C program, the statement int x = 10.5; should be detected as______ - Answers -
syntax error
-g - Answers - Include debug information, 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
-O1 - Answers -
-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
- #
What does the lexical analyzer take as input? - Answers - source code
What is the process of searching for match tokens described using? - Answers - Finite
automata & Regular expressions
These operations are performed in parsing phase of compilation. - Answers - Construct
parse trees
The primary job of the linker is to . - Answers - Combines all of the object files for one
program into a single object file.
Which of the following are false in Python? - Answers - -The numbers 0 (integer), 0.0
(float) and 0j (complex)
pf3
pf4

Partial preview of the text

Download CSCE 3600 Final Exam: Compiler Optimization, Python, and Unix/Linux and more Exams Social Sciences in PDF only on Docsity!

CSCE 3600 FINAL EXAM QUESTIONS & ANSWERS

Optimization of a program that works within a single basic block of code is called _________________. - Answers - local transformation / optimization Any macros specified in source code are expanded by the - Answers - preprocessor What is the role of optimizing the compiler? - Answers - minimize a program's execution time, memory footprint, storage size, and power consumption In a C program, the statement int x = 10.5; should be detected as______ - Answers - syntax error

  • g - Answers - Include debug information, 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
  • O1 - Answers -
  • 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

What does the lexical analyzer take as input? - Answers - source code What is the process of searching for match tokens described using? - Answers - Finite automata & Regular expressions These operations are performed in parsing phase of compilation. - Answers - Construct parse trees The primary job of the linker is to. - Answers - Combines all of the object files for one program into a single object file. Which of the following are false in Python? - Answers - - The numbers 0 (integer), 0. (float) and 0j (complex)

  • The empty string " "
  • The empty list [ ], empty dictionary { }, and empty set set( ) What is output from the following Python code snippet: x = 'B' print(chr( 1 + ord( x ) )) - Answers - C list, tuple, and range are _______ of datatypes. - Answers - Sequence types Amongst which of the following is / are the logical operators in Python? - Answers - - and
  • or
  • not Which of the following are used as conditional statement in Python? - Answers - - if, else
  • elif
  • NO SWITCH Which of the following elements of a mathematical expression in Python is evaluated first? - Answers - Parenthesis ( ) What value be in the variable x when the following statement is executed: x = int(98.6) - Answers - 98 What does the following code print out? print("123" + "abc") - Answers - 123abc What is the output of the following in python? numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] print(numbers[1 : : 2]) - Answers - [2, 4, 6, 8, 10] How can you make python script (i.e. a .py file) executable in Unix? - Answers - Python can be executed interactively or via a script which python python3 - V python3 - h Lexical Analysis (or Tokenization) - Answers - Converts characters in source program into lexical units Syntax Analysis - Answers - Transforms lexical units into parse trees that represent the syntactic structure of program Semantics Analysis - Answers - Generate intermediate code Code Generation - Answers - Machine code is generated

Grep options - Answers - - c (print only a count of matched lines)

  • i (ignore uppercase and lowercase)
  • l (list all files that contain specific pattern)
  • n (print matched lines with line numbers)
  • s (display nothing except error messages)
  • v (print lines that do not match pattern) Grep usage pattern - Answers - grep [options] pattern [files] Sed - Answers - Line oriented, used for large files. Usage: sed [-n] [e] ['command'] [file] or sed [-n] [-f script] [file] Sed flags - Answers - - n (only print lines specified by print command)
  • e (next argument is an editing cmomand)
  • f (next argument is a file name)
  • r (makes regex work better) Sed commands - Answers - s (substitute) a (append) d (delete) i (insert) c (change) Gawk - Answers - Scripting language for field by field basis editing. Gawk system variables - Answers - FS - field separator RS - record separator NF - number of fields in record NR - number of current record OFS - output field separator ORS - output record separator FILENAME ARGC/ARGV Python things that are true - Answers - True All non-zero numbers Any string containing at least one character A non-empty data structure Python things that are false - Answers - False All forms of 0 Empty string "" Empty data structures