Exam #3 Solutions

Exam #3 Solutions - 1 CSE 100: Principles of Programming...

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

View Full Document Right Arrow Icon
CSE 100: Principles of Programming with C++  Department of Computer Science and Engineering Arizona State University, Fall 2007 Midterm III - Solutions 100 Points Your Name:  Solutions Directions:  Total  time for the test is 1  hour and 15 minutes.  Answer all questions.  Show your work  clearly so that you  may get partial points  even if your final an- swer is wrong!)  GOOD LUCK!!! 1)  Indicate whether the statement is true or false. [17 points] Each question worth 1.5 points a) Whenever the value of a reference parameter changes, the value of the actual  parameter   Problem Pag e Possible Your Score 1 1 17 2 2 24 3 5 12 4 6 15 5 7 16 6 8 16 Total 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
Changes  True b) Given the declaration int list[50]; the statement  cout << list << endl;  outputs all 50 components of the array list, one component per line   False c) The declaration char str[] = "Sunny Day"; declares str to be a string of unspecified  length                 False d) The string function strcpy overwrites the value of its first argument  True e) If the value at each index of an array is related to the value at the corresponding index  of a   different array,  the two arrays are parallel  True f) Each row and each column of a two-dimensional array con be considered as a one- dimensional array  True g) As parameters, two-dimensional arrays are passed either by value or by reference.  False h) Suppose we have the following declaration int a[10] = {1}; The above declaration will set all the elements of the array to 1  False      Each question worth 2.5 points a) The following code allows the size of the array to be determined at the execution time  False int n; cin>>n; int array[n]; b) The following statement copy the content of  name1  to name2   True char name1[5] = “Hi”; char name2[3]; strcpy(name2, name1); // We decided to give points for both True and False answers, will explain the reason in the  class                                 2
Background image of page 2
2)  Identify the choice that best completes the statement or answers the question. [24 Points] Each question worth 1.5 point   i)     A reference parameter in a user-defined function allows the function a. to get values into the function from the calling environment. b.
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/29/2008 for the course CSE 100 taught by Professor Computersystems during the Fall '07 term at ASU.

Page1 / 11

Exam #3 Solutions - 1 CSE 100: Principles of Programming...

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

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