CS1372_Fall_2006_Test_2_Practice

CS1372_Fall_2006_Test_2_Practice - Georgia Institute of...

Info iconThis preview shows pages 1–4. 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: Georgia Institute of Technology College of Computing CS 1371 Computing for Engineers Test 2 Practice Test - Fall Semester 2006 Use this practice test and the book questions for chapters 1-11 excluding Sections 7.3 and 11.6. There is some measurable probability that the real test will contain one of these problems as written. CS1372 Program Design for Engineers Test 2 Practice test Page 2 of 9 Problem 1 Short Answer a) the following questions refer to these declarations: typedef struct { char first[20]; char last[20]; int score; char grade; } Student; Student stu1, stu2; Now consider the following statements. After each one, write either valid or the reason for being invalid: (i) stu2 = stu1; (ii) if (stu1 == stu2) printf( "same structures" ); (iii) if (stu1.score == stu2.grade) printf( "nonsense" ); (iv) printf( "%d %d" , stu1.score, stu1.grade); (v) printf( "%s" , stu1); (vi) Student group[30]; b) answer these questions about recursive programming: (i) which is generally more efficient recursion or iteration? (ii) What is wrong with this code: int silly( int n) { if (n <= 0) return 1; else if (n%2 == 0) return n; else silly(n - 3); } Mark the change(s) necessary to fix it. (iii) What causes stack overflow? (iv) If a recursive function looks like this: if( /*some condition*/ ) /* make recursive call */ ; What can you say about the algorithm? CS1372 Program Design for Engineers Test 2 Practice test Page 3 of 9 c) consider the following code and choose the right answer....
View Full Document

This note was uploaded on 06/17/2008 for the course CS 1372 taught by Professor Smith during the Spring '07 term at Georgia Institute of Technology.

Page1 / 9

CS1372_Fall_2006_Test_2_Practice - Georgia Institute of...

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

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