CSE 14 Final: CMPS12A Final Exam Winter 2012

79 views10 pages
31 Jan 2019
School
Course
Professor

Document Summary

This is a closed note, closed book exam. There are ii sections worth a total of 200 points. If you are asked to write code, declare all variables that you use. Unless explicitly permitted, your code may not use any other methods. Write legibly any answer i cannot read is incorrect. System. out. println( 3 ): what does this code print out? int a = h"; switch(a) { case a": system. out. println( a ); case a": system. out. println( a ); break; case h": system. out. println( h ); case h": system. out. println( h ); break; case x": system. out. println( x ); case x": system. out. println( x ); break; H: what does this code print out? class foo { Public static void main(string[] args) { int[] foo = {5, 7, 3}; if (foo[0] > foo[1]) swap(foo, 1, 2); if (foo[1] > foo[2]) swap(foo, 0, 1); if (foo[0] > foo[1]) swap(foo, 0, 2);