Winter2007-final - P L E A S E H A N D I N UNIVERSITY OF...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: P L E A S E H A N D I N UNIVERSITY OF TORONTO Faculty of Arts and Science APRIL EXAMINATIONS 2007 CSC209H1S St. George Campus Duration 3 hours P L E A S E H A N D I N Examination aids: One 8.5 x 11 sheet of paper (double-sided) Student Number: Last Name: First Name: Instructor: Do not turn this page until you have received the signal to start. (In the meantime, please fill out the identification section above, and read the instructions below.) This examination consists of 9 questions on 18 pages (including this one). When you receive the signal to start, please make sure that your copy of the examination is complete and fill in your student number on every page. If you need more space for one of your solutions, use the last pages of the exam or the back of this page and indicate clearly the part of your work that should be marked . # 1: / 9 # 2: / 6 # 3: / 6 # 4: / 7 # 5: /24 # 6: / 6 # 7: / 9 # 8: /11 # 9: /10 TOTAL : /88 Good Luck! Total Pages = 18 Page 1 continued . . . CSC209H1S Final Examination April 2007 Question 1. [9 marks] Part (a) [5 marks] Circle the correct answer below. TRUE FALSE A process whose parent has not called wait is an orphaned process. TRUE FALSE A read on a pipe will block when there is nothing to ready to read on the pipe. TRUE FALSE If a clients request for a socket connection arrives between the times that a server has called listen and accept , the connection will be denied. TRUE FALSE If a struct is passed in as an argument in a C function, any modifi- cations made to the contents of the struct will be visible when the function returns TRUE FALSE Read and execute permissions are needed on a shell program to ex- ecute it. Part (b) [2 marks] Fill in the third argument to strncat . Assume that str1 and str2 both contain valid strings. char str1[SIZE1]; char str2[SIZE2]; strncat(str1, str2,__________________________________); Part (c) [2 marks] Write the output of the following C snippet. char a[10]; char *b = malloc(10 * sizeof(char)); printf("A = %d\n", sizeof(a)); printf("B = %d\n", sizeof(b)); Student #: Page 2 of 18 continued . . . CSC209H1S Final Examination April 2007 Question 2. [6 marks] The current working directory contains 3 files: hop , skip , and jump . The contents of each file are shown below: hop #!/bin/sh arg=$1 echo "Running hop" if [ -x $1 ]; then $1 fi skip #!/bin/sh echo "Running skip" jump #!/bin/sh echo "Running jump" For each of the following commands, give the output that would appear when the command is run. ( is a single quote and is a back quote.) run="hop" $run echo "$run hop" echo * echo * [sh]* set ???p echo $2 Student #: Page 3 of 18 continued . . . CSC209H1S Final Examination April 2007 Question 3. [6 marks] Part (a) [2 marks] I told my friend who has an account on CDF that I have a program she can run in ~reid/bin/prog ....
View Full Document

This document was uploaded on 08/02/2011.

Page1 / 18

Winter2007-final - P L E A S E H A N D I N UNIVERSITY OF...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online