---------------------------------------------------------------------------- COP 3610 -- FINAL EXAM -- 80 POINTS MAX M. Schmalz 001214 ---------------------------------------------------------------------------- *** YOU MAY USE THREE TWO-SIDED 8-1/2" x 11" CRIB SHEETS FOR THIS EXAM *** *** ALL OTHER BOOKS AND NOTES MUST BE PUT AWAY *** *** ANSWER ALL QUESTIONS - NO PENALTY FOR GUESSING *** 1) SIT IN THE SEAT THAT CORRESPONDS TO THE FOLLOWING NUMBER: EXAM NUMBER: _______________ 2) PUT YOUR NAME AND SSN ON ALL PAGES OF THE EXAM. 3) PLEASE SIGN THE FOLLOWING STATEMENT: I have not received any help on this exam, other than the instructor answering my requests for clarification, and the crib sheet that was permitted for the exam. I did not share information about the exam with any other person during the course of the exam. NAME:_______________________________________ SSN: _______________________ PAGE PENALTIES: 1 2 3 4 5 TOTAL _____ _____ _____ _____ _____ ======= (80 MAX) ---------------------------------------------------------------------------- COP 3610 -- FINAL EXAM -- 80 POINTS MAX M. Schmalz page 1/5 ---------------------------------------------------------------------------- NAME:_______________________________________ SSN: _______________________ ANSWER EACH QUESTION WITH THE "BEST" ANSWER. PUT ANSWERS IN BLANKS. NOTE: More than one answer may be true. Choose carefully. 4pts 1) List four services that the UNIX operating system provides to users, which were also provided by operating systems that existed before MULTICS. Also list the operating system name next to the service. (Example: "Spooling - IBM System/360") #1:__BATCH PROCESSING_________ #2:___SPOOLING - IBM System/360___ #3:__COMPILATION - IBM S/360__ #4:___ACCOUNTING - IBM 4000 Series 6pts 2) What are three advantages of Time Sharing as opposed to Batch Processing - Explain each answer #1: _FAIRER SCHEDULING - LONG JOBS DON'T HOG ALL THE RESOURCES____ _IN TIME SHARING DUE TO ROUND-ROBIN SCHEDULING________________ #2: _USER CAN INTERACT WITH COMPUTER DUE TO SUPPORT FOR___________ _INTERACTIVE (TIME-SLICE BASED) TERMINAL SESSIONS_____________ #3: _COMPUTER DISPENSES SERVICES ON AN AS-NEEDED BASIS, AND_______ _CPU UTILIZATION IS INCREASED, OPERATOR TIME DECREASED________ ---------------------------------------------------------------------------- COP 3610 -- FINAL EXAM -- 80 POINTS MAX M. Schmalz page 2/5 ---------------------------------------------------------------------------- NAME:_______________________________________ SSN: _______________________ 6pts 3) Short answers about two *different* topics: a) What are regular expressions, and why are they used in UNIX? __REGULAR EXPRESSIONS ARE STRINGS THAT CONSTRAIN THE__________ __FUNCTIONALITY OF A UNIX PROGRAM OR COMMAND__________________ b) Give an example of how a socket works in the context of full duplex communication. DO NOT WRITE C or UNIX CODE! REFER TO WEB PAGE SECTION 6 __C___ 4) A compiler 1pts a) organizes your hard disk b) compiles lists c) translates source code into object code d) runs machine code e) interprets source code for a runtime module f) runs in real time 3pts 5) Describe how makefile variables, directives, and rules are used in UNIX. IMPORTANT NOTE: PLEASE DO NOT WRITE YOUR ANSWER IN TERMS OF UNIX CODE. USE ENGLISH ONLY. Varbls: __USED FOR REPLACEMENT OF LONG STRINGS => EFFICIENCY______ Dirctv: __INVOKING A COMPILER OR OTHER PROGRAM____________________ Rules: __SPECIFYING THE COMPOSITION OF A SOURCE OR OBJECT MODULE_ 5pts 6) What are two limitations of the Perl language, and why are they important in modern UNIX practice? PERL IS NOT NECESSARILY OBJECT-ORIENTED => LACK OF COMPATIBILITY WITH OOPS IMPLEMENTATION AND PHILOSOPHY PERL HAS CRYPTIC SYNTAX, HARD TO LEARN, REDUCES CLARITY AND MAINTAINABILITY OF CODE ---------------------------------------------------------------------------- COP 3610 -- FINAL EXAM -- 80 POINTS MAX M. Schmalz page 3/5 ---------------------------------------------------------------------------- NAME:_______________________________________ SSN: _______________________ 6pts 7) List one advantage (AD) and two disadvantages (DA) of the Java language: AD1: _PORTABILITY TO MANY MACHINES, MACHINE-INDEPENDENCE_________ DA1: _LIMITED SUPPORT FOR POLYMORPHISM IN OOPS PROGRAMMING_______ DA2: _BYTECODES NOT NECESSARILY UPWARD-COMPATIBLE________________ 4pts 8) What does each of the following commands do? (Consider each step) more money | mail -s payola gwb@pres.gov 1) _SCROLL THRU FILE "money"__ 2) _MAILS "money" TO gwb@pres.gov grep cat food ; talk yechhh 1) _FINDS "cat" IN FILE "food" 2) _TALK TO USER "yechhh"_____ 8pts 9) Give a nontrivial example of the command line used to a) compile a C++ program called "sweet.java.cpp" into an object file called "cow.orker" >>> gcc sweet.java.cpp -o cow.orker b) List all files whose names start with "I", then have one characters not equal to "a" or "m", and end with "b" or "c" followed by "." and "o" followed by "red" or "rad". >>> ls I[^am]**[bc]\.or[ea]d 4pts 10) How would you rewrite the command in 9b) to show those files one at a time? You don't need to write UNIX code - you can use pseudocode. (Hint: Control structures) REPLACE "ls" WITH "more" OR "cat" ---------------------------------------------------------------------------- COP 3610 -- FINAL EXAM -- 80 POINTS MAX M. Schmalz page 4/5 ---------------------------------------------------------------------------- NAME:_______________________________________ SSN: _______________________ 9pts 11) Match the letters with the UNIX commands or constructs: __N___ more more a) Java-C++ metacompiler b) Java debugger __E___ perl c) invokes Java-C++ linker d) Java runtime module __I___ time e) text processing language f) text editor __Q___ javad g) Perl compiler for Solaris h) email handler __M___ mail i) show elapsed time data j) snail mail __P___ javac k) performance measurement l) link object files __Q___ perf m) send messages over Internet n) show file pagewise __Q___ jcc o) object code profiling p) Java compiler __F___ vi q) illegal UNIX command r) none of above __D___ 12) What are shell scripts used for in UNIX? 3pts a) format text by rearranging symbols and variables b) accepting only those filenames that have scripted syntax c) constraining the functionality of a UNIX program or command d) supporting custom functions or operations for each user e) none of the above 6pts 13) List three advantages and three disadvantages of the C++ language: ADVANTAGE DISADVANTAGE #1 __OBJECT-ORIENTED_______ ___CRYPTIC SYNTAX____________ #2 __POWERFUL AT MANY LVLS_ _CAN ACCESS BARE MACHINE_____ #3 __STRUCTURED,MODULAR____ _BUGGY COMPILERS & LIBRARIES_ 6pts 14) What is object-oriented programming, and why is it important in modern software engineering practice? REFER TO PREVIOUS MIDTERM EXAMS ON WEBSITE ---------------------------------------------------------------------------- COP 3610 -- FINAL EXAM -- 80 POINTS MAX M. Schmalz page 5/5 ---------------------------------------------------------------------------- NAME:_______________________________________ SSN: _______________________ Given the following UNIX response to the "ls" command, answer each of the questions below, ASSUMING THAT EACH LISTED COMMAND IS INDEP- ENDENT OF THE OTHER COMMANDS. If an erroneous command, state that. Beanybebe.html Polluted.html Cd2kj2747.html Taired23.txt America.txt Galloping.htm Cf2kp0337.htm Dubyaman22.txtl Amerika.tx2 Galasales.htm Cddkp2347.htm Tubbymon22.txtil 3pts 15) What filenames displayed for: ls -l C*[^24].\7.*t* ===> ___NONE__________________________ 3pts 16) What filename(s) displayed for: ls *ub[^y]*m[ao].[2]^2.tx* => ___NONE__________________________ _________________________________ _________________________________ 3pts 17) In a makefile, you have source code files "p", "q", and "r" that you want to compile into object code file "s". Show three ways to do this in a makefile and explain what each answer does if implemented. #1: cc p q r -o s #2: cc p -o p.o ; cc q -o q.o ; cc r -o r.o ld p.o q.o r.o -o s #3: cc p -o p.o ; cc q -o q.o ; cc r -o r.o s: p q r -EOF-