SCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 2 EXAMINATIONS 2013/2014 CI101/CI101H. Programming

Size: px
Start display at page:

Download "SCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 2 EXAMINATIONS 2013/2014 CI101/CI101H. Programming"

Transcription

1 s SCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 2 EXAMINATIONS 2013/2014 CI101/CI101H Programming Time allowed: THREE hours Answer: ALL questions Items permitted: Items supplied: There is no restriction on the paper-based items or items on a USB flash drive that the student may take into the examination. None CI101_SEM2_2013/2014 Page 1 of 24 Printing date: 20/10/2014

2 Section A Section A carries 50 marks in total. Use the application provided to record the answer for each multiple choice question (Question 1 Question 20) in section A of this exam paper. Remember to fill in your student number in the box provided for this (Highlighted initially with a reddish background ) before exiting from the application. Each question in Section A is worth 2.5 marks. Section A carries 50 marks in total. There is no penalty for answering a question wrongly. Question 1 class Main public static void main( String args[] ) System.out.printf( "%s%s%s\n", "hello", " ", "world" ); When the above class Main is executed as a Java application it will print: Hello world %s %s\n Hello world %s %s\n Hello world CI101_SEM2_2013/2014 Page 2 of 24 Printing date: 20/10/2014

3 Question 2 class Main public static void main( String args[] ) int totalhours = 36; int days = totalhours / 24; int hours = totalhours % 24; System.out.println( totalhours + " hours is equal to " + days + "." + ((hours*10)/24) + " days(s)" ); When the above class Main is executed as a Java application it will print: 36 hours is equal to 1.0 days(s) 36 hours is equal to 1.5 days(s) 36 hours is equal to 2.0 days(s) 36 hours is equal to 2.5 days(s) CI101_SEM2_2013/2014 Page 3 of 24 Printing date: 20/10/2014

4 Question 3 class Main public static void main( String args[] ) if ( false && true ) System.out.println("OK"); if ( false true ) System.out.println("OK"); if ( false true ) System.out.println("OK"); if ( ( false == false ) (false == true) ) System.out.println("OK"); if ( true && (! ( 1!= 1) ) ) System.out.println("OK"); if ( 10 < 20 && 'a' > 'b' ) System.out.println("OK"); When the above class Main is executed as a Java application it will print: OK (will be printed) once. OK (will be printed) two times. OK (will be printed) three times. OK (will be printed) four times. CI101_SEM2_2013/2014 Page 4 of 24 Printing date: 20/10/2014

5 Question 4 class Main public static void main( String args[] ) double value = 0.0; value = (double) ( 5 / 2 ); System.out.printf( "%8.1f\n", value ); value = 5 / ( int) 2.0; System.out.printf( "%8.1f\n", value ); value = (double) (5.0 / 2); System.out.printf( "%8.1f\n", value ); value = (int) (5.0 / 2.0); System.out.printf( "%8.1f\n", value ); value = (short) (5.0 / 2.0); System.out.printf( "%8.1f\n", value ); When the above class Main is executed as a Java application it will print: 2.0 will be printed two times. 2.0 will be printed three times. 2.0 will be printed four times. 2.5 will not be printed. CI101_SEM2_2013/2014 Page 5 of 24 Printing date: 20/10/2014

6 Question 5 class Main public static void main( String args[] ) for ( int i=10; i>=1; i-- ) if ( i > 5 && i < 4 ) System.out.println( "Interesting" ); When the above class Main is executed as a Java application it will print: Interesting will not be printed. Interesting will be printed once. Interesting will be printed two times. Interesting will be printed three times. Question 6 class Main public static void main( String args[] ) int numbers[] = 1, 2, 3, 4, 5 ; System.out.print( numbers[ numbers[ 3 ] ] ); numbers[2] = numbers[ numbers.length-3 ]; System.out.println( numbers[ 2 ] ); When the above class Main is executed as a Java application it will print: CI101_SEM2_2013/2014 Page 6 of 24 Printing date: 20/10/2014

7 Question 7 class Box private String stored = null; public Box( String s ) stored = s; public String stored() return stored; class Main public static void main( String args[] ) Box b1 = new Box( "ents" ); Box b2 = new Box( "pres" ); Box b3 = new Box( "cont" ); b2 = b3; System.out.println( b2.stored() + b1.stored() ); When the above class Main is executed as a Java application it will print: prespres presents contents contcont CI101_SEM2_2013/2014 Page 7 of 24 Printing date: 20/10/2014

8 Question 8 import java.util.arraylist; class Person private String name = "No one"; private int score = 0; public Person( String name, int score ) this.name = name; this.score = score; public String getname() return name; public int getscore() return score; class Main ArrayList<Person> players = new ArrayList<Person>(); players.add( new Person( "John", 34 ) ); players.add( new Person( "Janet", 23 ) ); players.add( new Person( "Ann", 45 ) ); players.add( new Person( "Nathan", 47 ) ); int winscore = players.get(0).getscore(); String winname = players.get(0).getname(); for( Person cur : players ) if ( winscore > cur.getscore() ) winname = cur.getname(); winscore= cur.getscore(); System.out.println( "Winner is " + winname ); When the above class Main is executed as a Java application it will print: Winner is Ann Winner is Janet Winner is John Winner is Nathan CI101_SEM2_2013/2014 Page 8 of 24 Printing date: 20/10/2014

9 Question 9 class Main public static void main( String args[] ) int numbers[] = 0, 1, 0, 1, 1 ; int result = 0; for ( int i=0; i < numbers.length; i++ ) result = result * 2 + numbers[ i ]; System.out.println( result ); When the above class Main is executed as a Java application it will print: CI101_SEM2_2013/2014 Page 9 of 24 Printing date: 20/10/2014

10 Question 10 class Main public static void main( String args[] ) boolean va[] = true, true, false, false ; boolean vb[] = true, false, true, false ; System.out.println( "A B (A B) & B " ); for( int i=0; i<va.length; i++ ) System.out.printf( "%s %s %s\n", convert( va[i] ), convert( vb[i] ), convert( (va[i] vb[i] ) && vb[i] ) ); public static String convert( boolean value ) return value? "T" : "F"; When the above class Main is executed as a Java application it will print: A B (A B) & B F F F F T T T F F T T T A B (A B) & B F F F F T T T F T T T T A B (A B) & B T T T T F T F T T F F F A B (A B) & B T T T T F F F T T F F F CI101_SEM2_2013/2014 Page 10 of 24 Printing date: 20/10/2014

