practiceFinal

practiceFinal - PIC 10A December 22, 2005 Final Exam NAME...

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

View Full Document Right Arrow Icon
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
Background image of page 1

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

View Full DocumentRight Arrow Icon
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 defined a struct type called data and have declared data* pt . And suppose data has a field (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
Background image of page 2
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
Background image of page 3

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

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

Page1 / 15

practiceFinal - PIC 10A December 22, 2005 Final Exam NAME...

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

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