quiz announcements
play

Quiz Announcements Thursday Extras: 4:00 in CS Commons; 4:15 talk - PowerPoint PPT Presentation

Quiz Announcements Thursday Extras: 4:00 in CS Commons; 4:15 talk in Science 3821 Office hours: canceled for rest of this week (Wed.-Fri.) available Sunday 2:00 pm - 4:00 pm Mentor sessions Tues. 6-7 and 7-8 (pm) Commons Functions, address


  1. Quiz Announcements Thursday Extras: 4:00 in CS Commons; 4:15 talk in Science 3821 Office hours: canceled for rest of this week (Wed.-Fri.) available Sunday 2:00 pm - 4:00 pm Mentor sessions Tues. 6-7 and 7-8 (pm) Commons Functions, address parameters, and run-time stack Questions? Clicker questions Today's lab on addr. param, run-time stack due next Wed. Friday's class devoted to lab time

  2. Suppose variable a (in main) is stored in location 100, and suppose variable r (in proc) is stored in location 200. What is printed by the following program? #include <stdio.h> A. r: 5, & r: 100 void proc (int r) a: 4, & a: 100 { r = 5; B. r: 5, & r: 200 printf ("r: %u, &r: %u\n", a: 4, & a: 100 r, (unsigned int) &r); } C. r: 5, & r: 100 int main() a: 5, & a: 200 { int a = 4; D. r: 5, & r: 200 proc (a); a: 5, & a: 200 printf("a: %u, &a: %u\n", a, (unsigned int) &a); E. None of the above return 0; }

  3. Suppose variable b (in main) is stored in location 104, and suppose variable s (in proc) is stored in location 204. What is printed by the following program? #include <stdio.h> A. s: 12, & s: 204, *s: 12 void proc (int * s) { s: 17, & s: 204, *s: 17 printf ("s: %u, &s: %u, *s: %u\n", (unsigned int) s, B. s: 12, & s: 204, *s: 17 (unsigned int) &s,*s); *s = 17; s: 17, & s: 104, *s: 17 printf ("s: %u, &s: %u, *s: %u\n", (unsigned int) s, C. s: 104, & s: 204, *s: 12 (unsigned int) &s,*s); } s: 17, & s: 204, *s: 17 int main() { D. s: 104, & s: 204, *s: 17 int b = 12; proc (&b); s: 17, & s: 104, *s: 17 return 0; } E. None of the above

  4. Suppose variable b (in main) is stored in location 104, and suppose variable s (in proc) is stored in location 204. What is printed by the following program? #include <stdio.h> A. b: 12, & b: 104 void proc (int * s) { B. b: 12, & b: 204 *s = 17; C. b: 17, & b: 104 } int main() D. b: 17, & b: 204 { int b = 12; E. None of the above proc (&b); printf("b: %u, &b: %u\n", b, (unsigned int) &b); return 0; }

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend