# Masters programmes in Computer Science and Information Systems. Object-Oriented Design and Programming. Sample module entry test xxth December 2013

Save this PDF as:

Size: px
Start display at page:

Download "Masters programmes in Computer Science and Information Systems. Object-Oriented Design and Programming. Sample module entry test xxth December 2013"

## Transcription

1 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 will have. Allocated time: 90 mins 18:15 19:45 Candidates should attempt ALL XX questions on the paper. You are advised to look through the questions before commencing your answers to assist in planning your strategy. Simplicity and clarity of expression in your answers is important. Electronic calculators are NOT allowed. This is a closed book test. You should not use a computer of any type to assist in answering the questions (this includes mobile devices of any type). Question: Total Marks: Answer the questions in the spaces provided on the question sheets. If you run out of room for an answer, continue on the back of the page. Name: User Id: OODP entry test Page 1 of 12 c Birkbeck 2013

2 Question marks Write a switch statement to print the word even if the int variable number is even, or print the word odd if number is odd. Question marks For each of the following in an Employee class, state whether it should be static, instance, or local. (a) An array of employees Social Security numbers. (b) Their job title. (c) A method to compute bonuses based on job titles. (d) A variable used to hold the number of hours they have worked this week. (e) A variable used to compute their additional pay for overtime work. Question marks (a) (What is the purpose of the JDK? That is, what does having it allow you to do? 3 marks (b) What is the purpose of the JRE? That is, what does having it allow you to do? 3 marks OODP entry test Page 2 of 12 c Birkbeck 2013

3 Question marks You can compute the average of two numbers by adding them together and dividing by two. (a) Write a method to compute and return the average of two double values. 2 marks (b) Should the above method be static? Why or why not? 2 marks (c) What will happen if you try to call the above method with two int values? 2 marks Question marks Every Person must have a name. Every Employee (which extends Person) must have an integer employeeid. Write a minimal constructor for Employee utilising best practices for encapsulation. OODP entry test Page 3 of 12 c Birkbeck 2013

4 Question marks Two Book objects are equal if they have the same ISBN, where isbn is an instance variable of type String. Write a correct and complete equals method for Book objects, and indicate (with annotation) that it overrides the inherited equals method. Question marks A class has a private instance int[] variable called position. Write a getter method for position. OODP entry test Page 4 of 12 c Birkbeck 2013

5 Question marks (a) String s contains only digits. Write a single assignment statement to convert this string to an integer and assign it to variable n. 2 marks (b) Can you use the access modifiers public and private for variables declared inside a method? Why or why not? 2 marks Question marks Consider the following code fragment. 1 ArrayList<String> list = new ArrayList<>(); 2 list.add("p"); 3 list.add("q"); 4 list.add("r"); 5 list.set(2,"s"); 6 list.add(2,"t"); 7 list.add("u"); 8 System.out.println(list); What is printed as a result of executing the code segment? [An extract from the API for the java.util.arraylist class is given at the end of the paper.] OODP entry test Page 5 of 12 c Birkbeck 2013

6 Question marks List the four access modifiers available in Java and explain what each means for the instance variable or method that it modifies. OODP entry test Page 6 of 12 c Birkbeck 2013

7 Question marks What is the output of the following Java program? 1 public class SuperWriter { 2 3 public SuperWriter(int n) { 4 for (int i = 0; i < n; i++) 5 System.out.print("N"); 6 } 7 8 public SuperWriter() { 9 System.out.print("W"); 10 } public static void main(string[] args) { 13 System.out.println("String..."); 14 new Writer("ZYU"); 15 System.out.println(); 16 new SuperWriter(5); 17 System.out.println(); 18 } } class Writer extends SuperWriter { 23 public Writer(int num, boolean val, String s1, String s2) { 24 super(num - 1); 25 System.out.print(val? s1 : s2); 26 } public Writer() { 29 System.out.print("I"); 30 } public Writer(String name) { 33 System.out.println("A"); 34 System.out.println(name); 35 new Writer(); 36 new Writer(2, (1 > 3), "BB", "CD"); 37 } } 40 OODP entry test Page 7 of 12 c Birkbeck 2013

8 Question marks Write a recursive method that takes a string and produces the following output (this is for the string "abcde"). abcde abcd abc ab a ab abc abcd abcde OODP entry test Page 8 of 12 c Birkbeck 2013

9 Question marks Due to fire restrictions only a certain number of people are allowed to be in a building at the same time. Write a class Bods that will not permit more than N instances of Bods to be constructed. If an attempt is made to construct more than N Bods, then an appropriate error message should be printed and the program exited. You should also include a howmanybods method that returns the number of Bods constructed so far. OODP entry test Page 9 of 12 c Birkbeck 2013

10 Question marks Suppose you get a NullPointerException for the following statement: System.out.println(myFriend.spouse.getBirthday()); What can you say about the probable cause of the error? Question marks For whom should you write internal (// and /*...*/) comments, and what kind of information should you convey? Question marks Answer either part (a) or part (b), but NOT both. (a) Draw the memory diagram for the array that results from the following declaration: int[ ][ ] foo = new int[ ][ ] { { 3, 1, 4 }, {1, 5, 9 }, { 2, 6 } }; OODP entry test Page 10 of 12 c Birkbeck 2013

11 (b) What is printed by each of the following? i. System.out.print( "buckle my shoe" "close the door"); ii. System.out.print("hello".length() == 5? "yes" : "no"); iii. System.out.print(new char[] { a, b, c }); iv. int x; System.out.print(x = * 2); v. char[] chs = new char[] { a, b, c }; System.out.print(chs[1]); OODP entry test Page 11 of 12 c Birkbeck 2013

12 Extract from the API for java.util.arraylist<e> ArrayList() boolean add(e elem) void add(int index, E element) Object set(int index, E element) E get(int index) E remove(int index) int size() Constructs an empty list with an initial capacity of ten. Appends the specified element to the end of this list and returns true. Inserts the specified element at the position index in this list. Replaces the element at position index with the specified element. Returns the element at the specified position in this list; throws an exception if the index is out of range. Removes the element at the specified position in this list and returns the element removed. Returns the number of elements in this list. OODP entry test Page 12 of 12 c Birkbeck 2013

### CMSC 202H. ArrayList, Multidimensional Arrays

CMSC 202H ArrayList, Multidimensional Arrays What s an Array List ArrayList is a class in the standard Java libraries that can hold any type of object an object that can grow and shrink while your program

### Array-Based Lists. Lists

Array-Based Lists Collections and ArrayIntList Reading: RS Ch. 15 slides created by Marty Stepp http://www.cs.washington.edu/143/ Modified by Sarah Heckman Lists list: a collection storing an ordered sequence

### Software Development with UML and Java 2 SDJ I2, Spring 2010

Software Development with UML and Java 2 SDJ I2, Spring 2010 Agenda week 7, 2010 Pakages Looking back Looking forward Packages Interfaces Page 1 Spring 2010 Download, Install/Setup 1. Java SE SDK (http://java.sun.com/javase/downloads)

### 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

### Sample 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

### Strings in Java String Objects

Strings in Java are objects. They are instances of the class String (in the package java.lang). As is the case with other objects, String variables are actually references to a String object in memory.

### J 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

### CSCE 111 Exam 1 TRUE/FALSE

CSCE 111 Exam 1 FORM B TRUE/FALSE 1. Java runs differently on different CPU architectures. F 2. A declared variable is always visible to the entire method in which it is declared. F 3. Because the operator

### Free 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

### Free 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

### AP 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

### COUNTING LOOPS AND ACCUMULATORS

COUNTING LOOPS AND ACCUMULATORS Two very important looping idioms are counting loops and accumulators. A counting loop uses a variable, called the loop control variable, to keep count of how many cycles

### Introduction 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

### int w = (x + x)*y - y; System.out.println("The value of w is " + w); z = w + 3; System.out.println("The value of z is now " + z);

MIT AITI Mobile Application Development in Java Lab 02: Java Basics Instructions on how to submit Lab 2 will be presented on the screen. Please follow instructions and if they are unclear, please feel

### CMPU102: Exam 1 Solutions Spring 2005

CMPU102: Exam 1 Solutions Spring 2005 1. Consider the following statements: int a = 4; int b = 7; b *= a; What are the resulting values of a and b? a = 4 b = 28 2. Consider the following statements: int

### Software 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

### EXPLICIT AND AUTOMATIC STRING CONVERSION IN JAVA

EXPLICIT AND AUTOMATIC STRING CONVERSION IN JAVA Data with other data types can be converted to String using explicit and automatic ways in Java. Explicit String conversion ways include: Use of the tostring()

### Lists in Java. Part of the Collections Framework. 16-Aug-11

Lists in Java Part of the Collections Framework 16-Aug-11 Kinds of Collections Collection a group of objects, called elements Set An unordered collection with no duplicates SortedSet An ordered collection

### Object-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,

### Arrays And ArrayLists

Arrays And ArrayLists "Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration. " - S. Kelly-Bootle AP Computer Science Arrays in Java 1 Arrays

### Object-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

### Computer Science 210: Data Structures. Arrays

Computer Science 210: Data Structures Arrays Summary Today arrays arrays of objects in-class: add an entry into an array Reading: Collections of data The most common thing you want to do when writing algorithms/code

### Michele Van Dyne MUS 204B https://katie.mtech.edu/classes/csci Using the Java Library

Michele Van Dyne MUS 204B mvandyne@mtech.edu https://katie.mtech.edu/classes/csci136 04 Using the Java Library The Java Library Many handy classes and methods Importing a package Dynamically sized arrays

### CS 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)

### System.out.println("\nEnter Product Number 1-5 (0 to stop and view summary) :

Benjamin Michael Java Homework 3 10/31/2012 1) Sales.java Code // Sales.java // Program calculates sales, based on an input of product // number and quantity sold import java.util.scanner; public class

### Java Classes. GEEN163 Introduction to Computer Programming

Java Classes GEEN163 Introduction to Computer Programming Never interrupt someone doing what you said couldn't be done. Amelia Earhart Classes, Objects, & Methods Object-oriented programming uses classes,

### Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language

Translation Translating to Java Introduction to Computer Programming The job of a programmer is to translate a problem description into a computer language. You need to be able to convert a problem description

### Part 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 ******

### AP 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

### Java 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

### (e) none of the above.

1 The default value of a static integer variable of a class in Java is, (a) 0 (b) 1 (c) Garbage value (d) Null (e) -1 2 What will be printed as the output of the following program? public class testincr

### Intro to Programming in Java Practice Midterm

600.107 Intro to Programming in Java Practice Midterm This test is closed book/notes. SHORT ANSWER SECTION [18 points total] 1) TRUE/FALSE - Please circle your choice: Tr for true, Fa for false. [1 point

### Part I:( Time: 90 minutes, 30 Points)

Qassim University Deanship of Educational Services Preparatory Year Program- Computer Science Unit Final Exam - 1434/1435 CSC111 Time: 2 Hours + 10 Minutes 1 MG Student name: Select the correct choice:

### Contents. 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

### Java Foundations: Unit 9. Error/Exception Handling

Java Foundations: Unit 9 Error/Exception Handling Introduction to Class Diagrams Containment vs. Inheritance is a relationship Person Inheritance: Student extends Person Employee extends Person Student

### Program Elements. Notes. Exercises CHAPTER 3

CHAPTER 3 Program Elements Notes Chapter 3 introduces the program elements that are the underlying constructs used inside an object to define the services it contributes to a program. Without these constructs,

### RECITATION 5 COMPOSITE DATA TYPES: ARRAYS AND CLASSES. F r o d o B a g g i n S!

RECITATION 5 COMPOSITE DATA TYPES: ARRAYS AND CLASSES For many interesting programs, we don t just want to use variables for a single data type, like int or boolean. We want to deal with lots of variables

### Strings in C++ and Java. Questions:

Strings in C++ and Java Questions: 1 1. What kind of access control is achieved by the access control modifier protected? 2 2. There is a slight difference between how protected works in C++ and how it

### Lecture J - Exceptions

Lecture J - Exceptions Slide 1 of 107. Exceptions in Java Java uses the notion of exception for 3 related (but different) purposes: Errors: an internal Java implementation error was discovered E.g: out

### Introduction to Computer Programming, Spring Term 2014 Practice Assignment 3 Discussion 15.3.2014-20.3.2014

German University in Cairo Media Engineering and Technology Prof. Dr. Slim Abdennadher Dr. Ahmed Gamal Introduction to Computer Programming, Spring Term 2014 Practice Assignment 3 Discussion 15.3.2014-20.3.2014

### CS 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

### Mock exam 1 for SCJP 6

Mock exam 1 for SCJP 6 The sample test is modeled on the Sun Certification for Java TM 6 Programmer exam. The test has 50 questions and needs to be executed in 2 hours. The real exam may be a little tougher

### The AP Java Subset. A Topics. Primitive Types. Operators. Topics. int double boolean

The AP Java Subset A Topics Topics Primitive Types Operators int double boolean +, -, *, /, % ++, -- = +=, -=, *=, /=, %= ==,!=, , = &&,,! Numeric Casts String Concatenation (int) (double) + will

### Course: Introduction to Java Using Eclipse Training

Course: Introduction to Java Using Eclipse Training Course Length: Duration: 5 days Course Code: WA1278 DESCRIPTION: This course introduces the Java programming language and how to develop Java applications

### First 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

### Preet 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

### CSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O

CSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O 1 Sending Output to a (Text) File import java.util.scanner; import java.io.*; public class TextFileOutputDemo1 public static void

### Reading a Text File. Reading and Writing Text Files Exceptions. Testing for more input. Example: Count Words

Reading a Text File Reading and Writing Text Files Exceptions 15-121 Fall 2010 Margaret Reid-Miller A Scanner object can be connected to many input sources: keyboard, file, network, string To read a text

### You 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

### Exam JP2011(Java Programming) MidTerm Test 5/ Name RegNo % 1 is. a) 1 b) 2 c) 3 d) 4 e) 0

Exam JP2011(Java Programming) MidTerm Test 5/6 2011 Name RegNo 1. 25 % 1 is. a) 1 b) 2 c) 3 d) 4 e) 0 2. -24 % -5 is. a) 3 b) -3 c) 4 d) -4 e) 0 3. Which of these data types requires the most amount of

