key2_06f

key2_06f - Exam 2 PIC 10A Fall 2006 NAME Check your TAs...

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

View Full Document Right Arrow Icon
Exam 2, 11/20/06 PIC 10A, Fall 2006 NAME: _________________________________________________ Check your TA’s name: _____ Pascal _____ Nick You have 50 minutes to complete this exam. You are not allowed to use any books, notes, calculators, or electronic devices. Write your answers carefully. Incomplete, unintelligible, or illegible answers will receive little or no credit. When you are asked to write a program, it is not necessary to comment your code but you are expected to indent appropriately to make your code easier to follow. There are a total of 100 points on this exam. PAGE SCORE POSSIBLE 1 22 2 14 3 14 4 20 5 30 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
1.) [6 points] Briefly explain the difference between value and reference parameters. How are they differentiated in C++ syntax? For a value parameter, the compiler creates a local copy of the variable so any changes to that variable will not be reflected in the function that called it. A reference parameter passes the address of the variable, so any changes will be recorded. A value parameter is the default type for C++; a reference parameter needs an "&" after the data type. 2.) [6 points] What does the srand function do and why is it useful? The srand function seeds the random number generator with a given integer, usually the current time. Without seeding, the function rand will produce the same list of numbers
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/28/2008 for the course PIC 10A taught by Professor Wittman during the Spring '08 term at UCLA.

Page1 / 7

key2_06f - Exam 2 PIC 10A Fall 2006 NAME Check your TAs...

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

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