11 Question 11 Which of the following statements about Java is true? An instance of a double will always hold any calculated value exactly such as the result of 1.0/3.0 or * * After executing the statement double d=2.3; the variable d may be converted into an int with the Java statement int a = d; An instance of a boolean may only take the values true or false. The operator += may only be used between instances of an int or double. Question 12 Which of the following statements about Java is true? An if statement must have an else part. A case statement must always have a default case label. The body of a while statement will always be executed at least once. If the following variables a, b and c have all been declared as an instance of an int. Then the following assignment statement is valid: int result = a = b = c = 2; Question 13 Which of the following statements about Java is true? A valid index to collection which is an instance of an ArrayList must be a whole number in the range 0 to collection.size()-1;. A valid key to access information stored in an instance of a HashMap must only be an instance of an int or an instance of the class String. You can decrease the number of accessible elements in an array in Java by changing the contents of it s field length. An instance of an ArrayList numbers may be used to store int s by using the declaration: ArrayList<int> numbers = new ArrayList<int>();. CI101_SEM2_2013/2014 Page 11 of 24 Printing date: 20/10/2014

12 Question 14 Which of the following statements about Java is true? All of the following are primitive types in Java: int, double, boolean, String. An instance of a String may only have its contents changed if the resultant String would be less than or equal to the original String's length. If you examine a character in a String using the method charat then a new instance of the string will be created on each method invocation. message.tolowercase(); The above Java statement will not convert the characters in the String message to lower case. Question 15 Which of the following statements about Java is true? A constructor in a class is called just before the objects storage is released by the garbage collector. The last code line of a constructor must be return this; which will return the current state of the object. A constructor's signature must not have a return type. You may only define 1 (one) constructor in a class. CI101_SEM2_2013/2014 Page 12 of 24 Printing date: 20/10/2014

13 Question 16 Which of the following statements about Java is true? An object is also an instance of a primitive type. A message is invoked when a method is sent to an object An instance of a class is an object. The primitive type int is an instance of the class Integer. Question 17 Which of the following statements about Java is true? Java is "write once run anywhere" because it is compiled into native machine code. Java is "write once run anywhere" because it is not compiled into a bytecode but source interpreted and hence can be run on any machine. Java is "write once run anywhere" because there is now only 1 (one) computer architecture used by all computers. Java is "write once run anywhere" because Java is compiled into a bytecode that may be executed on many machines. CI101_SEM2_2013/2014 Page 13 of 24 Printing date: 20/10/2014

14 Question 18 Which of the following statements about Java is true? It is better to use in Java an array rather than an ArrayList to store data as an ArrayList may not increase the number of objects stored. A TreeMap stores [key, data] pairs of objects. The key is then used to retrieve the stored data. An ArrayList may be used as a direct substitute for a HashTree. In general there will be no performance gain in using a HashMap rather than a TreeMap to store and retrieve data items using a key. Question 19 Which of the following statements about Java is true? To compare the contents of any object the equality operator == must be used. An object which is an instance of the String class is mutable. An object which is an instance of the String class is immutable. An instance of the String class is not an object. Question 20 Which of the following statements about Java is true? In a large program it is better to avoid the use of classes as there use often involves the creation of extra code to call methods which just access instance variables in the many different objects that will exist in the program. A TreeMap should not be used if it is required to process the stored data in key order. The program java is used to compile a Java program. The convention is that the name of mutable instance variable starts with a lower case letter. CI101_SEM2_2013/2014 Page 14 of 24 Printing date: 20/10/2014

15 Section B Section B carries 50 marks Marks Brief A Java application has been written to produce an inventory of items. In this application single items are input and at the end of the input a list of items in the inventory will be produced. If however, an item is already in the inventory, then rather than record a new entry the count of the number of examples of this item is increased by 1. If the inventory is full and a new item that is not already in the inventory is attempted to be added then the error message Error full: Inventory so far Is written followed by the contents of the inventory. The maximum size of the inventory is set to 5 items to facilitate testing. This value should not be changed. Unfortunately, the application contains (in total 5 individual errors) syntax, semantic and run-time logical errors. A BlueJ project for this application named 2.1 is in the folder ci101.exam at the top level on the h: drive. Using BlueJ correct these errors, so that the application produces the expected result. Remember do not re-write the program, but correct the errors in the program. CI101_SEM2_2013/2014 Page 15 of 24 Printing date: 20/10/2014

16 Example Input Example input data usb cable cpu disk drive ssd disk cpu cooler cpu one too many items END Commentary ** inventory full 6 th item ** Terminator Expected output Error full: Inventory so far usb cable [ 1] cpu [ 2] disk drive [ 1] ssd disk [ 1] cpu cooler [ 1] Example Input Example input data usb cable cpu disk drive ssd disk disk drive ssd disk ssd disk END Commentary Terminator Expected output usb cable [ 1] cpu [ 1] disk drive [ 2] ssd disk [ 3] CI101_SEM2_2013/2014 Page 16 of 24 Printing date: 20/10/2014

17 Special instructions Put as a comment at the top of your program your student number. Note: o Arrays are used to store the items in the inventory o The inventory is not sorted; items are simply listed in the order that the first occurrence of an item is encountered in the input. o The items to be input to the inventory are terminated with an item named END. Remember any line printed that contains a # character will not be considered as part of your answer. This is so that you can write out a meaningful prompt for any data (containing a # character) and this whole line of text will be ignored in the comparison of your answer. The program A printed copy of the Java application for question 2.1 (that contains the errors mentioned above) is on the following page. CI101_SEM2_2013/2014 Page 17 of 24 Printing date: 20/10/2014

18 class Main public static void main( String args[] ) Inventory list = Inventory(); boolean ok = true; System.out.print("#Enter item name : " ); String item = BIO.getString(); while (! item.equals( "END" ) && ok ) ok = list.add( item ); if (!ok ) break System.out.print("#Enter item name : " ); item = BIO.getString(); if ( ok ) System.out.println("Error full: Inventory so far" ); System.out.println( list.asstring() ); classs Inventory private final static int MAX = 5; private int nextfree = 0; private String item[] = new String[MAX]; private int howmany[] = new int[max]; public boolean add( String anitem ) // Find if item already exists for ( int i=0; i<nextfree; i++) if ( item[i].equals( anitem ) ) howmany[i]++; return true; if ( nextfree < MAX ) // Add a new item to the inventory item[nextfree] = anitem; howmany[nextfree++] = 0; return true; return false; public String asstring() String result = ""; for ( int i=0; i<nextfree; i++ ) result += String.format("%-16s [%4d]\n", item[i], howmany[i] ); return result; CI101_SEM2_2013/2014 Page 18 of 24 Printing date: 20/10/2014