### The if-else statement

Control Structures Processing and Java There is no difference between Processing syntax and Java syntax Processing has it s own IDE and provides lots of methods to do drawing and animation The main IDEs

### Objective 7 - Java Static Two-Dimensional Arrays

Ch 5 2D Arrays Multiple Choice Review Objective 7 - Java Static Two-Dimensional Arrays 33. Which of the following statements correctly declares a two-dimensional integer array? int Matrix[ ] = new int[5,4];

### CSE 8B Midterm Fall 2015

Name Signature Tutor Student ID CSE 8B Midterm Fall 2015 Page 1 (XX points) Page 2 (XX points) Page 3 (XX points) Page 4 (XX points) Page 5 (XX points) Total (XX points) 1. What is the Big-O complexity

### Q2: Which of the following are valid Java identifiers? If not explain why

Java Programming 1 (Revision) Name: Section#: ID: Q1: True/false 1. A Java identifier can start with a digit. (F) cannot 2. Hello, HELLO, and hello are considered as different identifiers. (T) 3. The name

### SL-110: Fundamentals of Java Revision 15 October Sun Educational Services Instructor-Led Course Description

Sun Educational Services Instructor-Led Course Description Fundamentals of Java SL-110 The Fundamentals of the Java course provides students, with little or no programming experience, with the basics of

