practiceFinal

# practiceFinal - PIC 10A Final Exam NAME(Print Check one...

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

PIC 10A December 22, 2005 Final Exam NAME (Print!): Check one: Salomone (12:00 pm): Wang: Salomone (1:00 pm): Balabanov: Le: O’Brien: Problem Points Score 1 20 2 10 3 12 4 5 5 18 6 10 7 5 8 20 Total 100

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

View Full Document
2 Problem 1 (20 points): Answer the following ten true-false ques- tion. Circle TRUE if you think the statement is always true and FALSE if you think it’s ever false: (a) Suppose you’ve made the deﬁned a struct type called data and have declared data* pt . And suppose data has a ﬁeld (member) num . Then cout << pt->num is the same as cout<< *pt.num . TRUE FALSE (b) Suppose you’ve declared an array a of size 5. Then cout << *a+1 and cout << a[1] print the same thing to screen. TRUE FALSE (c) When you pass an array to a function, it is being passed by ref- erence. TRUE FALSE (d) Suppose you’ve declared ifstream fin and fin.open("a.txt") . Then fin.getline(temp,80) will read in an entire line from a.txt (up to 79 characters). TRUE FALSE (e) int a[5] comes from the “stack” part of the memory. TRUE FALSE
3 (f) When you do a shallow copy of an array, you’ve made another array with the same contents TRUE FALSE (g) You can use a pointer before initializing it. TRUE FALSE (h) is equivalent to a+1 . TRUE FALSE (i) Assume int* pt . Then is the same as pt . TRUE FALSE (j) A function can call itself. TRUE FALSE

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

View Full Document
4 Problem 2 (10 points): Short answer – ﬁll in the following answers. (a) A pointer is simply a: (b) The process of ﬁnding the contents of what a pointer points to is called: (c) The process of ﬁnding the memory address of a variable is: (d) You can initialize a pointer by: (e) When you’re done using a pointer you should:
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 15

practiceFinal - PIC 10A Final Exam NAME(Print Check one...

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

View Full Document
Ask a homework question - tutors are online