19 Marks Brief A Java application has been written to calculate the mean or average mark for a group of students taking a module. The data to the program consists of the students name followed by their mark for this module. The data is terminated with a student name of END. The application in Java has been written using 3 classes. The class Student An instance of which is used to store the name and mark for an individual student taking a module. The class Module An instance of which is used to hold the students taking the module with a method to calculate the average mark for students taking the module. The class Main Is used to read in data pairs consisting of the students name and their mark for the module and store the data in an instance of a module. Unfortunately, the application contains (in total 5 individual errors) syntax, semantic and run-time logical errors. A BlueJ project for this application named 2.2 is in the folder ci101.exam at the top level on the h: drive. Using BlueJ correct these errors, so that the application produces the expected result. Remember do not re-write the program, but correct the errors in the program. CI101_SEM2_2013/2014 Page 19 of 24 Printing date: 20/10/2014

20 Example Input Example input data Alice 68 Beatrix 70 Catherine 72 Deborah 66 Eliza 64 END Commentary Student name Module mark out of 100 Student name Module mark out of 100 Student name Module mark out of 100 Student name Module mark out of 100 Student name Module mark out of 100 Terminator Expected output Average mark is CI101_SEM2_2013/2014 Page 20 of 24 Printing date: 20/10/2014

21 Special instructions Put as a comment at the top of your program your student number. Note: o The data is terminated by entering a student with the name END. o The Module mark will always be a number in the range: o There will always be at least one person taking a module. Remember any line printed that contains a # character will not be considered as part of your answer. This is so that you can write out a meaningful prompt for any data (containing a # character) and this whole line of text will be ignored in the comparison of your answer. The program A printed copy of the Java application for question 2.2 (that contains the errors mentioned above) is on the following page. CI101_SEM2_2013/2014 Page 21 of 24 Printing date: 20/10/2014

22 import java.util.arraylist; class Student private String thename = "" private int themark = 0; public Student( String name, int mark ) thename = name; themark = mark; public int getname() return thename; public int getmark() return themark; class Module ArrayList<Student> module = new ArrayList<Student>(); public void add( String name, int mark ) module.add( new Student( name, mark ) ); public double mean() double total = 0.0; for ( Student student: module ) total += student.getmark(); return total / 4; class Main public static void main( String args[] ) Module module = new Module(); System.out.print("#Enter student name : " ); String name = BIO.getString(); while (! name.equals("stop") ) System.out.print("#Enter module mark : " ); int mark = BIO.getInt(); module.add( mark, name ); System.out.print("#Enter student name : " ); name = BIO.getString(); System.out.printf("Average mark is %6.2f\n", module.mean() ); CI101_SEM2_2013/2014 Page 22 of 24 Printing date: 20/10/2014

23 Marks Brief Write a Java application that converts numbers in Arabic number format to numbers in Roman number format. In "Roman number" format the letters (I=1, V=5, X=10, L=50, C=100, D=500 and M=1000) are used to express a number. Roman numbers are formed by combining these symbols together and adding the values. So II is two ones, i.e. 2, and XIII is a ten and three ones, i.e. 13. There is no zero in this system, so 207, for example, is CCVII, using the symbols for two hundreds, a five and two ones is MLXVI, one thousand, fifty and ten, a five and a one. Symbols are placed from left to right in order of value, starting with the largest. However, in a few cases to avoid four characters being repeated in succession (such as IIII or XXXX) these can be reduced using subtractive notation as follows: the numeral I can be placed before V and X to make 4 units (IV) and 9 units (IX) respectively X can be placed before L and C to make 40 (XL) and 90 (XC) respectively C can be placed before D and M to make 400 (CD) and 900 (CM) according to the same pattern An example using the above rules would be 1904: this is composed of 1 (one thousand), 9 (nine hundreds), 0 (zero tens), and 4 (four units). To write the Roman numeral, each of the nonzero digits should be treated separately. Thus 1,000 = M, 900 = CM, and 4 = IV. Therefore, 1904 is MCMIV. Modified from the article in Wikipedia on Roman numbers. Example input data Commentary Example Input Add together MM X IV Add together M CM XX III Add together C XC IX Expected output 2014 as a roman number is MMXIV 1923 as a roman number is MCMXXIII 199 as a roman number is CXCIX CI101_SEM2_2013/2014 Page 23 of 24 Printing date: 20/10/2014

24 Special instructions A BlueJ project for this application named 2.3 is in the folder ci101.exam at the top level on the h: drive. Using this BlueJ project construct your answer. The program will be run by invoking the method main in the class Main. Put as a comment at the top of your program your student number. Put as a comment at the top of your program a comment that describes how your program converts a number into a Roman number. Note: That the terminator is a line containing only the number 0. Assume that the number to be converted is in the range The roman number produced will be in upper case letters. Remember any line printed that contains a # character will not be considered as part of your answer. This is so that you can write out a meaningful prompt for any data (containing a # character) and this line of text will be ignored in the comparison of your answer. CI101_SEM2_2013/2014 Page 24 of 24 Printing date: 20/10/2014

SCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 1 EXAMINATIONS 2015/2016 CI101 / CI177. Programming

SCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 1 EXAMINATIONS 2015/2016 CI101 / CI177. Programming s SCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 1 EXAMINATIONS 2015/2016 CI101 / CI177 Programming Time allowed: THREE hours: Answer: ALL questions Items permitted: Items supplied: There is

More information

SCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 2 EXAMINATIONS 2014/2015 CI101/CI101H. Programming

SCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 2 EXAMINATIONS 2014/2015 CI101/CI101H. Programming s SCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 2 EXAMINATIONS 2014/2015 CI101/CI101H Programming Time allowed: THREE hours Answer: ALL questions Items permitted: Items supplied: There is no

More information

In the following description the h: drive is used to indicate the directory in which during the actual ci101 exam the files used will reside.

In the following description the h: drive is used to indicate the directory in which during the actual ci101 exam the files used will reside. Important In the following description the h: drive is used to indicate the directory in which during the actual ci101 exam the files used will reside. However, if you are trying the exam system out yourself

