CSCI 243 Exam #2 Fall 2011

 

Instructions: The usual…  This test is closed book, closed notes, closed neighbor.  Read thru the entire test first to find the easy questions, and answer them first to maximize your score.  Write legibly since if I can’t read it, it’s wrong.  There are 100 points on the test, not counting bonus questions.  Good luck and have fun.

 

1.        In a makefile, what is the first character of a non-labeled line?

 

 

 

 

 

 

2.       In a makefile, what separates the item created from the items used to make it?

 

 

 

 

 

 

3.       What is the command to compile a C++ file myfile.cpp to make an executable file doit?

 

 

 

 

 

 

4.       What is the usual suffix for a lex file?

 

 

 

 

 

 

5.       What is the command used to take a yacc file calc.y and generate C code and an include file for the parser?

 

 

 

 

 

 

6.       What is the name of the output file generated by lex?

 

 

 

7.       What is the name of the output C file generated by yacc?

 

 

 

 

 

 

8.       What tokens does the regular expression [01]+ describe?

 

 

 

 

 

 

 

9.       In a yacc grammar, where is the start symbol found?

 

 

 

 

 

 

10.   What symbols separate the three sections of yacc and lex files?

 

 

 

 

 

 

11.   Write C code that would be found in braces after a grammar rule that says to add the first and second tokens and return the result as the value of the parse rule.

 

 

 

 

 

 

12.   How do you know after a fork whether you are the child or parent process?

 

 

 

 

 

 

13.   What is the command to replace the currently running program with another program?

 

 

 

14.   What is the command that prints a pithy saying or bon mot?

 

 

 

 

 

 

15.   What are four  things contained in the /etc/passwd file?

 

 

 

 

 

 

 

16.   What do we use nfs for?

 

 

 

 

 

 

17.   Why should you use sudo instead of su?

 

 

 

 

 

 

18.   What is ntp used for?

 

 

 

 

 

 

19.   Why do systems use a shadow password file?

 

 

 

 

 

 

20.   What is the first line of a shell script that indicates it should be run with bash?


 

Bonus (5 points each):

1.     Sudoku…insert the digits 1 through 9 in the empty boxes so that there is only one of each digit in every row, column, and highlighted 3x3 box.

 

1

4

9

 

5

8

 

 

6

8

 

1

 

3

 

9

 

5

 

 

 

6

 

 

 

 

2

5

 

 

 

 

 

8

 

 

 

7

2

 

4

9

 

 

 

4

 

 

 

 

 

6

3

 

 

 

 

4

 

 

 

8

 

2

 

7

 

9

 

4

5

 

 

8

5

 

6

3

2

 

 

2.     Santa Claus sometimes helps the elves by making some toys. He's not as fast as the elves, but he can still make 30 toys each hour. In order to keep from getting bored he starts each day by building 50 trains and then switches to building 50 airplanes. Then he switches back to trains and keeps switching back and forth until the day is finished. If Santa starts work at 8:00am, when will he finish his 108th train?

 

 

 

 

 

 

 

 

 

 

 

 

 

Divide $161 (in whole $ increments) into a number of bags so that I can ask for any amount between $1 and $161, and you can give me the proper amount by giving me a certain number of these bags without opening them. What is the minimum number of bags yo