### Arrays. 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

### Designing 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

### Handout 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

### 1) Which of the following is a constant, according to Java naming conventions? a. PI b. Test c. x d. radius

Programming Concepts Practice Test 1 1) Which of the following is a constant, according to Java naming conventions? a. PI b. Test c. x d. radius 2) Consider the following statement: System.out.println("1

### Chapter 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

### COMPUTER SCIENCE. Paper 1 (THEORY)

COMPUTER SCIENCE Paper 1 (THEORY) (Three hours) Maximum Marks: 70 (Candidates are allowed additional 15 minutes for only reading the paper. They must NOT start writing during this time) -----------------------------------------------------------------------------------------------------------------------

### public 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

### TRUE / FALSE MULTIPLE CHOICE

CS 111 Exam 3 FORM A TRUE / FALSE 1. If you write a tostring method for a class, it can be invoked automatically to output the string generated by that method. T 2. You can change the contents of a String

### Basic 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

### Programming 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

### C++ 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

### COSC 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

### Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups:

JAVA OPERATORS GENERAL Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators

### Self-test Java Programming

Self-test Java Programming Document: e0883test.fm 22/01/2013 ABIS Training & Consulting P.O. Box 220 B-3000 Leuven Belgium TRAINING & CONSULTING INTRODUCTION TO THE SELF-TEST JAVA PROGRAMMING This test

### Building 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

### COMP1008 Inheritance. Outline. Subclass and Superclass. Inheritance. Multiple Subclasses. Inheritance Hierarchy

Outline COMP1008 Inheritance Introduction to inheritance. How Java supports inheritance. Inheritance is a key feature of object-oriented programming. 2 Inheritance Subclass and Superclass Models the kind-of

1 2 Introduction to Java Applications 2.2 First Program in Java: Printing a Line of Text 2 Application Executes when you use the java command to launch the Java Virtual Machine (JVM) Sample program Displays

### Mobile App Design Project #1 Java Boot Camp: Design Model for Chutes and Ladders Board Game

Mobile App Design Project #1 Java Boot Camp: Design Model for Chutes and Ladders Board Game Directions: In mobile Applications the Control Model View model works to divide the work within an application.

### A Comparison of the Basic Syntax of Python and Java

Python Python supports many (but not all) aspects of object-oriented programming; but it is possible to write a Python program without making any use of OO concepts. Python is designed to be used interpretively.

### Introduction to Java Unit 6. Exercises: Arrays

Introduction to Java Unit 6. Exercises: Arrays 1. What is displayed? int [] cosmic = { 3, 6, 5, 8 ; System.out.println( cosmic[ 2 ] ); 2. What is displayed? String [] gamma = { "do", "re", "mi" ; System.out.println(

### AP Computer Science Static Methods, Strings, User Input

AP Computer Science Static Methods, Strings, User Input Static Methods The Math class contains a special type of methods, called static methods. A static method DOES NOT operate on an object. This is because

### qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq

qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq Introduction to Programming using Java wertyuiopasdfghjklzxcvbnmqwertyui

### Classes 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

### Multiple Choice Questions (20 points)

CSC142 Midterm 1 1 Multiple Choice Questions (20 points) Answer all of the following questions. READ EACH QUESTION CAREFULLY. Fill the correct bubble on your scantron sheet. Each correct answer is worth

### CS 307 Midterm 1 Fall 2009

Points off 1 2 3A 3B 4A 4B Total off Net Score CS 307 Midterm 1 Fall 2009 Your Name Your UTEID Circle yours TA s name: Oswaldo Rashid Swati Instructions: 1. Please turn off or silence your cell phones.

### Basic 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

### Java Programming. Final Examination on August 22, 2015 Summer 2015

Java Programming Final Examination on August 22, 2015 Summer 2015 Department of Computer Science and Information Engineering National Taiwan University Problem 1 (20 points) Multiple choice questions.

### Chapter 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

### INTI COLLEGE MALAYSIA

CSC112 (F) / Page 1 of 5 INTI COLLEGE MALAYSIA CERTIFICATE IN COMPUTING AND INFORMATION TECHNOLOGY PROGRAMME CSC 112 : FUNDAMENTALS OF PROGRAMMING FINAL EXAMINATION : DECEMBER 2002 SESSION This paper consists

### Moving 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

### Building 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

### Multiple Choice Questions (20 points)

CSC142 Midterm 2 1 Multiple Choice Questions (20 points) Answer all of the following questions. READ EACH QUESTION CAREFULLY. Fill the correct bubble on your scantron sheet. Each correct answer is worth

### Q1. For the following grammar: S a S b c E E d f E a

Chapter 3 (3.1 3.3) Describing Syntax and Semantics Chapter 4 Lexical and Syntax Analysis Chapter 5 Names, Binding, Type Checking and Scopes Chapter 6 Data Types Chapter 7 Expressions and Assignment Statements

### SYSTEMS PROGRAMMING C++ INTRODUCTION

Faculty of Computer Science / Institute of Systems Architecture / Operating Systems SYSTEMS PROGRAMMING C++ INTRODUCTION Alexander Warg WHY C++? C++ is the language that allows to express ideas from the

### Java 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

### Conditionals (with solutions)

Conditionals (with solutions) For exercises 1 to 27, indicate the output that will be produced. Assume the following declarations: final int MAX = 25, LIMIT = 100; int num1 = 12, num2 = 25, num3 = 87;

### WRITING DATA TO A BINARY FILE

WRITING DATA TO A BINARY FILE TEXT FILES VS. BINARY FILES Up to now, we have looked at how to write and read characters to and from a text file. Text files are files that contain sequences of characters.

### Chulalongkorn University International School of Engineering Department of Computer Engineering 2140105 Computer Programming Lab.

Chulalongkorn University Name International School of Engineering Student ID Department of Computer Engineering Station No. 2140105 Computer Programming Lab. Date Lab 2 Using Java API documents, command

### CSE 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[]

### Cohort: 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

### Introduction to Programming

Introduction to Programming Lecturer: Steve Maybank Department of Computer Science and Information Systems sjmaybank@dcs.bbk.ac.uk Spring 2015 Week 2b: Review of Week 1, Variables 16 January 2015 Birkbeck

### Introduction to Java Lecture Notes. Ryan Dougherty redoughe@asu.edu

1 Introduction to Java Lecture Notes Ryan Dougherty redoughe@asu.edu Table of Contents 1 Versions....................................................................... 2 2 Introduction...................................................................