More information

CS 231 Data Structures and Algorithms, Fall 2016

CS 231 Data Structures and Algorithms, Fall 2016 CS 231 Data Structures and Algorithms, Fall 2016 Dr. Bruce A. Maxwell Department of Computer Science Colby College Course Description Focuses on the common structures used to store data and the standard

More information

PROGRAMMING FUNDAMENTALS

PROGRAMMING FUNDAMENTALS PROGRAMMING FUNDAMENTALS Q1. Name any two Object Oriented Programming languages? Q2. Why is java called a platform independent language? Q3. Elaborate the java Compilation process. Q4. Why do we write

More information

M105: Introduction to Programming with Java Midterm Examination (MTA) Makeup Spring 2013 / 2014

M105: Introduction to Programming with Java Midterm Examination (MTA) Makeup Spring 2013 / 2014 M105: Introduction to Programming with Java Midterm Examination (MTA) Makeup Spring 2013 / 2014 Question One: Choose the correct answer and write it on the external answer booklet. 1. Java is. a. case

More information

Section 2.2 Your First Program in Java: Printing a Line of Text

Section 2.2 Your First Program in Java: Printing a Line of Text Chapter 2 Introduction to Java Applications Section 2.2 Your First Program in Java: Printing a Line of Text 2.2 Q1: End-of-line comments that should be ignored by the compiler are denoted using a. Two

More information

APCS Semester #1 Final Exam Practice Problems

APCS Semester #1 Final Exam Practice Problems Name: Date: Per: AP Computer Science, Mr. Ferraro APCS Semester #1 Final Exam Practice Problems The problems here are to get you thinking about topics we ve visited thus far in preparation for the semester

More information

2.8. Decision Making: Equality and Relational Operators

2.8. Decision Making: Equality and Relational Operators Page 1 of 6 [Page 56] 2.8. Decision Making: Equality and Relational Operators A condition is an expression that can be either true or false. This section introduces a simple version of Java's if statement

More information

An Introduction To Writing Your Own Classes CSC 123 Fall 2018 Howard Rosenthal

An Introduction To Writing Your Own Classes CSC 123 Fall 2018 Howard Rosenthal An Introduction To Writing Your Own Classes CSC 123 Fall 2018 Howard Rosenthal Lesson Goals Understand Object Oriented Programming The Syntax of Class Definitions Constructors this Object Oriented "Hello

More information

Programming with Java

Programming with Java Programming with Java Data Types & Input Statement Lecture 04 First stage Software Engineering Dep. Saman M. Omer 2017-2018 Objectives q By the end of this lecture you should be able to : ü Know rules

More information

Midterm Examination (MTA)

Midterm Examination (MTA) M105: Introduction to Programming with Java Midterm Examination (MTA) Spring 2013 / 2014 Question One: [6 marks] Choose the correct answer and write it on the external answer booklet. 1. Compilers and

More information

Department of Civil and Environmental Engineering, Spring Semester, ENCE 688R: Final Exam: 2 Hours, Open Book and Open Notes

Department of Civil and Environmental Engineering, Spring Semester, ENCE 688R: Final Exam: 2 Hours, Open Book and Open Notes Department of Civil and Environmental Engineering, Spring Semester, 2017 ENCE 688R: Final Exam: 2 Hours, Open Book and Open Notes Name : Question Points Score 1 50 2 30 3 20 Total 100 1 Question 1: 50

More information

Selected Questions from by Nageshwara Rao

Selected Questions from  by Nageshwara Rao Selected Questions from http://way2java.com by Nageshwara Rao Swaminathan J Amrita University swaminathanj@am.amrita.edu November 24, 2016 Swaminathan J (Amrita University) way2java.com (Nageshwara Rao)

More information

Inf1-OP. Collections. Perdita Stevens, adapting earlier version by Ewan Klein. January 9, School of Informatics

Inf1-OP. Collections. Perdita Stevens, adapting earlier version by Ewan Klein. January 9, School of Informatics Inf1-OP Collections Perdita Stevens, adapting earlier version by Ewan Klein School of Informatics January 9, 2016 Rigidity of arrays Length of array is fixed at creation time. Can t be expanded. Can t

More information

1. [3 pts] What is your section number, the period your discussion meets, and the name of your discussion leader?

1. [3 pts] What is your section number, the period your discussion meets, and the name of your discussion leader? CIS 3022 Prog for CIS Majors I September 30, 2008 Exam I Print Your Name Your Section # Total Score Your work is to be done individually. The exam is worth 105 points (five points of extra credit are available

More information

Rigidity of arrays. Inf1-OP. ArrayList. ArrayList: Methods. Declaration. Collections

Rigidity of arrays. Inf1-OP. ArrayList. ArrayList: Methods. Declaration. Collections Rigidity of arrays Inf1-OP Collections Volker Seeker, adapting earlier version by Perdita Stevens and Ewan Klein School of Informatics Length of array is fixed at creation time. Can t be expanded. Can

More information

Inf1-OP. Collections. Timothy Hospedales, adapting earlier version by Perdita Stevens and Ewan Klein. March 6, School of Informatics

Inf1-OP. Collections. Timothy Hospedales, adapting earlier version by Perdita Stevens and Ewan Klein. March 6, School of Informatics Inf1-OP Collections Timothy Hospedales, adapting earlier version by Perdita Stevens and Ewan Klein School of Informatics March 6, 2017 Rigidity of arrays Length of array is fixed at creation time. Can

More information

B.V. Patel Institute of BMC & IT, UTU 2014

B.V. Patel Institute of BMC & IT, UTU 2014 BCA 3 rd Semester 030010301 - Java Programming Unit-1(Java Platform and Programming Elements) Q-1 Answer the following question in short. [1 Mark each] 1. Who is known as creator of JAVA? 2. Why do we

More information

Università degli Studi di Bologna Facoltà di Ingegneria. Principles, Models, and Applications for Distributed Systems M

Università degli Studi di Bologna Facoltà di Ingegneria. Principles, Models, and Applications for Distributed Systems M Università degli Studi di Bologna Facoltà di Ingegneria Principles, Models, and Applications for Distributed Systems M tutor Isam M. Al Jawarneh, PhD student isam.aljawarneh3@unibo.it Mobile Middleware

More information

