sample-midterm

sample-midterm - Programming & Software Development...

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

View Full Document Right Arrow Icon
1 Programming & Software Development CSCI 455 SAMPLE MIDTERM Dr. K. Narayanaswamy Midterm Examination You have 75 minutes to complete this examination. OPEN BOOK AND OPEN NOTES: -- you can use any and all reference materials. (Laptops and cell phones are NOT allowed) YOU MUST ANSWER ALL QUESTIONS. PART I (which starts on Page 2 and ends on Page 7) contains very brief questions, mostly of the multiple choice variety, and some that require brief responses within the provided spaces. In PART II , which starts on page 8, there are 5 questions in all. These questions require longer responses. If you need more space (which should not normally be the case), make a note that your answer is continued overleaf, and write on the back of the page. NAME: ________________________________ STUDENT ID: _____________ QUESTION MAXIMUM SCORE PART I 50 PART II 50 Question 1 10 Question 2 10 Question 3 10 Question 4 10 Question 5 10 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 PART I : Requires relatively brief answers. Most are multiple choice. Unless noted otherwise, each question is worth 1 point. Questions 1, 2, 3, 4, 5, 6, 7, 8 and 9 are based on code below: void myfun (int x, int & y) { int temp = x; x = y; y = temp; } 1. Name a formal parameter in the function above: 2. Name a parameter passed by reference: 3. Name a parameter passed by value: 4. “temp” is best termed: a) Value parameter b) Reference parameter c) Local variable d) none of the above 5. The type of results returned by the function “myfun” is: a) int b) short c) float d) no result returned 6. In the main program, if you have the following code: int a = 3, b=5; myfun(a, b); the identifiers “a” and “b” are called: a) actual parameters b) local variables c) formal parameters d) local parameters 7. The value of the variable “a” after “myfun” is called in the main program as above: a) 6 b) 12 c) 8 d) 3 8. The value of the variable “b” after “myfun” is called in the main program as above: a) 6 b) 12 c) 8 d) 3 9. Typical C++ programs will have a main() function a.True b.False 10. What kind of loop is best if we wish to execute the loop body at least once before we test the loop condition? a) for b) while c) do/while d) none of these
Background image of page 2
3 11. What kind of loop is appropriate most of the time with arrays? a) for b) while c) do/while d) none of these 12. What is wrong with the following declaration? char x = "x"; a) Nothing b) The double quotes should be single quotes c) Characters cannot be initialized d) The word “ char” should be replaced by “int” In the context of the following declaration (assuming <string> and <ctype.h> are included by the programmer) (for questions 13, 14, 15) string x = “123Bob”, y = “Jane456”, z; 13. A call “x.empty( )” would yield what value?
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.

Page1 / 12

sample-midterm - Programming &amp; Software Development...

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