0910-fall09-midterm-exam

0910-fall09-midterm- - Midterm Examination Fall TERM 2009 Computer Science 246 Software Abstraction and Specification Sections 01 Start Time 16:30

Info iconThis preview shows pages 1–3. 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
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Midterm Examination Fall TERM 2009 Computer Science 246 Software Abstraction and Specification Sections 01 Start Time: 16:30 End Time: 18:20 Number of Exam Pages (including cover sheet): 5 Total number of questions: 8 Total marks available: 86 CLOSED BOOK, NO ADDITIONAL MATERIAL ALLOWED Instructor: Peter Buhr October 27, 2009 1 Midterm Exam – CS 246 (F09) 2 Be brief, but you must answer the question! Do not rephrase the question in your answer; use point-form when possible. PROGRAMS DO NOT REQUIRE COMMENTS. 1. (a) 2 marks What is a shell ? (b) 3 marks How are file names organized? Give a very brief description. (c) 2 marks What is a hidden file and why are they hidden? (d) 3 marks Write a globbing pattern that matches file names that do NOT start with the characters x , y , or z , followed by any number of characters, and ending with the suffix “ .cc ”. (e) 3 marks With respect to file permissions, what groupings can users be organized into, and what access control is allowed for users in each group? 2. (a) 1 mark What is unusual about the basic type int in C/C++? (b) 2 marks Give the values in each variable after the following code fragment has executed: int i = 3; . . . { int k = i, i = 4; . . . { int i = i; // GIVE VALUES OF VARIABLES HERE (c) 3 marks What are the 3 fundamental drawbacks of C strings? (d) 2 marks How does the C++ string type eliminate the drawbacks in question 2c. (e) 2 marks What is a designated constant ? Give 2 examples. 3. (a) 2 marks Variables p1 and p2 are pointers. In general, why is this assignment ambiguous? p1 = p2; (b) 6 marks Draw a picture of the stack at the point where rtn is about to return. int rtn( int * &r ) { int i = 7, * pr = r; r = &i; // STATE OF STACK HERE } int main() { int i = 3, * pi = &i; rtn( pi ); } (c) 2 marks Explain what is wrong with this code fragment and how to fix it: int * parr = new int [10]; . . ....
View Full Document

This note was uploaded on 01/14/2012 for the course CS 246 taught by Professor Wormer during the Fall '08 term at Waterloo.

Page1 / 5

0910-fall09-midterm- - Midterm Examination Fall TERM 2009 Computer Science 246 Software Abstraction and Specification Sections 01 Start Time 16:30

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

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