McGill University School of Computer Science COMP-202A Introduction to Computing 1

McGill University School of Computer Science COMP-202A Introduction to Computing 1 McGill University School of Computer Science COMP-202A Introduction to Computing 1 Midterm Exam Thursday, October 26, 2006, 18:00-20:00 (6:00 8:00 PM) Instructors: Mathieu Petitpas, Shah Asaduzzaman, Sherif

More information

Inf1-OOP. Encapsulation and Collections. Perdita Stevens, adapting earlier version by Ewan Klein. March 2, School of Informatics

Inf1-OOP. Encapsulation and Collections. Perdita Stevens, adapting earlier version by Ewan Klein. March 2, School of Informatics Inf1-OOP Encapsulation and Collections Perdita Stevens, adapting earlier version by Ewan Klein School of Informatics March 2, 2015 Encapsulation Accessing Data Immutability Enhanced for loop Collections

More information

Method OverLoading printf method Arrays Declaring and Using Arrays Arrays of Objects Array as Parameters

Method OverLoading printf method Arrays Declaring and Using Arrays Arrays of Objects Array as Parameters Outline Method OverLoading printf method Arrays Declaring and Using Arrays Arrays of Objects Array as Parameters Variable Length Parameter Lists split() Method from String Class Integer & Double Wrapper

More information

Full file at

Full file at Chapter 2 Introduction to Java Applications Section 2.1 Introduction ( none ) Section 2.2 First Program in Java: Printing a Line of Text 2.2 Q1: End-of-line comments that should be ignored by the compiler

More information

BlueJ Demo. Topic 1: Basic Java. 1. Sequencing. Features of Structured Programming Languages

