Exam JP2011(Java Programming) MidTerm Test 5/ Name RegNo % 1 is. a) 1 b) 2 c) 3 d) 4 e) 0
|
|
- Adele Phillips
- 7 years ago
- Views:
Transcription
1 Exam JP2011(Java Programming) MidTerm Test 5/ Name RegNo % 1 is. a) 1 b) 2 c) 3 d) 4 e) % -5 is. a) 3 b) -3 c) 4 d) -4 e) 0 3. Which of these data types requires the most amount of memory? a) long b) int c) byte d) short 4. What is the printout of the following code: double x = 5.5; int y = (int)x; System.out.println(ʺx is ʺ + x + ʺ and y is ʺ + y); a) x is 5.5 and y is 5.0 b) x is 6 and y is 6 c) x is 5 and y is 6 d) x is 5.5 and y is 5 e) x is 6.0 and y is Suppose x is 1. What is x after x -= 1? a) 0 b) 1 c) 2 d) -1 e) The expression ʺJava ʺ evaluates to. a) java 123 b) Java 123 c) Java6 d) Java123 e) Illegal expression 7. What is == 5.0? a) true b) false c) There is no guarantee that == 5.0 is true. 8. What is the printout of the following switch statement? char ch = ʹbʹ; switch (ch) { case ʹaʹ: System.out.print(ch); case ʹbʹ: System.out.print(ch); case ʹcʹ: System.out.print(ch); case ʹdʹ: System.out.print(ch); a) abcd b) bb c) bcd d) b e) bbb 9. The following code displays. double temperature = 50; if (temperature >= 100) System.out.println(ʺtoo hotʺ); else if (temperature <= 40) System.out.println(ʺtoo coldʺ); else System.out.println(ʺjust rightʺ); a) too cold b) just right c) too hot d) too hot too cold just right 10. What is the number of iterations in the following loop: for (int i = 1; i < n; i++) { // iteration a) n + 1 b) n - 1 c) 2*n d) n 11. (int)(ʹaʹ + Math.random() * (ʹzʹ - ʹaʹ + 1)) returns a random number. a) between (int)ʹaʹ and (int)ʹzʹ b) between ʹaʹ and ʹzʹ c) between ʹaʹ and ʹyʹ d) between 0 and (int)ʹzʹ 1
2 12. Analyze the following code fragments that assign a boolean value to the variable even. Code 1: if (number % 2 == 0) even = true; else even = false; Code 2: even = (number % 2 == 0)? true: false; Code 3: even = number % 2 == 0; a) Code 2 has a compile error, because you cannot have true and false literals in the conditional expression. b) All three are correct, but Code 2 is preferred. c) All three are correct, but Code 1 is preferred. d) All three are correct, but Code 3 is preferred. e) Code 3 has a compile error, because you attempt to assign number to even. 13. How many times will the following code print ʺWelcome to Javaʺ? int count = 0; do { System.out.println(ʺWelcome to Javaʺ); while (++count < 10); a) 8 b) 10 c) 9 d) 11 e) How many times will the following code print ʺWelcome to Javaʺ? int count = 0; do { System.out.println(ʺWelcome to Javaʺ); count++; while (count < 10); 15. Analyze the following fragment: double sum = 0; double d = 0; while (d!= 10.0) { d += 0.1; sum += sum + d; a) The program never stops because d is always 0.1 inside the loop. b) The program may not stop because of the phenomenon referred to as numerical inaccuracy for operating with floating-point numbers. c) After the loop, sum is d) The program does not compile because sum and d are declared double, but assigned with integer value Will the following program terminate? int balance = 10; while (true) { if (balance < 9) break; balance = balance - 9; a) Yes b) No 17. Which of the following statements are correct to invoke the printmax method in Listing 6.5 in the textbook? (Choose all that apply.) a) printmax(new double[ ]{1, 2, 3); b) printmax(1.0, 2.0, 2.0, 1.0, 4.0); c) printmax(1, 2, 2, 1, 4); d) printmax(new int[ ]{1, 2, 3); 18. What is Math.ceil(3.6)? a) 4.0 b) 3 c) 5.0 d) 3.0 a) 9 b) 10 c) 0 d) 11 e) 8 2
3 19. The selectionsort method is defined in this section. What is list1 after executing the following statements? double[ ] list1 = {3.1, 3.1, 2.5, 6.4; selectionsort(list1); a) list1 is 3.1, 2.5, 3.1, 6.4 b) list1 is 6.4, 3.1, 3.1, 2.5 c) list1 is 3.1, 3.1, 2.5, 6.4 d) list1 is , 3.1, Analyze the following code: class Test { System.out.println(xmethod(5)); public static int xmethod(int n, long t) { System.out.println(ʺintʺ); return n; public static long xmethod(long n) { System.out.println(ʺlongʺ); return n; a) The program displays long followed by 5. b) The program displays int followed by 5. c) The program runs fine but displays things other than 5. d) The program does not compile because the compiler cannot distinguish which xmethod to invoke. 22. What is k after the following block executes? { int k = 2; nprint(ʺa messageʺ, k); System.out.println(k); a) 1 b) 2 c) 0 d) k is not defined outside the block. So, the program has a compile error 23. In the following code, what is the printout for list2? class Test { int[ ] list1 = {1, 2, 3; int[ ] list2 = {1, 2, 3; list2 = list1; list1[0] = 0; list1[1] = 1; list2[2] = 2; for (int i = 0; i < list2.length; i++) System.out.print(list2[i] + ʺ ʺ); a) b) c) d) Which of the following statements is valid? (Choose all that apply.) a) double d[ ] = new double[30]; b) int[ ] i = {3, 4, 3, 2; c) int i = new int(30); d) char[ ] c = new char(); e) char[ ] c = new char[4]{ʹaʹ, ʹbʹ, ʹcʹ, ʹdʹ; 21. The keyword is required to declare a class. a) class b) public c) private d) All of the above. 3
4 25. Show the output of the following code: int[ ] x = {1, 2, 3, 4, 5; increase(x); int[ ] y = {1, 2, 3, 4, 5; increase(y[0]); System.out.println(x[0] + ʺ ʺ + y[0]); public static void increase(int[ ] x) { for (int i = 0; i < x.length; i++) x[i]++; public static void increase(int y) { y++; a) 2 1 b) 2 2 c) 1 2 d) 1 1 e) The default value for data field of a boolean type, numeric type, object type is, respectively. a) false, 1, null b) true, 0, null c) true, 1, Null d) true, 1, null e) false, 0, null 27. Suppose you wish to provide an accessor method for a boolean property finished, what signature of the method should be? a) public void getfinished() b) public boolean isfinished() c) public void isfinished() d) public boolean getfinished() 29. Analyze the following code: boolean[ ][ ] x = new boolean[3][ ]; x[0] = new boolean[1]; x[1] = new boolean[2]; x[2] = new boolean[3]; System.out.println(ʺx[2][2] is ʺ + x[2][2]); a) The program has a compile error because new boolean[3][ ] is wrong. b) The program runs and displays x[2][2] is true. c) The program runs and displays x[2][2] is false. d) The program has a runtime error because x[2][2] is null. e) The program runs and displays x[2][2] is null. 30. When invoking a method with an object argument, is passed. a) the reference of the object b) a copy of the object c) the object is copied, then the reference of the copied object d) the contents of the object 31. Suppose a method p has the following heading: public static int[ ][ ] p() What return statement may be used in p()? a) return int[ ]{1, 2, 3; b) return new int[ ][ ]{{1, 2, 3, {2, 4, 5; c) return new int[ ]{1, 2, 3; d) return {1, 2, 3; e) return 1; 28. An object is an instance of a. a) class b) method c) program d) data 4
5 32. What is the value of mycount.count displayed? Count mycount = new Count(); int times = 0; for (int i=0; i<100; i++) increment(mycount, times); System.out.println( ʺmyCount.count = ʺ + mycount.count); System.out.println(ʺtimes = ʺ+ times); public static void increment(count c, int times) { c.count++; times++; class Count { int count; Count(int c) { count = c; Count() { count = 1; a) 99 b) 100 c) 101 d) Assume s is ʺABCABCʺ, the method returns a new string ʺaBCaBCʺ. a) s.replace(ʺabcabcʺ, ʺaBCaBCʺ) b) s.replace(ʹaʹ, ʹAʹ) c) s.tolowercase(s) d) s.replace(ʹaʹ, ʹaʹ) e) s.tolowercase() 34. Suppose Character x = new Character(ʹaʹ), returns true. (Choose all that apply.) a) x.comparetoignorecase(ʹaʹ) b) x.equals(ʹaʹ) c) x.equals(ʺaʺ) d) x.equalsignorecase(ʹaʹ) e) x.equals(new Character(ʹaʹ)) 35. Analyze the following code: (Choose all that apply.) A a = new A(); a.print(); class A { String s; A(String s) { this.s = s; void print() { System.out.println(s); a) The program would compile and run if you change A a = new A() to A a = new A(ʺ5ʺ). b) The program has a compilation error because class A does not have a default constructor. c) The program compiles and runs fine and prints nothing. d) The program has a compilation error because class A is not a public class. 36. is invoked to create an object. a) A method with a return type b) The main method c) A constructor d) A method with the void return type 5
6 37. Analyze the following code and choose the best answer: public class Foo { private int x; Foo foo = new Foo(); System.out.println(foo.x); a) Since x is private, it cannot be accessed from an object foo. b) You cannot create a self-referenced object; that is, foo is created inside the class Foo. c) Since x is an instance variable, it cannot be directly used inside a main method. However, it can be accessed through an object such as foo in this code. d) Since x is defined in the class Foo, it can be accessed by any method inside the class without using an object. You can write the code to access x without creating an object such as foo in this code. 38. Which of the following is the correct header of the main method? (Choose all that apply.) a) public static void main(string x[ ]) b) public static void main(string[ ] args) c) public static void main(string args[ ]) d) static void main(string[ ] args) e) public static void main(string[ ] x) 39. Which of the following statements creates an instance of File on Window for the file c:\t.txt? a) new File(ʺc://txt.txtʺ) b) new File(ʺc:/txt.txtʺ) c) new File(ʺc:\\txt.txtʺ) d) new File(ʺc:\txt.txtʺ) 40. Suppose ArrayList x contains two strings [Beijing, Singapore]. Which of the following methods will cause the list to become [Beijing, Chicago, Singapore]? a) x.add(ʺchicagoʺ) b) x.add(1, ʺChicagoʺ) c) x.add(0, ʺChicagoʺ) d) x.add(2, ʺChicagoʺ) 41. What is the output of the following code? String s1 = ʺWelcome to Java!ʺ; String s2 = s1; if (s1 == s2) System.out.println(ʺs1 and s2 reference to the same String objectʺ); else System.out.println(ʺs1 and s2 reference to different String objectsʺ); a) s1 and s2 reference to different String objects b) s1 and s2 reference to the same String object 42. Analyze the following code: (Choose all that apply.) Object a1 = new A(); Object a2 = new Object(); System.out.println(a1); System.out.println(a2); class A { int x; public String tostring() { return ʺAʹs x is ʺ + x; a) When executing System.out.println(a2), the tostring() method in the Object class is invoked. b) The program cannot be compiled, because System.out.println(a1) is wrong and it should be replaced by System.out.println(a1.toString()); c) When executing System.out.println(a1), the tostring() method in the Object class is invoked. d) When executing System.out.println(a1), the tostring() method in the A class is invoked. 6
7 43. Suppose ArrayList x contains two strings [Beijing, Singapore]. Which of the following method will cause runtime errors? (Choose all that apply.) a) x.remove(2) b) x.get(2) c) x.set(2, ʺNew Yorkʺ); d) x.get(1) e) x.size() 44. You can create an ArrayList using. a) ArrayList() b) new ArrayList() c) new ArrayList[ ] d) new ArrayList[100] 45. Which of the following statements are true? (Choose all that apply.) a) A method may be implemented in several subclasses. The Java Virtual Machine dynamically binds the implementation of the method at runtime. b) You can always pass an instance of a subclass to a parameter of its superclass type. This feature is known as polymorphism. c) The compiler finds a matching method according to parameter type, number of parameters, and order of the parameters at compilation time. d) Dynamic binding can apply to static methods. e) Dynamic binding can apply to instance methods. 46. Which of the following statements are true? (Choose all that apply.) a) A method can be overridden in the same class. b) If a method overrides another method, these two methods must have the same signature. c) If a method overloads another method, these two methods must have the same signature. d) A method can be overloaded in the same class. 47. To create an instance of BigDecimal for , use a) new BigDecimal(ʺ454.45ʺ); b) BigInteger(454.45); c) BigInteger(ʺ454.45ʺ); d) new BigInteger(454.45); 48. Suppose A is an abstract class, B is a concrete subclass of A, and both A and B have a default constructor. Which of the following is correct? (Choose all that apply.) a) A a = new A(); b) B b = new B(); c) A a = new B(); d) B b = new A(); 49. What is the output of the following code: Object o1 = new Object(); Object o2 = new Object(); System.out.print((o1 == o2) + ʺ ʺ + (o1.equals(o2))); a) false true b) false false c) true true d) true false 50. Object-oriented programming allows you to derive new classes from existing classes. This is called. a) generalization b) abstraction c) encapsulation d) inheritance 51. Analyze the following code: (Choose all that apply.) ArrayList list = new ArrayList(); list.add(ʺbeijingʺ); list.add(ʺtokyoʺ); list.add(ʺshanghaiʺ); list.set(3, ʺHong Kongʺ); a) The last line in the code causes a runtime error because there is no element at index 3 in the array list. b) If you replace the last line by list.add(4, ʺHong Kongʺ), the code will compile and run fine. c) If you replace the last line by list.add(3, ʺHong Kongʺ), the code will compile and run fine. d) The last line in the code has a compile error because there is no element at index 3 in the array list. 7
8 52. Assume Calendar calendar = new GregorianCalendar(). returns the number of days in a month. a) calendar.get(calendar.week_of_year) b) calendar.getactualmaximum(calendar.day_of_month) c) calendar.get(calendar.month_of_year) d) calendar.get(calendar.month) e) calendar.get(calendar.week_of_month) 53. Given the following code, find the compile error. (Choose all that apply.) m(new GraduateStudent()); m(new Student()); m(new Person()); m(new Object()); public static void m(student x) { System.out.println(x.toString()); class GraduateStudent extends Student { class Student extends Person { public String tostring() { return ʺStudentʺ; class Person extends Object { public String tostring() { return ʺPersonʺ; a) m(new Person()) causes an error b) m(new Object()) causes an error c) m(new Student()) causes an error d) m(new GraduateStudent()) causes an error 54. Suppose A is an interface, B is a concrete class with a default constructor that implements A. Which of the following is correct? (Choose all that apply.) a) A a = new B(); b) B b = new B(); c) B b = new A(); d) A a = new A(); 55. is a reference type. (Choose all that apply.) a) An interface type b) A class type c) A primitive type d) An array type 56. Which statements are most accurate regarding the following classes? class A { private int i; protected int j; class B extends A { private int k; protected int m; a) An object of B contains data fields j, m. b) An object of B contains data fields k, m. c) An object of B contains data fields i, j, k, m. d) An object of B contains data fields j, k, m. 57. Which of the following statements are true? (Choose all that apply.) a) If you compile an interface without errors, a.class file is created for the interface. b) If you compile an interface without errors, but with warnings, a.class file is created for the interface. c) If you compile a class without errors but with warnings, a.class file is created. d) If you compile a class with errors, a.class file is created for the class. 58. is a reference type. (Choose all that apply.) a) An array type b) A primitive type c) An interface type d) A class type 59. Which of the following classes are immutable? (Choose all that apply.) a) Double b) BigDecimal c) String d) Integer e) BigInteger 60. To assign a double variable d to a float variable x, you write a) x = (int)d; b) x = d; c) x = (long)d d) x = (float)d; 8
9 Answer Key Testname: JP2011MIDTERMTESTV2 1. e 2. d 3. a 4. d 5. a 6. b 7. c 8. e 9. b 10. b 11. a 12. d 13. b 14. b 15. b 16. a 17. a, b, c 18. a 19. d 20. a 21. a 22. d 23. a 24. a, b 25. a 26. e 27. b 28. a 29. c 30. a 31. b 32. c 33. d 34. b, e 35. a, b 36. c 37. c 38. a, b, c, e 39. c 40. b 41. b 42. a, d 43. a, b, c 44. b 45. a, b, c, e 46. b, d 47. a 48. b, c 49. b 50. d 51. a, c 52. b 53. a, b 54. a, b 55. a, b, d 56. c 57. a, b, c 58. a, c, d 59. a, b, c, d, e 60. d 9
10
MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.
Exam Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) The JDK command to compile a class in the file Test.java is A) java Test.java B) java
More informationMasters programmes in Computer Science and Information Systems. Object-Oriented Design and Programming. Sample module entry test xxth December 2013
Masters programmes in Computer Science and Information Systems Object-Oriented Design and Programming Sample module entry test xxth December 2013 This sample paper has more questions than the real paper
More informationJ a v a Quiz (Unit 3, Test 0 Practice)
Computer Science S-111a: Intensive Introduction to Computer Science Using Java Handout #11 Your Name Teaching Fellow J a v a Quiz (Unit 3, Test 0 Practice) Multiple-choice questions are worth 2 points
More informationJava Interview Questions and Answers
1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write and compile the java
More informationObject-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007
Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007 The Java Type System By now, you have seen a fair amount of Java. Time to study in more depth the foundations of the language,
More informationAP Computer Science Java Subset
APPENDIX A AP Computer Science Java Subset The AP Java subset is intended to outline the features of Java that may appear on the AP Computer Science A Exam. The AP Java subset is NOT intended as an overall
More informationPart I. Multiple Choice Questions (2 points each):
Part I. Multiple Choice Questions (2 points each): 1. Which of the following is NOT a key component of object oriented programming? (a) Inheritance (b) Encapsulation (c) Polymorphism (d) Parallelism ******
More informationClasses and Objects in Java Constructors. In creating objects of the type Fraction, we have used statements similar to the following:
In creating objects of the type, we have used statements similar to the following: f = new (); The parentheses in the expression () makes it look like a method, yet we never created such a method in our
More informationThe C Programming Language course syllabus associate level
TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming
More informationHandout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.
Handout 1 CS603 Object-Oriented Programming Fall 15 Page 1 of 11 Handout 1 Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Java
More informationFree Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program
Free Java textbook available online "Thinking in Java" by Bruce Eckel, 4th edition, 2006, ISBN 0131872486, Pearson Education Introduction to the Java programming language CS 4354 Summer II 2014 Jill Seaman
More informationFree Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program
Free Java textbook available online "Thinking in Java" by Bruce Eckel, 4th edition, 2006, ISBN 0131872486, Pearson Education Introduction to the Java programming language CS 4354 Summer II 2015 The third
More informationIntroduction to Java
Introduction to Java The HelloWorld program Primitive data types Assignment and arithmetic operations User input Conditional statements Looping Arrays CSA0011 Matthew Xuereb 2008 1 Java Overview A high
More informationJava Interfaces. Recall: A List Interface. Another Java Interface Example. Interface Notes. Why an interface construct? Interfaces & Java Types
Interfaces & Java Types Lecture 10 CS211 Fall 2005 Java Interfaces So far, we have mostly talked about interfaces informally, in the English sense of the word An interface describes how a client interacts
More informationProblem 1. CS 61b Summer 2005 Homework #2 Due July 5th at the beginning of class
CS 61b Summer 2005 Homework #2 Due July 5th at the beginning of class This homework is to be done individually. You may, of course, ask your fellow classmates for help if you have trouble editing files,
More informationJava Application Developer Certificate Program Competencies
Java Application Developer Certificate Program Competencies After completing the following units, you will be able to: Basic Programming Logic Explain the steps involved in the program development cycle
More informationC++FA 5.1 PRACTICE MID-TERM EXAM
C++FA 5.1 PRACTICE MID-TERM EXAM This practicemid-term exam covers sections C++FA 1.1 through C++FA 1.4 of C++ with Financial Applications by Ben Van Vliet, available at www.benvanvliet.net. 1.) A pointer
More informationCS 111 Classes I 1. Software Organization View to this point:
CS 111 Classes I 1 Software Organization View to this point: Data Objects and primitive types Primitive types operators (+, /,,*, %). int, float, double, char, boolean Memory location holds the data Objects
More informationCohort: BCA/07B/PT - BCA/06/PT - BCNS/06/FT - BCNS/05/FT - BIS/06/FT - BIS/05/FT - BSE/05/FT - BSE/04/PT-BSE/06/FT
BSc (Hons) in Computer Applications, BSc (Hons) Computer Science with Network Security, BSc (Hons) Business Information Systems & BSc (Hons) Software Engineering Cohort: BCA/07B/PT - BCA/06/PT - BCNS/06/FT
More informationComputer Programming I
Computer Programming I COP 2210 Syllabus Spring Semester 2012 Instructor: Greg Shaw Office: ECS 313 (Engineering and Computer Science Bldg) Office Hours: Tuesday: 2:50 4:50, 7:45 8:30 Thursday: 2:50 4:50,
More informationFirst Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science
First Java Programs V. Paúl Pauca Department of Computer Science Wake Forest University CSC 111D Fall, 2015 Hello World revisited / 8/23/15 The f i r s t o b l i g a t o r y Java program @author Paul Pauca
More informationJava Cheatsheet. http://introcs.cs.princeton.edu/java/11cheatsheet/ Tim Coppieters Laure Philips Elisa Gonzalez Boix
Java Cheatsheet http://introcs.cs.princeton.edu/java/11cheatsheet/ Tim Coppieters Laure Philips Elisa Gonzalez Boix Hello World bestand genaamd HelloWorld.java naam klasse main methode public class HelloWorld
More informationCS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013
Oct 4, 2013, p 1 Name: CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 1. (max 18) 4. (max 16) 2. (max 12) 5. (max 12) 3. (max 24) 6. (max 18) Total: (max 100)
More informationPreet raj Core Java and Databases CS4PR. Time Allotted: 3 Hours. Final Exam: Total Possible Points 75
Preet raj Core Java and Databases CS4PR Time Allotted: 3 Hours Final Exam: Total Possible Points 75 Q1. What is difference between overloading and overriding? 10 points a) In overloading, there is a relationship
More informationFundamentals of Java Programming
Fundamentals of Java Programming This document is exclusive property of Cisco Systems, Inc. Permission is granted to print and copy this document for non-commercial distribution and exclusive use by instructors
More informationJava CPD (I) Frans Coenen Department of Computer Science
Java CPD (I) Frans Coenen Department of Computer Science Content Session 1, 12:45-14:30 (First Java Programme, Inheritance, Arithmetic) Session 2, 14:45-16:45 (Input and Programme Constructs) Materials
More informationHabanero Extreme Scale Software Research Project
Habanero Extreme Scale Software Research Project Comp215: Java Method Dispatch Zoran Budimlić (Rice University) Always remember that you are absolutely unique. Just like everyone else. - Margaret Mead
More informationJava (12 Weeks) Introduction to Java Programming Language
Java (12 Weeks) Topic Lecture No. Introduction to Java Programming Language 1 An Introduction to Java o Java as a Programming Platform, The Java "White Paper" Buzzwords, Java and the Internet, A Short
More informationInheritance, overloading and overriding
Inheritance, overloading and overriding Recall with inheritance the behavior and data associated with the child classes are always an extension of the behavior and data associated with the parent class
More informationjava Features Version April 19, 2013 by Thorsten Kracht
java Features Version April 19, 2013 by Thorsten Kracht Contents 1 Introduction 2 1.1 Hello World................................................ 2 2 Variables, Types 3 3 Input/Output 4 3.1 Standard I/O................................................
More informationJAVA - QUICK GUIDE. Java SE is freely available from the link Download Java. So you download a version based on your operating system.
http://www.tutorialspoint.com/java/java_quick_guide.htm JAVA - QUICK GUIDE Copyright tutorialspoint.com What is Java? Java is: Object Oriented Platform independent: Simple Secure Architectural- neutral
More informationHow To Write A Program In Java (Programming) On A Microsoft Macbook Or Ipad (For Pc) Or Ipa (For Mac) (For Microsoft) (Programmer) (Or Mac) Or Macbook (For
Projet Java Responsables: Ocan Sankur, Guillaume Scerri (LSV, ENS Cachan) Objectives - Apprendre à programmer en Java - Travailler à plusieurs sur un gros projet qui a plusieurs aspects: graphisme, interface
More informationJava Programming Fundamentals
Lecture 1 Part I Java Programming Fundamentals Topics in Quantitative Finance: Numerical Solutions of Partial Differential Equations Instructor: Iraj Kani Introduction to Java We start by making a few
More informationCSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals
CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals 1 Recall From Last Time: Java Program import java.util.scanner; public class EggBasket { public static void main(string[]
More informationSoftware Testing. Definition: Testing is a process of executing a program with data, with the sole intention of finding errors in the program.
Software Testing Definition: Testing is a process of executing a program with data, with the sole intention of finding errors in the program. Testing can only reveal the presence of errors and not the
More informationCOSC 1020 3.0 Introduction to Computer Science I Section A, Summer 2005. Question Out of Mark A Total 16. B-1 7 B-2 4 B-3 4 B-4 4 B Total 19
Term Test #2 COSC 1020 3.0 Introduction to Computer Science I Section A, Summer 2005 Family Name: Given Name(s): Student Number: Question Out of Mark A Total 16 B-1 7 B-2 4 B-3 4 B-4 4 B Total 19 C-1 4
More informationC++ INTERVIEW QUESTIONS
C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get
More informationCS193j, Stanford Handout #10 OOP 3
CS193j, Stanford Handout #10 Summer, 2003 Manu Kumar OOP 3 Abstract Superclass Factor Common Code Up Several related classes with overlapping code Factor common code up into a common superclass Examples
More informationEl Dorado Union High School District Educational Services
El Dorado Union High School District Course of Study Information Page Course Title: ACE Computer Programming II (#495) Rationale: A continuum of courses, including advanced classes in technology is needed.
More informationJAVA - METHODS. Method definition consists of a method header and a method body. The same is shown below:
http://www.tutorialspoint.com/java/java_methods.htm JAVA - METHODS Copyright tutorialspoint.com A Java method is a collection of statements that are grouped together to perform an operation. When you call
More informationJDK 1.5 Updates for Introduction to Java Programming with SUN ONE Studio 4
JDK 1.5 Updates for Introduction to Java Programming with SUN ONE Studio 4 NOTE: SUN ONE Studio is almost identical with NetBeans. NetBeans is open source and can be downloaded from www.netbeans.org. I
More informationGlossary of Object Oriented Terms
Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction
More informationIntroduction to Java. CS 3: Computer Programming in Java
Introduction to Java CS 3: Computer Programming in Java Objectives Begin with primitive data types Create a main class with helper methods Learn how to call built-in class methods and instance methods
More informationMoving from CS 61A Scheme to CS 61B Java
Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you
More informationJava Basics: Data Types, Variables, and Loops
Java Basics: Data Types, Variables, and Loops If debugging is the process of removing software bugs, then programming must be the process of putting them in. - Edsger Dijkstra Plan for the Day Variables
More informationSample CSE8A midterm Multiple Choice (circle one)
Sample midterm Multiple Choice (circle one) (2 pts) Evaluate the following Boolean expressions and indicate whether short-circuiting happened during evaluation: Assume variables with the following names
More informationCrash Course in Java
Crash Course in Java Based on notes from D. Hollinger Based in part on notes from J.J. Johns also: Java in a Nutshell Java Network Programming and Distributed Computing Netprog 2002 Java Intro 1 What is
More informationDescription of Class Mutation Mutation Operators for Java
Description of Class Mutation Mutation Operators for Java Yu-Seung Ma Electronics and Telecommunications Research Institute, Korea ysma@etri.re.kr Jeff Offutt Software Engineering George Mason University
More informationExplain the relationship between a class and an object. Which is general and which is specific?
A.1.1 What is the Java Virtual Machine? Is it hardware or software? How does its role differ from that of the Java compiler? The Java Virtual Machine (JVM) is software that simulates the execution of a
More informationChapter 1 Fundamentals of Java Programming
Chapter 1 Fundamentals of Java Programming Computers and Computer Programming Writing and Executing a Java Program Elements of a Java Program Features of Java Accessing the Classes and Class Members The
More informationChapter 1 Java Program Design and Development
presentation slides for JAVA, JAVA, JAVA Object-Oriented Problem Solving Third Edition Ralph Morelli Ralph Walde Trinity College Hartford, CT published by Prentice Hall Java, Java, Java Object Oriented
More informationJava SE 8 Programming
Oracle University Contact Us: 1.800.529.0165 Java SE 8 Programming Duration: 5 Days What you will learn This Java SE 8 Programming training covers the core language features and Application Programming
More informationPemrograman Dasar. Basic Elements Of Java
Pemrograman Dasar Basic Elements Of Java Compiling and Running a Java Application 2 Portable Java Application 3 Java Platform Platform: hardware or software environment in which a program runs. Oracle
More informationPart 3: GridWorld Classes and Interfaces
GridWorld Case Study Part 3: GridWorld Classes and Interfaces In our example programs, a grid contains actors that are instances of classes that extend the Actor class. There are two classes that implement
More informationlanguage 1 (source) compiler language 2 (target) Figure 1: Compiling a program
CS 2112 Lecture 27 Interpreters, compilers, and the Java Virtual Machine 1 May 2012 Lecturer: Andrew Myers 1 Interpreters vs. compilers There are two strategies for obtaining runnable code from a program
More informationCS 106 Introduction to Computer Science I
CS 106 Introduction to Computer Science I 01 / 21 / 2014 Instructor: Michael Eckmann Today s Topics Introduction Homework assignment Review the syllabus Review the policies on academic dishonesty and improper
More informationObject Oriented Software Design
Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 28, 2010 G. Lipari (Scuola Superiore Sant Anna) Introduction
More informationThe Sun Certified Associate for the Java Platform, Standard Edition, Exam Version 1.0
The following applies to all exams: Once exam vouchers are purchased you have up to one year from the date of purchase to use it. Each voucher is valid for one exam and may only be used at an Authorized
More informationExample of a Java program
Example of a Java program class SomeNumbers static int square (int x) return x*x; public static void main (String[] args) int n=20; if (args.length > 0) // change default n = Integer.parseInt(args[0]);
More informationObject Oriented Software Design
Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa September 14, 2011 G. Lipari (Scuola Superiore Sant Anna) Introduction
More informationSE 360 Advances in Software Development Object Oriented Development in Java. Polymorphism. Dr. Senem Kumova Metin
SE 360 Advances in Software Development Object Oriented Development in Java Polymorphism Dr. Senem Kumova Metin Modified lecture notes of Dr. Hüseyin Akcan Inheritance Object oriented programming languages
More informationAn Incomplete C++ Primer. University of Wyoming MA 5310
An Incomplete C++ Primer University of Wyoming MA 5310 Professor Craig C. Douglas http://www.mgnet.org/~douglas/classes/na-sc/notes/c++primer.pdf C++ is a legacy programming language, as is other languages
More informationBasic Programming and PC Skills: Basic Programming and PC Skills:
Texas University Interscholastic League Contest Event: Computer Science The contest challenges high school students to gain an understanding of the significance of computation as well as the details of
More informationBasic Java Constructs and Data Types Nuts and Bolts. Looking into Specific Differences and Enhancements in Java compared to C
Basic Java Constructs and Data Types Nuts and Bolts Looking into Specific Differences and Enhancements in Java compared to C 1 Contents Hello World Program Statements Explained Java Program Structure in
More informationComputing Concepts with Java Essentials
2008 AGI-Information Management Consultants May be used for personal purporses only or by libraries associated to dandelon.com network. Computing Concepts with Java Essentials 3rd Edition Cay Horstmann
More informationObject-Oriented Programming in Java
Object-Oriented Programming in Java Quiz 1 Jan 10, 2001 Problem 1: Who wants to be a Java developer? (with apologies to Regis) Fill in your answer in the space provided. Question 1: Which is these word-pairs
More informationINTRODUCTION TO COMPUTER PROGRAMMING. Richard Pierse. Class 7: Object-Oriented Programming. Introduction
INTRODUCTION TO COMPUTER PROGRAMMING Richard Pierse Class 7: Object-Oriented Programming Introduction One of the key issues in programming is the reusability of code. Suppose that you have written a program
More informationChapter 13 - Inheritance
Goals Chapter 13 - Inheritance To learn about inheritance To understand how to inherit and override superclass methods To be able to invoke superclass constructors To learn about protected and package
More informationArrays. Atul Prakash Readings: Chapter 10, Downey Sun s Java tutorial on Arrays: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.
Arrays Atul Prakash Readings: Chapter 10, Downey Sun s Java tutorial on Arrays: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.html 1 Grid in Assignment 2 How do you represent the state
More informationPART-A Questions. 2. How does an enumerated statement differ from a typedef statement?
1. Distinguish & and && operators. PART-A Questions 2. How does an enumerated statement differ from a typedef statement? 3. What are the various members of a class? 4. Who can access the protected members
More informationArrays. Introduction. Chapter 7
CH07 p375-436 1/30/07 1:02 PM Page 375 Chapter 7 Arrays Introduction The sequential nature of files severely limits the number of interesting things you can easily do with them.the algorithms we have examined
More informationMultichoice Quetions 1. Atributes a. are listed in the second part of the class box b. its time is preceded by a colon. c. its default value is
Multichoice Quetions 1. Atributes a. are listed in the second part of the class box b. its time is preceded by a colon. c. its default value is preceded by an equal sign d. its name has undereline 2. Associations
More informationJava Programming Language
Lecture 1 Part II Java Programming Language Additional Features and Constructs Topics in Quantitative Finance: Numerical Solutions of Partial Differential Equations Instructor: Iraj Kani Subclasses and
More informationYou are to simulate the process by making a record of the balls chosen, in the sequence in which they are chosen. Typical output for a run would be:
Lecture 7 Picking Balls From an Urn The problem: An urn has n (n = 10) balls numbered from 0 to 9 A ball is selected at random, its' is number noted, it is set aside, and another ball is selected from
More informationjava.util.scanner Here are some of the many features of Scanner objects. Some Features of java.util.scanner
java.util.scanner java.util.scanner is a class in the Java API used to create a Scanner object, an extremely versatile object that you can use to input alphanumeric characters from several input sources
More informationComputer Science III Advanced Placement G/T [AP Computer Science A] Syllabus
Computer Science III Advanced Placement G/T [AP Computer Science A] Syllabus Course Overview This course is a fast-paced advanced level course that focuses on the study of the fundamental principles associated
More informationContents. 9-1 Copyright (c) 1999-2004 N. Afshartous
Contents 1. Introduction 2. Types and Variables 3. Statements and Control Flow 4. Reading Input 5. Classes and Objects 6. Arrays 7. Methods 8. Scope and Lifetime 9. Utility classes 10. Introduction to
More information#820 Computer Programming 1A
Computer Programming I Levels: 10-12 Units of Credit: 1.0 CIP Code: 11.0201 Core Code: 35-02-00-00-030 Prerequisites: Secondary Math I, Keyboarding Proficiency, Computer Literacy requirement Semester 1
More informationMore on Objects and Classes
Software and Programming I More on Objects and Classes Roman Kontchakov Birkbeck, University of London Outline Object References Class Variables and Methods Packages Testing a Class Discovering Classes
More informationCSCI 253. Object Oriented Programming (OOP) Overview. George Blankenship 1. Object Oriented Design: Java Review OOP George Blankenship.
CSCI 253 Object Oriented Design: Java Review OOP George Blankenship George Blankenship 1 Object Oriented Programming (OOP) OO Principles Abstraction Encapsulation Abstract Data Type (ADT) Implementation
More informationSources: On the Web: Slides will be available on:
C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,
More informationProgramming Languages CIS 443
Course Objectives Programming Languages CIS 443 0.1 Lexical analysis Syntax Semantics Functional programming Variable lifetime and scoping Parameter passing Object-oriented programming Continuations Exception
More informationDesigning with Exceptions. CSE219, Computer Science III Stony Brook University http://www.cs.stonybrook.edu/~cse219
Designing with Exceptions CSE219, Computer Science III Stony Brook University http://www.cs.stonybrook.edu/~cse219 Testing vs. Debugging Testing Coding Does the code work properly YES NO 2 Debugging Testing
More informationVB.NET Programming Fundamentals
Chapter 3 Objectives Programming Fundamentals In this chapter, you will: Learn about the programming language Write a module definition Use variables and data types Compute with Write decision-making statements
More informationChapter 2 Introduction to Java programming
Chapter 2 Introduction to Java programming 1 Keywords boolean if interface class true char else package volatile false byte final switch while throws float private case return native void protected break
More informationStatements and Control Flow
Contents 1. Introduction 2. Types and Variables 3. Statements and Control Flow 4. Reading Input 5. Classes and Objects 6. Arrays 7. Methods 8. Scope and Lifetime 9. Utility classes 10. Introduction to
More informationObject-Oriented Programming: Polymorphism
1 10 Object-Oriented Programming: Polymorphism 10.3 Demonstrating Polymorphic Behavior 10.4 Abstract Classes and Methods 10.5 Case Study: Payroll System Using Polymorphism 10.6 final Methods and Classes
More informationThe Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1
The Java Series Java Essentials I What is Java? Basic Language Constructs Slide 1 What is Java? A general purpose Object Oriented programming language. Created by Sun Microsystems. It s a general purpose
More informationShort Introduction to the Concepts of Programming in Java Overview over the most important constructs
Introduction to Java Short Introduction to the Concepts of Programming in Java Overview over the most important constructs OOIS 1998/99 Ulrike Steffens Software Systems Institute ul.steffens@tu- harburg.de
More informationRARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE. CISY 105 Foundations of Computer Science
I. Basic Course Information RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE CISY 105 Foundations of Computer Science A. Course Number and Title: CISY-105, Foundations of Computer Science B. New
More informationWhat is Java? Applications and Applets: Result of Sun s efforts to remedy bad software engineering practices
What is Java? Result of Sun s efforts to remedy bad software engineering practices It is commonly thought of as a way to make Web pages cool. It has evolved into much more. It is fast becoming a computing
More informationTECHNOLOGY Computer Programming II Grade: 9-12 Standard 2: Technology and Society Interaction
Standard 2: Technology and Society Interaction Technology and Ethics Analyze legal technology issues and formulate solutions and strategies that foster responsible technology usage. 1. Practice responsible
More informationGrundlæggende Programmering IT-C, Forår 2001. Written exam in Introductory Programming
Written exam in Introductory Programming IT University of Copenhagen, June 11, 2001 English version All materials are permitted during the exam, except computers. The exam questions must be answered in
More informationBuilding Java Programs
Building Java Programs Chapter 3 Lecture 3-3: Interactive Programs w/ Scanner reading: 3.3-3.4 self-check: #16-19 exercises: #11 videos: Ch. 3 #4 Interactive programs We have written programs that print
More informationpublic static void main(string[] args) { System.out.println("hello, world"); } }
Java in 21 minutes hello world basic data types classes & objects program structure constructors garbage collection I/O exceptions Strings Hello world import java.io.*; public class hello { public static
More informationUnder the Hood: The Java Virtual Machine. Lecture 24 CS 2110 Fall 2011
Under the Hood: The Java Virtual Machine Lecture 24 CS 2110 Fall 2011 Compiling for Different Platforms Program written in some high-level language (C, Fortran, ML,...) Compiled to intermediate form Optimized
More informationEmbedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C
Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C 1 An essential part of any embedded system design Programming 2 Programming in Assembly or HLL Processor and memory-sensitive
More informationIn this Chapter you ll learn:
Now go, write it before them in a table, and note it in a book. Isaiah 30:8 To go beyond is as wrong as to fall short. Confucius Begin at the beginning, and go on till you come to the end: then stop. Lewis
More informationIntroduction to Programming System Design. CSCI 455x (4 Units)
Introduction to Programming System Design CSCI 455x (4 Units) Description This course covers programming in Java and C++. Topics include review of basic programming concepts such as control structures,
More information