You are on page 1of 5

UCSD CSE Advisory Placement Exam

You should plan to spend 20 minutes completing this exam. The results of the exam are strictly advisory -- you can choose not to take our recommendation. Our goal is to help you have the most successful experience at UCSD -- so please answer the questions based on your existing knowledge, not by going out and learning something just for this exam.

First Name * Last (Family) Name * UCSD PID (starts with A) * UCSD email address (if you don't know it, a contact email) * Are you a transfer student?* No Yes I don't expect Please select all of the following statements that are true of you to have to work hard in a math course next term at UCSD

I don't expect to have to work hard in an ESL (English as a Second Language) course next term at UCSD Quite a few people in my high school usually go to college I'm not the first generation in my family to go to college I really do not know any programming at all (but, I'm ready to learn!) etc.) of) I haven't taken any programming courses (in high school, community college, There were no programming courses offered at my high school (that I know

I have taken a computing course in high school where we learned another programming language (e.g. python, perl, C++, C#, php). Note: html does not count I have taken a computing course in high school where we learned Java I have significant programming experience, but not taken a formal course I have taken an AP Computer Science course (and got 4 or lower on the exam or didn't take the exam) I have taken an AP Computer Science course and passed the exam with a score of 5

In the following questions, we ask you to analyze some general pseudo code (it may not be perfect Java). If you don't know any programming language, please feel free to pick "I honestly don't know" for all of them. 1. What value is stored in the int variable result (that is a variable that holds an integer) when this statement is executed:
2. int result = 5 + 3 * (4 - 1) / 2;

I honestly don't know 9 9.5 12 15 15.5 3. Assume that x and z are both int variables (that is, variables that hold integer values). Consider the following code segment:
4. if ( x == 0 ) { 5. z = z + 2; 6. } else { 7. z = z + 4; 8. } 9. 10. System.out.println( z );

What is printed if x and z are both equal to zero before the code segment executes? I honestly don't know 0 2 4 6 None of the above 11. How many times is UCSD printed?
12. 13. 14. 15. 16. 17. int x = 100; int y = 10; while (x > y) { System.out.println("UCSD"); x--; //Same as x = x - 1

18.

I honestly don't know 0 90 91 An infinite number of times, the loop does not stop None of the above 19. What value is printed when this code executes?
20. 21. 22. 23. 24. 25. 26. 27. 28. int x[] = {2,4,6,8}; int foo = 0; for (int i = 0; i < x.length; i++) { foo += x[i]; //Same as foo = foo + x[i]; } foo = foo / x.length; System.out.println( foo );

I honestly don't know 0 4 5 20 None of the above 29. Consider the following code:
30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. public static int f( int c, int d ) { if ( c < d ) return g( c ); else return g( d ); } public static int g( int e ) { return e + e; }

What is the value returned when calling the code with

f( 2, 13 );

I honestly don't know 2 4 13 15 26 42. The following code is supposed to produce this output
43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. * ** *** for (int i = 0; i < 3; i++) { XXXXX { System.out.print("*"); } System.out.println(); }

What line of code should replace XXXXX I honestly don't know


for (int j = 0; j < 3; j++) for (int i = 0; i < 3; i++) for (int j = 0; j < i; j++) for (int j = 0; i < j; j++)

None of the above HOW DOES i LINK WITH j?????????????????????????????????????/

54. Assume that method readInt() reads and returns one integer value.
55. 56. 57. 58. 59. 60. 1 2 3 4 5 6 int x, sum; sum = 1; x = readInt(); while ( x >= 0 ) { if ( !(x<0) ) { sum = sum + x;

61. 62. 63. 64.

7 8 9 10

} x = readInt(); } System.out.println( sum );

Which line could be removed from the code segment given above so that the resulting code segment is equivalent to the original one? I honestly don't know Line 2 Line 3 Line 4 Line 5 Line 6 Line 8 65. Consider the method readInt() from the previous question. The code segment given was intended to read values until a negative number was read and then to print the sum of the positive values read. However, the code does not work as intended. Which of the following best describes the error? I honestly don't know Variable x is not initialized correctly. Variable sum is not initialized correctly. Variable x is used before being initialized. Variable sum is used before being initialized. The negative value intended to signal end of input is included in the sum. WHAT DOES THIS MEAN????

Submit

Generated by phpFormGenerator

You might also like