BlueJ Demo. Topic 1: Basic Java. 1. Sequencing. Features of Structured Programming Languages Topic 1: Basic Java Plan: this topic through next Friday (5 lectures) Required reading on web site I will not spell out all the details in lecture! BlueJ Demo BlueJ = Java IDE (Interactive Development

More information

5/3/2006. Today! HelloWorld in BlueJ. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont.

5/3/2006. Today! HelloWorld in BlueJ. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. Today! Build HelloWorld yourself in BlueJ and Eclipse. Look at all the Java keywords. Primitive Types. HelloWorld in BlueJ 1. Find BlueJ in the start menu, but start the Select VM program instead (you

More information

Section 2.2 Your First Program in Java: Printing a Line of Text

Section 2.2 Your First Program in Java: Printing a Line of Text Chapter 2 Introduction to Java Applications Section 2.2 Your First Program in Java: Printing a Line of Text 2.2 Q1: End-of-line comments that should be ignored by the compiler are denoted using a. Two

More information

Simple Java Reference

Simple Java Reference Simple Java Reference This document provides a reference to all the Java syntax used in the Computational Methods course. 1 Compiling and running... 2 2 The main() method... 3 3 Primitive variable types...

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

AL GHURAIR UNIVERSITY College of Computing. Objectives: Examples: if Single-Selection Statement CSC 209 JAVA I. week 3- Control Statements: Part I

AL GHURAIR UNIVERSITY College of Computing. Objectives: Examples: if Single-Selection Statement CSC 209 JAVA I. week 3- Control Statements: Part I AL GHURAIR UNIVERSITY College of Computing CSC 209 JAVA I week 3- Control Statements: Part I Objectives: To use the if and if...else selection statements to choose among alternative actions. To use the

More information

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub Lebanese University Faculty of Science Computer Science BS Degree Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub 2 Crash Course in JAVA Classes A Java

More information

Computer Science II Data Structures

Computer Science II Data Structures Computer Science II Data Structures Instructor Sukumar Ghosh 201P Maclean Hall Office hours: 10:30 AM 12:00 PM Mondays and Fridays Course Webpage homepage.cs.uiowa.edu/~ghosh/2116.html Course Syllabus

More information

Object-Oriented Programming. Topic 2: Fundamental Programming Structures in Java

Object-Oriented Programming. Topic 2: Fundamental Programming Structures in Java Electrical and Computer Engineering Object-Oriented Topic 2: Fundamental Structures in Java Maj Joel Young Joel.Young@afit.edu 8-Sep-03 Maj Joel Young Java Identifiers Identifiers Used to name local variables

More information

1. [3 pts] What is your section number, the period your discussion meets, and the name of your discussion leader?

1. [3 pts] What is your section number, the period your discussion meets, and the name of your discussion leader? CIS 3022 Prog for CIS Majors I October 4, 2007 Exam I Print Your Name Your Section # Total Score Your work is to be done individually. The exam is worth 104 points (four points of extra credit are available

More information

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance Contents Topic 04 - Inheritance I. Classes, Superclasses, and Subclasses - Inheritance Hierarchies Controlling Access to Members (public, no modifier, private, protected) Calling constructors of superclass

More information

C212 Early Evaluation Exam Mon Feb Name: Please provide brief (common sense) justifications with your answers below.

C212 Early Evaluation Exam Mon Feb Name: Please provide brief (common sense) justifications with your answers below. C212 Early Evaluation Exam Mon Feb 10 2014 Name: Please provide brief (common sense) justifications with your answers below. 1. What is the type (and value) of this expression: 5 * (7 + 4 / 2) 2. What

More information

Objects and Classes Lecture 2

Objects and Classes Lecture 2 Objects and Classes Lecture 2 Waterford Institute of Technology January 12, 2016 John Fitzgerald Waterford Institute of Technology, Objects and ClassesLecture 2 1/32 Classes and Objects Example of class

More information

SPRING 13 CS 0007 FINAL EXAM V2 (Roberts) Your Name: A pt each. B pt each. C pt each. D or 2 pts each

SPRING 13 CS 0007 FINAL EXAM V2 (Roberts) Your Name: A pt each. B pt each. C pt each. D or 2 pts each Your Name: Your Pitt (mail NOT peoplesoft) ID: Part Question/s Points available Rubric Your Score A 1-6 6 1 pt each B 7-12 6 1 pt each C 13-16 4 1 pt each D 17-19 5 1 or 2 pts each E 20-23 5 1 or 2 pts

More information

Inf1-OOP. Encapsulation. Object Oriented Programming. Encapsulation Accessing Data Immutability. Encapsulation and Collections.

Inf1-OOP. Encapsulation. Object Oriented Programming. Encapsulation Accessing Data Immutability. Encapsulation and Collections. Inf1-OOP Encapsulation and Collections Ewan Klein, Perdita Stevens School of Informatics January 12, 2013 Encapsulation Accessing Data Immutability Enhanced for loop Collections ArrayList Maps Summary/Admin

More information

AP Computer Science A

AP Computer Science A 2017 AP Computer Science A Sample Student Responses and Scoring Commentary Inside: RR Free Response Question 1 RR Scoring Guideline RR Student Samples RR Scoring Commentary 2017 The College Board. College

More information

Computer Components. Software{ User Programs. Operating System. Hardware

Computer Components. Software{ User Programs. Operating System. Hardware Computer Components Software{ User Programs Operating System Hardware What are Programs? Programs provide instructions for computers Similar to giving directions to a person who is trying to get from point

More information

COMP 401 Spring 2013 Midterm 1

COMP 401 Spring 2013 Midterm 1 COMP 401 Spring 2013 Midterm 1 I have not received nor given any unauthorized assistance in completing this exam. Signature: Name: PID: Please be sure to put your PID at the top of each page. This page

More information

Computer Science II (20082) Week 1: Review and Inheritance

Computer Science II (20082) Week 1: Review and Inheritance Computer Science II 4003-232-08 (20082) Week 1: Review and Inheritance Richard Zanibbi Rochester Institute of Technology Review of CS-I Syntax and Semantics of Formal (e.g. Programming) Languages Syntax

More information

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I BASIC COMPUTATION x public static void main(string [] args) Fundamentals of Computer Science I Outline Using Eclipse Data Types Variables Primitive and Class Data Types Expressions Declaration Assignment

More information

Chapter 4 Defining Classes I

Chapter 4 Defining Classes I Chapter 4 Defining Classes I This chapter introduces the idea that students can create their own classes and therefore their own objects. Introduced is the idea of methods and instance variables as the

More information

M257 Putting Java to work

M257 Putting Java to work Arab Open University Faculty of Computer Studies Course Examination Spring 2010 M257 Putting Java to work Exam date: May 2010 Time allowed: 2.5 hours Form: X A B Student name/ Section number: Tutor Name:

More information

Chapter 5 Methods. public class FirstMethod { public static void main(string[] args) { double x= -2.0, y; for (int i = 1; i <= 5; i++ ) { y = f( x );

Chapter 5 Methods. public class FirstMethod { public static void main(string[] args) { double x= -2.0, y; for (int i = 1; i <= 5; i++ ) { y = f( x ); Chapter 5 Methods Sections Pages Review Questions Programming Exercises 5.1 5.11 142 166 1 18 2 22 (evens), 30 Method Example 1. This is of a main() method using a another method, f. public class FirstMethod

More information

Last Name: Circle One: OCW Non-OCW

Last Name: Circle One: OCW Non-OCW First Name: AITI 2004: Exam 1 June 30, 2004 Last Name: Circle One: OCW Non-OCW Read Instructions Carefully! This is a 3 hour closed book exam. No calculators are allowed. Please write clearly if we cannot

More information

Objectives. Problem Solving. Introduction. An overview of object-oriented concepts. Programming and programming languages An introduction to Java

Objectives. Problem Solving. Introduction. An overview of object-oriented concepts. Programming and programming languages An introduction to Java Introduction Objectives An overview of object-oriented concepts. Programming and programming languages An introduction to Java 1-2 Problem Solving The purpose of writing a program is to solve a problem

More information

Computing Science 114 Solutions to Midterm Examination Tuesday October 19, In Questions 1 20, Circle EXACTLY ONE choice as the best answer

Computing Science 114 Solutions to Midterm Examination Tuesday October 19, In Questions 1 20, Circle EXACTLY ONE choice as the best answer Computing Science 114 Solutions to Midterm Examination Tuesday October 19, 2004 INSTRUCTOR: I E LEONARD TIME: 50 MINUTES In Questions 1 20, Circle EXACTLY ONE choice as the best answer 1 [2 pts] What company

More information

Outline. Overview. Control statements. Classes and methods. history and advantage how to: program, compile and execute 8 data types 3 types of errors

Outline. Overview. Control statements. Classes and methods. history and advantage how to: program, compile and execute 8 data types 3 types of errors Outline Overview history and advantage how to: program, compile and execute 8 data types 3 types of errors Control statements Selection and repetition statements Classes and methods methods... 2 Oak A

More information

Introduction to Java

Introduction to Java Introduction to Java Module 1: Getting started, Java Basics 22/01/2010 Prepared by Chris Panayiotou for EPL 233 1 Lab Objectives o Objective: Learn how to write, compile and execute HelloWorld.java Learn

More information

Introduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview

Introduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview Introduction to Visual Basic and Visual C++ Introduction to Java Lesson 13 Overview I154-1-A A @ Peter Lo 2010 1 I154-1-A A @ Peter Lo 2010 2 Overview JDK Editions Before you can write and run the simple

More information

COMP 401 Spring 2014 Midterm 1

COMP 401 Spring 2014 Midterm 1 COMP 401 Spring 2014 Midterm 1 I have not received nor given any unauthorized assistance in completing this exam. Signature: Name: PID: Please be sure to put your PID at the top of each page. This page

More information

St. Edmund Preparatory High School Brooklyn, NY

St. Edmund Preparatory High School Brooklyn, NY AP Computer Science Mr. A. Pinnavaia Summer Assignment St. Edmund Preparatory High School Name: I know it has been about 7 months since you last thought about programming. It s ok. I wouldn t want to think

More information

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types

More information

Handout 7. Defining Classes part 1. Instance variables and instance methods.

Handout 7. Defining Classes part 1. Instance variables and instance methods. Handout 7 CS180 Programming Fundamentals Spring 15 Page 1 of 8 Handout 7 Defining Classes part 1. Instance variables and instance methods. In Object Oriented programming, applications are comprised from

More information

Pace University. Fundamental Concepts of CS121 1

Pace University. Fundamental Concepts of CS121 1 Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

More information

1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8

1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8 Epic Test Review 1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4 Write a line of code that outputs the phase Hello World to the console without creating a new line character. System.out.print(

More information

Do this by creating on the m: drive (Accessed via start menu link Computer [The m: drive has your login id as name]) the subdirectory CI101.

Do this by creating on the m: drive (Accessed via start menu link Computer [The m: drive has your login id as name]) the subdirectory CI101. Creating and running a Java program. This tutorial is an introduction to running a computer program written in the computer programming language Java using the BlueJ IDE (Integrated Development Environment).

More information

Course Outline. Introduction to java

Course Outline. Introduction to java Course Outline 1. Introduction to OO programming 2. Language Basics Syntax and Semantics 3. Algorithms, stepwise refinements. 4. Quiz/Assignment ( 5. Repetitions (for loops) 6. Writing simple classes 7.

More information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers) Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement

More information

Object oriented programming. Instructor: Masoud Asghari Web page: Ch: 3

Object oriented programming. Instructor: Masoud Asghari Web page:   Ch: 3 Object oriented programming Instructor: Masoud Asghari Web page: http://www.masses.ir/lectures/oops2017sut Ch: 3 1 In this slide We follow: https://docs.oracle.com/javase/tutorial/index.html Trail: Learning

More information

1 Introduction Java, the beginning Java Virtual Machine A First Program BlueJ Raspberry Pi...

1 Introduction Java, the beginning Java Virtual Machine A First Program BlueJ Raspberry Pi... Contents 1 Introduction 3 1.1 Java, the beginning.......................... 3 1.2 Java Virtual Machine........................ 4 1.3 A First Program........................... 4 1.4 BlueJ.................................

More information

Introduction to Classes and Objects Pearson Education, Inc. All rights reserved.

Introduction to Classes and Objects Pearson Education, Inc. All rights reserved. 1 3 Introduction to Classes and Objects 2 You will see something new. Two things. And I call them Thing One and Thing Two. Dr. Theodor Seuss Geisel Nothing can have value without being an object of utility.

More information

CS 177 Week 15 Recitation Slides. Review

CS 177 Week 15 Recitation Slides. Review CS 177 Week 15 Recitation Slides Review 1 Announcements Final Exam on Friday Dec. 18 th STEW 183 from 1 3 PM Complete your online review of your classes. Your opinion matters!!! Project 6 due Just kidding

More information

Faculty of Science Midterm. COMP-202B - Introduction to Computing I (Winter 2008)

Faculty of Science Midterm. COMP-202B - Introduction to Computing I (Winter 2008) Student Name: Student Number: Section: Faculty of Science Midterm COMP-202B - Introduction to Computing I (Winter 2008) Friday, March 7, 2008 Examiners: Prof. Jörg Kienzle 18:15 20:15 Mathieu Petitpas

More information

In Java there are three types of data values:

In Java there are three types of data values: In Java there are three types of data values: primitive data values (int, double, boolean, etc.) arrays (actually a special type of object) objects An object might represent a string of characters, a planet,

More information

Arrays & Classes. Problem Statement and Specifications

Arrays & Classes. Problem Statement and Specifications Arrays & Classes Quick Start Compile step once always make -k baseball8 mkdir labs cd labs Execute step mkdir 8 java Baseball8 cd 8 cp /samples/csc/156/labs/8/*. Submit step emacs Player.java & submit

More information

Question: Total Points: Score:

Question: Total Points: Score: CS 170 Exam 1 Section 000 Spring 2014 Name (print):. Instructions Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do NOT communicate with anyone other than

More information

Motivation was to facilitate development of systems software, especially OS development.

Motivation was to facilitate development of systems software, especially OS development. A History Lesson C Basics 1 Development of language by Dennis Ritchie at Bell Labs culminated in the C language in 1972. Motivation was to facilitate development of systems software, especially OS development.

More information

cis20.1 design and implementation of software applications I fall 2007 lecture # I.2 topics: introduction to java, part 1

cis20.1 design and implementation of software applications I fall 2007 lecture # I.2 topics: introduction to java, part 1 topics: introduction to java, part 1 cis20.1 design and implementation of software applications I fall 2007 lecture # I.2 cis20.1-fall2007-sklar-leci.2 1 Java. Java is an object-oriented language: it is

More information

1.00 Introduction to Computers and Engineering Problem Solving. Quiz 1 March 7, 2003

1.00 Introduction to Computers and Engineering Problem Solving. Quiz 1 March 7, 2003 1.00 Introduction to Computers and Engineering Problem Solving Quiz 1 March 7, 2003 Name: Email Address: TA: Section: You have 90 minutes to complete this exam. For coding questions, you do not need to

More information

Decaf Language Reference Manual

Decaf Language Reference Manual Decaf Language Reference Manual C. R. Ramakrishnan Department of Computer Science SUNY at Stony Brook Stony Brook, NY 11794-4400 cram@cs.stonybrook.edu February 12, 2012 Decaf is a small object oriented

More information

USAL1J: Java Collections. S. Rosmorduc

USAL1J: Java Collections. S. Rosmorduc USAL1J: Java Collections S. Rosmorduc 1 A simple collection: ArrayList A list, implemented as an Array ArrayList l= new ArrayList() l.add(x): adds x at the end of the list l.add(i,x):

More information

Università degli Studi di Bologna Facoltà di Ingegneria. Principles, Models, and Applications for Distributed Systems M

Università degli Studi di Bologna Facoltà di Ingegneria. Principles, Models, and Applications for Distributed Systems M Università degli Studi di Bologna Facoltà di Ingegneria Principles, Models, and Applications for Distributed Systems M Control Structures Intro. Sequential execution Statements are normally executed one

More information

Text User Interfaces. Keyboard IO plus

Text User Interfaces. Keyboard IO plus Text User Interfaces Keyboard IO plus User Interface and Model Model: objects that solve problem at hand. User interface: interacts with user getting input from user giving output to user reporting on

More information

Outline. Object Oriented Programming. Course goals. Staff. Course resources. Assignments. Course organization Introduction Java overview Autumn 2003

Outline. Object Oriented Programming. Course goals. Staff. Course resources. Assignments. Course organization Introduction Java overview Autumn 2003 Outline Object Oriented Programming Autumn 2003 2 Course goals Software design vs hacking Abstractions vs language (syntax) Java used to illustrate concepts NOT a course about Java Prerequisites knowledge

More information

UMBC CMSC 331 Final Exam

UMBC CMSC 331 Final Exam UMBC CMSC 331 Final Exam Name: UMBC Username: You have two hours to complete this closed book exam. We reserve the right to assign partial credit, and to deduct points for answers that are needlessly wordy

More information

Software and Programming 1

Software and Programming 1 Software and Programming 1 Lab 1: Introduction, HelloWorld Program and use of the Debugger 17 January 2019 SP1-Lab1-2018-19.pptx Tobi Brodie (tobi@dcs.bbk.ac.uk) 1 Module Information Lectures: Afternoon

More information

Full file at

Full file at Chapter 1 Primitive Java Weiss 4 th Edition Solutions to Exercises (US Version) 1.1 Key Concepts and How To Teach Them This chapter introduces primitive features of Java found in all languages such as

More information

EECS168 Exam 3 Review

EECS168 Exam 3 Review EECS168 Exam 3 Review Exam 3 Time: 2pm-2:50pm Monday Nov 5 Closed book, closed notes. Calculators or other electronic devices are not permitted or required. If you are unable to attend an exam for any

More information

Getting started with Java

Getting started with Java Getting started with Java by Vlad Costel Ungureanu for Learn Stuff Programming Languages A programming language is a formal constructed language designed to communicate instructions to a machine, particularly

More information

DOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS

DOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS Chapter 1 : Chapter-wise Java Multiple Choice Questions and Answers Interview MCQs Java Programming questions and answers with explanation for interview, competitive examination and entrance test. Fully

More information

Introduction to Java Applications

Introduction to Java Applications 2 Introduction to Java Applications OBJECTIVES In this chapter you will learn: To write simple Java applications. To use input and output statements. Java s primitive types. Basic memory concepts. To use

More information

STUDENT LESSON A12 Iterations

STUDENT LESSON A12 Iterations STUDENT LESSON A12 Iterations Java Curriculum for AP Computer Science, Student Lesson A12 1 STUDENT LESSON A12 Iterations INTRODUCTION: Solving problems on a computer very often requires a repetition of

More information

AL GHURAIR UNIVERSITY College of Computing. Objectives: Examples: Text-printing program. CSC 209 JAVA I

AL GHURAIR UNIVERSITY College of Computing. Objectives: Examples: Text-printing program. CSC 209 JAVA I AL GHURAIR UNIVERSITY College of Computing CSC 209 JAVA I week 2- Arithmetic and Decision Making: Equality and Relational Operators Objectives: To use arithmetic operators. The precedence of arithmetic

More information

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved. Assoc. Prof. Dr. Marenglen Biba (C) 2010 Pearson Education, Inc. All rights reserved. Java application A computer program that executes when you use the java command to launch the Java Virtual Machine

More information

CS 1331 Exam 1 ANSWER KEY

CS 1331 Exam 1 ANSWER KEY CS 1331 Exam 1 Fall 2016 ANSWER KEY Failure to properly fill in the information on this page will result in a deduction of up to 5 points from your exam score. Signing signifies you are aware of and in

More information

Example: Fibonacci Numbers

Example: Fibonacci Numbers Example: Fibonacci Numbers Write a program which determines F n, the (n + 1)-th Fibonacci number. The first 10 Fibonacci numbers are 0, 1, 1, 2, 3, 5, 8, 13, 21, and 34. The sequence of Fibonacci numbers

More information

AP Computer Science Summer Work Mrs. Kaelin

AP Computer Science Summer Work Mrs. Kaelin AP Computer Science Summer Work 2018-2019 Mrs. Kaelin jkaelin@pasco.k12.fl.us Welcome future 2018 2019 AP Computer Science Students! I am so excited that you have decided to embark on this journey with

More information

Chapter. Focus of the Course. Object-Oriented Software Development. program design, implementation, and testing

Chapter. Focus of the Course. Object-Oriented Software Development. program design, implementation, and testing Introduction 1 Chapter 5 TH EDITION Lewis & Loftus java Software Solutions Foundations of Program Design 2007 Pearson Addison-Wesley. All rights reserved Focus of the Course Object-Oriented Software Development

More information

COE318 Lecture Notes Week 4 (Sept 26, 2011)

COE318 Lecture Notes Week 4 (Sept 26, 2011) COE318 Software Systems Lecture Notes: Week 4 1 of 11 COE318 Lecture Notes Week 4 (Sept 26, 2011) Topics Announcements Data types (cont.) Pass by value Arrays The + operator Strings Stack and Heap details

More information

CMSC 433 Section 0101 Fall 2012 Midterm Exam #1

CMSC 433 Section 0101 Fall 2012 Midterm Exam #1 Name: CMSC 433 Section 0101 Fall 2012 Midterm Exam #1 Directions: Test is closed book, closed notes. Answer every question; write solutions in spaces provided. Use backs of pages for scratch work. Good

More information

Introduction to Classes and Objects Pearson Education, Inc. All rights reserved.

Introduction to Classes and Objects Pearson Education, Inc. All rights reserved. 1 3 Introduction to Classes and Objects 2 You will see something new. Two things. And I call them Thing One and Thing Two. Dr. Theodor Seuss Geisel Nothing can have value without being an object of utility.

More information

Midterm assessment - MAKEUP Fall 2010

Midterm assessment - MAKEUP Fall 2010 M257 MTA Faculty of Computer Studies Information Technology and Computing Date: /1/2011 Duration: 60 minutes 1-Version 1 M 257: Putting Java to Work Midterm assessment - MAKEUP Fall 2010 Student Name:

More information

CSCI 135 Exam #1 Fundamentals of Computer Science I Fall 2014

CSCI 135 Exam #1 Fundamentals of Computer Science I Fall 2014 CSCI 135 Exam #1 Fundamentals of Computer Science I Fall 2014 Name: This exam consists of 8 problems on the following 8 pages. You may use your two- sided hand- written 8 ½ x 11 note sheet during the exam.

More information

12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.

12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments. Java How to Program, 9/e Education, Inc. All Rights Reserved. } Java application programming } Use tools from the JDK to compile and run programs. } Videos at www.deitel.com/books/jhtp9/ Help you get started

More information

NATIONAL UNIVERSITY OF SINGAPORE

NATIONAL UNIVERSITY OF SINGAPORE NATIONAL UNIVERSITY OF SINGAPORE SCHOOL OF COMPUTING TERM TEST #1 Semester 1 AY2006/2007 CS1101X/Y/Z PROGRAMMING METHODOLOGY 16 September 2006 Time Allowed: 60 Minutes INSTRUCTIONS 1. This question paper

More information

Object-Oriented Programming

Object-Oriented Programming Object-Oriented Programming Java Syntax Program Structure Variables and basic data types. Industry standard naming conventions. Java syntax and coding conventions If Then Else Case statements Looping (for,

More information