CSC190H1 Midterm: CSC190H1_20151_621429585737solutions(1)

50 views10 pages
31 Jan 2019
School
Course
Professor

Document Summary

For each question, please circle an option that is correct. Note that if you circle an option that is not correct, you will not be awarded any marks for that question. [2 marks] (i) members are stored at random locations in memory (ii) members are stored at continuous addresses in memory (iii) members such as arrays are stored continuously and other non-array members are not. Consider the following de nition of the structure node: [2 marks] struct node{ int m1; struct node * mptr; Suppose that ptr is a pointer pointing to a valid struct node variable which in turn has valid and accessible data stored in its members. Which one of the following statements is valid? (i) ptr->mptr->m1; (ii) ptr->mptr. m1; (iii) ptr. mptr->m1; (iv) *ptr. mptr. m1; [2 marks] (i) base 16: 3d (ii) base 16: 3c (iii) base 2: 1101111 (iv) base 2: 1111101 (v) base 10: 60. Suppose int i = 61; and int j = 8;.