1 / 102

Exam 1 Review

Exam 1 Review. Exam 1. A lot of you found the exam to be very difficult as evidenced by some low scores. If you did not do well on the exam, please don’t panic. You will have the chance to make it up. How? We’ll get back to you on that. We are figuring out the details.

Download Presentation

Exam 1 Review

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Exam 1 Review

  2. Exam 1 • A lot of you found the exam to be very difficult as evidenced by some low scores. • If you did not do well on the exam, please don’t panic. You will have the chance to make it up. • How? We’ll get back to you on that. We are figuring out the details. • In the meantime, learn from your mistakes! Take notes and ask questions as we review the exam. • Writing code outside of Eclipse is hard! We will work to ensure you get more practice. • Why is it important to be able to code without an IDE? • Demonstrates that you’ve grasped the concepts and don’t need a crutch to produce good code. • Coding interviews often take place on whiteboards. This is a good skill to develop early on. • I code on paper and whiteboards constantly. It’s often easier when sharing ideas with other developers. • AP exam • In-class exams

  3. Section A: Question 1 All the following are primitive data types: int, char, double, boolean, String a) TRUE b) FALSE

  4. Section A: Question 1 All the following are primitive data types: int, char, double, boolean, String a) TRUE b) FALSE

  5. Section A: Question 2 The following is an example of an implicit cast: inta = (int) (5.0 / 9.0); a) TRUE b) FALSE

  6. Section A: Question 2 The following is an example of an implicit cast: inta = (int) (5.0 / 9.0); a) TRUE b) FALSE

  7. Explicit cast vs. implicit cast An implicit cast occurs when the cast is automatically done by the compiler and no code is required. inti = 3; double d = 3; public static compute(double d) {…} compute(42); An explicit cast requires code from the programmer to inform the compiler of the cast. inti = (int)(Math.sqrt(2));

  8. Section A: Question 3 The concatenation operator is the plus sign. a) TRUE b) FALSE

  9. Section A: Question 3 The concatenation operator is the plus sign. a) TRUE b) FALSE

  10. Section A: Question 4 Adding a double and an int implicitly converts the int variable to a double and the sum is a double. a) TRUE b) FALSE

  11. Section A: Question 4 Adding a double and an int implicitly converts the int variable to a double and the sum is a double. a) TRUE b) FALSE

  12. Section A: Question 5 inta = 9; int b = 5; for (inti = 0; i <= a; i++){ b = b + i; a = a - i; } a) a = -36, b = 9 b) a = -36, b = 50 c) a = 3, b = 11 d) a = 9, b = 50 e) a = 9, b = 11

  13. Section A: Question 5 inta = 9; int b = 5; for (inti = 0; i <= a; i++){ b = b + i; a = a - i; } a = 9 b = 5 i = 0

  14. Section A: Question 5 inta = 9; int b = 5; for (inti= 0; i <= a; i++){ b = b + i; a = a - i; } a= 9 b= 5 i= 0

  15. Section A: Question 5 inta = 9; int b = 5; for (inti= 0; i <= a; i++){ b = b + i; a = a - i; } a = 9 b = 5 i = 0

  16. Section A: Question 5 inta = 9; int b = 5; for (inti= 0; i <= a; i++){ b = b + i; a = a - i; } a = 9 b = 5 i = 0

  17. Section A: Question 5 inta = 9; int b = 5; for (inti= 0; i <= a; i++){ b = b + i; a = a - i; } a = 9 b = 5 i = 1

  18. Section A: Question 5 inta = 9; int b = 5; for (inti= 0; i <= a; i++){ b = b + i; a = a - i; } a = 9 b = 5 i = 1

  19. Section A: Question 5 inta = 9; int b = 5; for (inti= 0; i <= a; i++){ b = b + i; a = a - i; } a = 9 b = 6 i = 1

  20. Section A: Question 5 inta = 9; int b = 5; for (inti= 0; i <= a; i++){ b = b + i; a = a - i; } a = 8 b = 6 i = 1

  21. Section A: Question 5 inta = 9; int b = 5; for (inti= 0; i <= a; i++){ b = b + i; a = a - i; } a = 8 b = 6 i = 2

  22. Section A: Question 5 inta = 9; int b = 5; for (inti= 0; i <= a; i++){ b = b + i; a = a - i; } a = 8 b = 6 i = 2

  23. Section A: Question 5 inta = 9; int b = 5; for (inti= 0; i <= a; i++){ b = b + i; a = a - i; } a = 8 b = 8 i = 2

  24. Section A: Question 5 inta = 9; int b = 5; for (inti= 0; i <= a; i++){ b = b + i; a = a - i; } a = 6 b = 8 i = 2

  25. Section A: Question 5 inta = 9; int b = 5; for (inti= 0; i <= a; i++){ b = b + i; a = a - i; } a = 6 b = 8 i = 3

  26. Section A: Question 5 inta = 9; int b = 5; for (inti= 0; i <= a; i++){ b = b + i; a = a - i; } a = 6 b = 8 i = 3

  27. Section A: Question 5 inta = 9; int b = 5; for (inti= 0; i <= a; i++){ b = b + i; a = a - i; } a = 6 b = 11 i = 3

  28. Section A: Question 5 inta = 9; int b = 5; for (inti= 0; i <= a; i++){ b = b + i; a = a - i; } a = 3 b = 11 i = 3

  29. Section A: Question 5 inta = 9; int b = 5; for (inti= 0; i <= a; i++){ b = b + i; a = a - i; } a = 3 b = 11 i = 4

  30. Section A: Question 5 inta = 9; int b = 5; for (inti= 0; i <= a; i++){ b = b + i; a = a - i; } a = 3 b = 11 i = 4

  31. Section A: Question 5 inta = 9; int b = 5; for (inti = 0; i <= a; i++){ b = b + i; a = a - i; } a) a = -36, b = 9 b) a = -36, b = 50 c) a = 3, b = 11 d) a = 9, b = 50 e) a = 9, b = 11

  32. Section A: Question 6 for (inti = 1; i < 3; i++){ for (int j = 3; j > i; j--){ System.out.print(i+j + " "); } } a) 4 3 5 b) 4 3 5 4 c) 4 3 2 5 4 3 d) 1 3 1 2 2 3 e) 1 3 1 2 2 3 2 2

  33. Section A: Question 6 for (inti = 1; i < 3; i++){ for (int j = 3; j > i; j--){ System.out.print(i+j + " "); } } i = 1 j = output:

  34. Section A: Question 6 for (inti = 1; i < 3; i++){ for (int j = 3; j > i; j--){ System.out.print(i+j + " "); } } i = 1 j = output:

  35. Section A: Question 6 for (inti = 1; i < 3; i++){ for (int j = 3; j > i; j--){ System.out.print(i+j + " "); } } i = 1 j = 3 output:

  36. Section A: Question 6 for (inti = 1; i < 3; i++){ for (int j = 3; j > i; j--){ System.out.print(i+j + " "); } } i = 1 j = 3 output:

  37. Section A: Question 6 for (inti = 1; i < 3; i++){ for (int j = 3; j > i; j--){ System.out.print(i+j + " "); } } i= 1 j= 3 output: 4

  38. Section A: Question 6 for (inti = 1; i < 3; i++){ for (int j = 3; j > i; j--){ System.out.print(i+j + " "); } } i= 1 j= 2 output: 4

  39. Section A: Question 6 for (inti = 1; i < 3; i++){ for (int j = 3; j > i; j--){ System.out.print(i+j + " "); } } i = 1 j = 2 output: 4

  40. Section A: Question 6 for (inti = 1; i < 3; i++){ for (int j = 3; j > i; j--){ System.out.print(i+j + " "); } } i = 1 j = 2 output: 4 3

  41. Section A: Question 6 for (inti = 1; i < 3; i++){ for (int j = 3; j > i; j--){ System.out.print(i+j + " "); } } i = 1 j = 1 output: 4 3

  42. Section A: Question 6 for (inti = 1; i < 3; i++){ for (int j = 3; j > i; j--){ System.out.print(i+j + " "); } } i = 1 j = 1 output: 4 3

  43. Section A: Question 6 for (inti = 1; i < 3; i++){ for (int j = 3; j > i; j--){ System.out.print(i+j + " "); } } i = 2 j = output: 4 3

  44. Section A: Question 6 for (inti = 1; i < 3; i++){ for (int j = 3; j > i; j--){ System.out.print(i+j + " "); } } i= 2 j = output: 4 3

  45. Section A: Question 6 for (inti = 1; i < 3; i++){ for (int j = 3; j > i; j--){ System.out.print(i+j + " "); } } i = 2 j = 3 output: 4 3

  46. Section A: Question 6 for (inti = 1; i < 3; i++){ for (int j = 3; j > i; j--){ System.out.print(i+j + " "); } } i = 2 j = 3 output: 4 3

  47. Section A: Question 6 for (inti = 1; i < 3; i++){ for (int j = 3; j > i; j--){ System.out.print(i+j + " "); } } i = 2 j = 3 output: 4 3 5

  48. Section A: Question 6 for (inti = 1; i < 3; i++){ for (int j = 3; j > i; j--){ System.out.print(i+j + " "); } } i = 2 j= 2 output: 4 3 5

  49. Section A: Question 6 for (inti = 1; i < 3; i++){ for (int j = 3; j > i; j--){ System.out.print(i+j + " "); } } i = 2 j = 2 output: 4 3 5

  50. Section A: Question 6 for (inti = 1; i < 3; i++){ for (int j = 3; j > i; j--){ System.out.print(i+j + " "); } } i = 3 j = output: 4 3 5

More Related