UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 214 MODULE TEST 1

Size: px
Start display at page:

Download "UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 214 MODULE TEST 1"

Transcription

1 UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 214 MODULE TEST 1 DATE: 12 March 2014 TIME: 4 hours MARKS: 220 ASSESSORS: Prof. P.J. Blignaut & Mr G.J. Dollman BONUS MARKS: 7 MODERATOR: Dr T. Beelders This is an open-book test. You may use any of the listed text books for this module but you may not search for solutions online. Internet access will not be available for the duration of the assessment. You may use the tools available in VS2012 such as IntelliSense. No mobile computing devices may be active for the duration of the assessment (Mobile phones, tablets, etc). A maximum mark of 220 can be awarded for this assessment. Question 1 (Arrays, Algorithm complexity) Consider an array of integer numbers. Start with a new console application and save it as Question_1. Type the following Main() method. static void Main(string[] args) int[] Numbers = 4, 7, 2, 8, 4, 9, 2, 4, 7, 5 ; int mode = 0, F = 0; ModeForUnsortedArray(... Console.WriteLine("Mode = " + mode + "\nfrequency = " + F); Array.Sort(Numbers); mode = 0; F = 0; ModeForSortedArray(... Console.WriteLine("Mode = " + mode + "\nfrequency = " + F); Console.ReadKey(); //Main (6) 1.1 Write the method ModeForUnsortedArray. The method should take the Numbers array as first parameter. The method should also have two reference parameters to return the mode (element that occurs at the highest frequency) and frequency of the mode in the array. (12) 1.2 What is the complexity of the algorithm in 1.1? (2) 1.3 Write the method ModeForSortedArray. The method signature should be the same as for 1.1. The method should make use of the sorted nature of the array and implement a more efficient algorithm. (10) 1.4 What is the complexity of the algorithm in 1.3? (2) [32] 1

2 Question 2 (Recursion) Start with a new console application and save it as Question_2. Develop a recursive method to raise a number to a given integer power according to the definition: [13] 1 n = 0, x n = (x 2 ) n/2 n > 0, n is even x(x 2 ) n/2 n > 0, n is odd for example x 7 = x.(x 2 ) 3 = x.(x 2 ).(x 2 ) 2 x 8 = (x 2 ) 4 = ((x 2 ) 2 ) 2 x 9 = x.(x 2 ) 4 = x.((x 2 ) 2 ) 2 x 10 = (x 2 ) 5 = (x 2 ).((x 2 ) 2 ) 2 x 11 = x.(x 2 ) 5 = x.(x 2 ).((x 2 ) 2 ) 2 Use the following Main() method to test your method. You can change the hard coded values of x and n to test your method for various test data sets. static void Main(string[] args) int x = 2, n = 9; Console.WriteLine(x.ToString() + "^" + n.tostring() + " = " +... Console.Write("Press any key to exit..."); Console.ReadKey(); //Main Question 3 (Operator overloading, Indexers) A matrix can be defined as a two-dimensional array with m rows and n columns. The following two matrices have 2 rows and 3 columns each: [ ] [ ] Start with a new console application and save it as Question_3. 2

3 Consider the following Main() method with its output: static void Main(string[] args) //Define matrices 1 int[,] a = new int[,] 2, 1, 3, 1, 2, 1 ; 2 Matrix A = new Matrix(a); 3 Matrix B = new Matrix( new int[,] 1, 2, 1, 3, 2, 1 ); //Write A to the screen 4 Console.WriteLine("A"); 5 Console.Write(A.ToString()); 6 Console.WriteLine("A[1,2] = " + A[1, 2]); 7 Console.WriteLine(); //Write B to the screen 8 Console.WriteLine("B"); 9 Console.Write(B); 10 Console.WriteLine("B[1,0] = " + B[1, 0]); 11 Console.WriteLine(); //Write A + B to the screen 12 Console.WriteLine("A + B"); 13 Console.WriteLine(A + B); //Opportunity to read output 14 Console.ReadKey(); //Main Develop the class Matrix. 3.1 Provide a private data member, M, to be a two dimensional array of integers and will contain the data of the matrix. (2) 3.2 Develop the constructor of the class. The constructor should receive a two dimensional array as parameter and assign it to the data member of 3.1. (3) 3.3 Provide two properties, nrows and ncols respectively, to return the number of rows and the number of columns in the matrix. Note that the test data above is only test data and your class must make provision for any number of rows or columns. (4) 3.4 Override the ToString() method to return a string version of the content of the matrix. Comment out lines 6, 10 and 13 in the Main() method to test your program so far. (11) 3.5 Provide an indexer that will allow the class user to refer to an element in the matrix without reference to the inaccessible private two-dimensional array. In other words, a class user should be able to type A[1,2] to refer to the element in the second row and third column. Lines 6 and 10 should now also run. (8) 3.6 Two matrices of the same dimensions can be added together by adding the elements in corresponding positions. Define the + operator for the Matrix class. Line 13 should run now. (15) [ ] [ ] [ ] [43] 3

4 Question 4 (OOP) Start with a new Windows Forms application and save it as Question_4. Add the following interface to your application: interface IContainer<T> bool AddElement(T element); bool RemoveElement(T element); void Clear(); //interface 4.1 Develop a class, CContainer, that inherits from IContainer. The class will serve as generic base class for anything that contains some elements. The class must have a generic type parameter for the type of elements that it will contain. (3) Declare a protected generic list, Contents, that will contain elements of type T. (2) Provide an int property, Capacity, for the capacity (maximum number of elements) of the container. It must not be possible to change the property from outside the class. (3) The constructor of the class must instantiate the list of contents. The constructor should have a single parameter which must be used to assign a value for the capacity. (3) Provide an indexer which will return and set the value of the element in the i th position of the generic list. (7) Provide all necessary declarations for the following events: OnFull, OnEmpty, OnAdd and OnRemove. The OnAdd and OnRemove events must have an int parameter for the number of elements that are currently in the container. (8) Implement the interface method AddElement(T element). The method should add the given element to the list of elements and trigger the OnAdd event if the capacity will not be exceeded. Trigger the event OnFull if the addition means that the capacity has been reached with the addition. Return true if the element could be added and false otherwise. (9) Implement the interface method RemoveElement(T element). The method should remove the given element from the list and trigger the OnRemove event if it exists. Trigger the OnEmpty method if the removal means that the list will be empty after the removal. Return true of the element was removed successfully and false otherwise. (9) Develop a method Save() that will serialize the contents of the generic list. (9) Develop a method, Read(), that will deserialize the saved data of and enter the data in the generic list, Contents. Raise the OnAdd event. (10) Now consider the scenario of a parking lot. When a car enters the parking lot, a machine will provide a ticket with a unique number and the date-time stamp of entry. When the car leaves, a fee will be charged that is based on the time inside the parking lot. 4.2 Develop a struct, Car. (1) Provide a string property for the ticket number and a DateTime property for the time of entry. The properties must not be accessible from outside the struct. (4) The constructor must have a single string parameter for the ticket number that will be used to assign a value to the applicable property. The current date and time must be assigned to the property for the time of entry. (4) Mark the class as serializable. (1) 4

5 4.3 Develop a class, CParkingLot, that will inherit from CContainer. Specify the struct Car to be the type of elements that will be saved in the container class. (3) Provide a private decimal field for the tariff per hour. (1) The constructor must have a parameter for the capacity of the parking lot as well as for the tariff per hour. The constructor must use the parameter to assign the tariff per hour and pass the capacity through to the constructor of the base class. (4) Provide a public method that will return the fee due when a car leaves the parking lot. The car must be specified as a parameter. This fee must be calculated as the number of hours since entry, multiplied by the tariff per hour. (5) Provide an indexer that will return the car with a specified ticket number. Return default(car) if the ticket number is not found. (10) 4.4 Consider the screen print below Provide buttons to simulate the gate equipment to print a ticket upon entry and charge a fee upon exit of a car. Provide a vertical track bar to visualise the current status of the parking lot. (3) Declare an object of the class CParkingLot on class level. Instantiate a parking lot with a capacity of 8 cars and a tariff of R5 per hour in the form s constructor. Assign event handlers for all events. Set the Maximum property of the track bar to the capacity of the parking lot. (8) The OnAdd and OnRemove event handlers must update the Value property of the track bar. The OnFull and OnEmpty event handler must display appropriate message box. (12) The Check in button must ask the user for a ticket number and then call the AddElement method to add a new car to the parking lot. (5) The Check out button must ask the user for a ticket number and then call the Fee method and display the amount due. It must also call the RemoveElement method for the specific car. (11) Call the Save() method in the FormClosing() event handler. Call the method Read() in the Load() event handler. (4) [139] 5

6 MEMORANDUM Question 1 class Program static void Main(string[] args) int[] Numbers = 4, 7, 2, 8, 4, 9, 2, 4, 7, 5 ; int mode = 0, F = 0; 1. ModeForUnsortedArray(Numbers, ref mode, ref F ); Console.WriteLine("Mode = " + mode + "\nfrequency = " + F); Array.Sort(Numbers); mode = 0; F = 0; 1. ModeForSortedArray(Numbers, ref mode, ref F ); Console.WriteLine("Mode = " + mode + "\nfrequency = " + F); Console.ReadKey(); //Main 1.1 private static void ModeForUnsortedArray(int[] A, ref int mode, ref int F ) 1.2 O(n 2 ) for (int i = 0; i < A.Length; i++) int n = 1; for (int j = 1; j < A.Length; j++) if (A[i] == A[j]) n++; if (n > F) F = n; mode = A[i]; //for i //ModeForUnsortedArray 1.3 private static void ModeForSortedArray(int[] A, ref int mode, ref int F) int n = 1; for (int i = 1; i < A.Length; i++) if (A[i] == A[i - 1]) n++; else n = 1; if (n > F) F = n; mode = A[i]; //for i //ModeForUnsortedArray //class Program 1.4 O(n) 6

7 Question 2 class Program static void Main(string[] args) int x = 2, n = 9; Console.WriteLine(x.ToString() + "^" + n.tostring() + " = " + Power(x,n) ); Console.Write("Press any key to exit..."); Console.ReadKey(); //Main public static int Power(int x, int n ) //It does not really matter what the types are if (n == 0) return 1; if (n % 2 == 0) return Power(x*x, n/2 ); return x * Power(x*x, n/2 ); //class Program 7

8 Question 3 class Matrix 3.1. private int[,] M; //Constructor 3.2. public Matrix(int[,] M) this.m = M; 3.3. //Properties private int nrows get return M.GetLength(0); private int ncols get return M.GetLength(1); 3.4. //Override ToString(); public override string ToString() string s = ""; for (int i = 0; i < nrows; i++) for (int j = 0; j < ncols; j++) s += M[i, j] + "\t"; s += "\n"; return s; //ToString() 3.5. //Indexer public int this [int i, int j ] get return M[i, j]; set M[i, j] = value; 3.6. //Operator + public static Matrix operator + (Matrix A, Matrix B ) Matrix S = new Matrix(new int[a.nrows, A.nCols]); for (int i = 0; i < A.nRows; i++) for (int j = 0; j < A.nCols; j++) S[i, j] = A[i, j] + B[i, j]; return S; //operator + //class Matrix 8

9 Question delegate void delonfull(); delegate void delonempty(); delegate void delonadd(int Quantity); delegate void delonremove(int Quantity); 4.1 class CContainer<T> : IContainer <T> protected List<T> Contents; public int Capacity get; private set; public event delonfull OnFull; public event delonempty OnEmpty; public event delonadd OnAdd; public event delonremove OnRemove; //Constructor public CContainer(int Capacity ) Contents = new List<T>(); this.capacity = Capacity; //Constructor public T this [int i ] get return Contents[i]; set Contents[i] = value; //indexer private int Quantity get return Contents.Count; //Quantity public bool AddElement(T Content ) if (Contents.Count < Capacity) Contents.Add(Content); OnAdd(Quantity); if (Quantity >= Capacity) OnFull(); return true; return false; //AddContent public bool RemoveElement(T Content ) if (Contents.IndexOf(Content) >= 0) Contents.Remove(Content); OnRemove(Quantity); if (Quantity == 0) OnEmpty(); return true; return false; //RemoveContent 9

10 4.1.8 public void Save() FileStream fs = new FileStream("ParkingLot.bin", FileMode.Create); IFormatter formatter = new BinaryFormatter(); formatter.serialize(fs, Contents); fs.close(); //Save public void Read() FileStream fs = new FileStream("ParkingLot.bin", FileMode.Open); IFormatter formatter = new BinaryFormatter(); Contents = (List<T>)formatter.Deserialize(fs); fs.close(); OnAdd(Quantity); //Read //class CContainer [Serializable] struct Car public string TicketNumber get; private set; public DateTime dtin get; private set; public Car(string TicketNumber ) : this() this.ticketnumber = TicketNumber; this.dtin = DateTime.Now; //struct Car 4.3 class CParkingLot : CContainer <Car> private decimal TariffPerHour; public CParkingLot(int Capacity, decimal TariffPerHour ) : base(capacity) this.tariffperhour = TariffPerHour; public decimal Fee(Car car ) return ((int)datetime.now.subtract(car.dtin).totalhours + 1) * TariffPerHour; public Car this [string TicketNumber ] get int i = Contents.FindIndex(element => element.ticketnumber == TicketNumber); return i >= 0? Contents[i] : default(car) ; //indexer //CParkingLot 10

11 Form public partial class CfrmParkingLot : Form CParkingLot ParkingLot; public CfrmParkingLot() InitializeComponent(); ParkingLot = new CParkingLot(8, 5); ParkingLot.OnFull += ParkingLot_OnFull; ParkingLot.OnEmpty += ParkingLot_OnEmpty; ParkingLot.OnAdd += ParkingLot_OnAdd; ParkingLot.OnRemove += ParkingLot_OnRemove; trbarstatus.maximum = ParkingLot.Capacity; //Constructor private void CfrmParkingLot_Load(object sender, EventArgs e) ParkingLot.Read(); //CfrmParkingLot_Load private void CfrmParkingLot_FormClosing(object sender, FormClosingEventArgs e) ParkingLot.Save(); //CfrmParkingLot_FormClosing #region Event handlers private void ParkingLot_OnRemove(int Quantity) trbarstatus.value = Quantity; private void ParkingLot_OnAdd(int Quantity) trbarstatus.value = Quantity; private void ParkingLot_OnEmpty() MessageBox.Show("Empty", "PARKING LOT"); //ParkingLot_OnEmpty private void ParkingLot_OnFull() MessageBox.Show("Full", "PARKING LOT"); //ParkingLot_OnFull #endregion Event handlers 11

12 #region Buttons private void btncheckin_click(object sender, EventArgs e) string sticketnumber = Interaction.InputBox("Ticket number:", "PARKING LOT"); ParkingLot.AddElement(new Car(sTicketNumber) ); //btncheckin_click private void btncheckout_click(object sender, EventArgs e) string sticketnumber = Interaction.InputBox("Ticket number:", "PARKING LOT"); decimal Fee = ParkingLot.Fee(ParkingLot[sTicketNumber] ); if (ParkingLot.RemoveElement(ParkingLot[sTicketNumber])) MessageBox.Show("Fee: " + Fee.ToString("C"), "PARKING LOT"); else MessageBox.Show("No such car", "PARKING LOT"); //btncheckout_click #endregion Buttons //class CfrmParkingLot 12

UNIVERSITY OF THE FREE STATE MAIN & QWA-QWA CAMPUS RIS 124 DEPARTMENT: COMPUTER SCIENCE AND INFORMATICS CONTACT NUMBER:

UNIVERSITY OF THE FREE STATE MAIN & QWA-QWA CAMPUS RIS 124 DEPARTMENT: COMPUTER SCIENCE AND INFORMATICS CONTACT NUMBER: UNIVERSITY OF THE FREE STATE MAIN & QWA-QWA CAMPUS RIS 124 DEPARTMENT: COMPUTER SCIENCE AND INFORMATICS CONTACT NUMBER: 4012754 EXAMINATION: Main End-of-year Examination 2013 PAPER 1 ASSESSORS: Prof. P.J.

More information

Answer the following questions on the answer sheet that is provided. The computer must be switched off while you are busy with Section A.

Answer the following questions on the answer sheet that is provided. The computer must be switched off while you are busy with Section A. UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 114 DATE: 25 April 2013 TIME: 180 minutes MARKS: 100 ASSESSORS: Prof. P.J. Blignaut & Mr. F. Radebe (+2 bonus marks) MODERATOR:

More information

This is an open-book test. You may use the text book Be Sharp with C# but no other sources, written or electronic, will be allowed.

This is an open-book test. You may use the text book Be Sharp with C# but no other sources, written or electronic, will be allowed. UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 124 DATE: 5 September 2011 TIME: 3½ hours MARKS: 150 ASSESSORS: Prof. P.J. Blignaut & Mr. M.B. Mase MODERATOR: Dr. A. van

More information

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS2614 MODULE TEST 1

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS2614 MODULE TEST 1 UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS2614 MODULE TEST 1 DATE: 18 March 2016 MARKS: 165 ASSESSOR: Prof. P.J. Blignaut (Bonus 8) MODERATOR: Dr T. Beelders TIME:

More information

This is an open-book test. You may use the text book Be Sharp with C# but no other sources, written or electronic, will be allowed.

This is an open-book test. You may use the text book Be Sharp with C# but no other sources, written or electronic, will be allowed. UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 124 DATE: 1 September 2014 TIME: 3 hours MARKS: 105 ASSESSORS: Prof. P.J. Blignaut BONUS MARKS: 3 MODERATOR: Dr. L. De Wet

More information

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 114 CLASS TEST 2 and 3 DATE: 4 August 2014 TIME: 180 minutes MARKS: 70

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 114 CLASS TEST 2 and 3 DATE: 4 August 2014 TIME: 180 minutes MARKS: 70 UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS RIS 114 CLASS TEST 2 and 3 DATE: 4 August 2014 TIME: 180 minutes MARKS: 70 ASSESSOR: Prof. P.J. Blignaut (+1 bonus mark) This

More information

UNIVERSITY OF THE FREE STATE MAIN CAMPUS CSIS2614 DEPARTMENT: COMPUTER SCIENCE AND INFORMATICS CONTACT NUMBER:

UNIVERSITY OF THE FREE STATE MAIN CAMPUS CSIS2614 DEPARTMENT: COMPUTER SCIENCE AND INFORMATICS CONTACT NUMBER: UNIVERSITY OF THE FREE STATE MAIN CAMPUS CSIS2614 DEPARTMENT: COMPUTER SCIENCE AND INFORMATICS CONTACT NUMBER: 4012754 EXAMINATION: Additional Half Year Examination 2016 ASSESSORS: Prof. P.J. Blignaut

More information

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS1614

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS1614 UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS1614 DATE: 7 May 2015 MARKS: 130 ASSESSOR: Prof. P.J. Blignaut (Bonus marks: 5) MODERATOR: Dr. L. de Wet TIME: 180 minutes

More information

RIS214. Class Test 3

RIS214. Class Test 3 RIS214 Class Test 3 Use console applications to solve the following problems and employ defensive programming to prevent run-time errors. Every question will be marked as follows: mark = copied? -5 : runs?

More information

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS 2614 MODULE TEST 2

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS 2614 MODULE TEST 2 UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS 2614 MODULE TEST 2 DATE: 13 May 2016 TIME: 3.5 hours MARKS: 112 ASSESSOR: Prof. P.J. Blignaut BONUS MARKS: 5 MODERATOR:

More information

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS 2614 MODULE TEST 2

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS 2614 MODULE TEST 2 UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS 2614 MODULE TEST 2 DATE: 12 May 2017 TIME: 3 hours MARKS: 110 ASSESSORS: Prof. P. Blignaut & Mr. G. Dollman BONUS MARKS:

More information

Lab #10 Multi-dimensional Arrays

Lab #10 Multi-dimensional Arrays Multi-dimensional Arrays Sheet s Owner Student ID Name Signature Group partner 1. Two-Dimensional Arrays Arrays that we have seen and used so far are one dimensional arrays, where each element is indexed

More information

Memorandum. 1.1 public enum Days : int { Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6, Sunday = 7 }

Memorandum. 1.1 public enum Days : int { Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6, Sunday = 7 } Memorandum Question 1 1.1 public enum Days : int Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6, Sunday = 7 1.2 class Temps private double[] Values = new double[7]; 1.3

More information

Lesson11-Inheritance-Abstract-Classes. The GeometricObject case

Lesson11-Inheritance-Abstract-Classes. The GeometricObject case Lesson11-Inheritance-Abstract-Classes The GeometricObject case GeometricObject class public abstract class GeometricObject private string color = "White"; private DateTime datecreated = new DateTime(2017,

More information

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS1614. DATE: 5 March 2015 MARKS: 100 SECTION A (36)

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS1614. DATE: 5 March 2015 MARKS: 100 SECTION A (36) UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS1614 DATE: 5 March 2015 MARKS: 100 ASSESSOR: Prof. P.J. Blignaut TIME: 180 minutes MODERATOR: Dr. L. de Wet SECTION A (36)

More information

FACULTY OF SCIENCE ACADEMY OF COMPUTER SCIENCE & SOFTWARE ENGINEERING IFM01B1 / IFM1B10 INTRODUCTION TO DATA STRUCTURES (VB)

FACULTY OF SCIENCE ACADEMY OF COMPUTER SCIENCE & SOFTWARE ENGINEERING IFM01B1 / IFM1B10 INTRODUCTION TO DATA STRUCTURES (VB) FACULTY OF SCIENCE ACADEMY OF COMPUTER SCIENCE & SOFTWARE ENGINEERING MODULE CAMPUS IFM01B1 / IFM1B10 INTRODUCTION TO DATA STRUCTURES (VB) APK EXAM NOVEMBER 2014 DATE 2014-11-08 SESSION 08h30 10h30 ASSESSORS

More information

Object Oriented Programming in C#

Object Oriented Programming in C# Introduction to Object Oriented Programming in C# Class and Object 1 You will be able to: Objectives 1. Write a simple class definition in C#. 2. Control access to the methods and data in a class. 3. Create

More information

University of Palestine. Mid Exam Total Grade: 100

University of Palestine. Mid Exam Total Grade: 100 First Question No. of Branches (5) A) Choose the correct answer: 1. If we type: system.out.println( a ); in the main() method, what will be the result? int a=12; //in the global space... void f() { int

More information

This exam is open book. Each question is worth 3 points.

This exam is open book. Each question is worth 3 points. This exam is open book. Each question is worth 3 points. Page 1 / 15 Page 2 / 15 Page 3 / 12 Page 4 / 18 Page 5 / 15 Page 6 / 9 Page 7 / 12 Page 8 / 6 Total / 100 (maximum is 102) 1. Are you in CS101 or

More information

Learn C# Errata. 3-9 The Nullable Types The Assignment Operators

Learn C# Errata. 3-9 The Nullable Types The Assignment Operators 1 The following pages show errors from the original edition, published in July 2008, corrected in red. Future editions of this book will be printed with these corrections. We apologize for any inconvenience

More information

IST311. Advanced Issues in OOP: Inheritance and Polymorphism

IST311. Advanced Issues in OOP: Inheritance and Polymorphism IST311 Advanced Issues in OOP: Inheritance and Polymorphism IST311/602 Cleveland State University Prof. Victor Matos Adapted from: Introduction to Java Programming: Comprehensive Version, Eighth Edition

More information

Department of Networks College of Bardarash Technical Institute DUHOK Polytechnic University Subject: Programming Fundamental by JAVA Course Book

Department of Networks College of Bardarash Technical Institute DUHOK Polytechnic University Subject: Programming Fundamental by JAVA Course Book 1 Department of Networks College of Bardarash Technical Institute DUHOK Polytechnic University Subject: Programming Fundamental by JAVA Course Book Year 1 Lecturer's name: MSc. Sami Hussein Ismael Academic

More information

Framework Fundamentals

Framework Fundamentals Questions Framework Fundamentals 1. Which of the following are value types? (Choose all that apply.) A. Decimal B. String C. System.Drawing.Point D. Integer 2. Which is the correct declaration for a nullable

More information

C# Programming for Developers Course Labs Contents

C# Programming for Developers Course Labs Contents C# Programming for Developers Course Labs Contents C# Programming for Developers...1 Course Labs Contents...1 Introduction to C#...3 Aims...3 Your First C# Program...3 C# The Basics...5 The Aims...5 Declaring

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

Inheritance and Polymorphism

Inheritance and Polymorphism Object Oriented Programming Designed and Presented by Dr. Ayman Elshenawy Elsefy Dept. of Systems & Computer Eng.. Al-Azhar University Website: eaymanelshenawy.wordpress.com Email : eaymanelshenawy@azhar.edu.eg

More information

Programming using C# LECTURE 07. Inheritance IS-A and HAS-A Relationships Overloading and Overriding Polymorphism

Programming using C# LECTURE 07. Inheritance IS-A and HAS-A Relationships Overloading and Overriding Polymorphism Programming using C# LECTURE 07 Inheritance IS-A and HAS-A Relationships Overloading and Overriding Polymorphism What is Inheritance? A relationship between a more general class, called the base class

More information

POLYTECHNIC OF NAMIBIA SCHOOL OF COMPUTING AND INFORMATICS DEPARTMENT OF COMPUTER SCIENCE

POLYTECHNIC OF NAMIBIA SCHOOL OF COMPUTING AND INFORMATICS DEPARTMENT OF COMPUTER SCIENCE POLYTECHNIC OF NAMIBIA SCHOOL OF COMPUTING AND INFORMATICS DEPARTMENT OF COMPUTER SCIENCE COURSE NAME: OBJECT ORIENTED PROGRAMMING COURSE CODE: OOP521S NQF LEVEL: 6 DATE: NOVEMBER 2015 DURATION: 2 HOURS

More information

Software Systems Development Unit AS1: Introduction to Object Oriented Development

Software Systems Development Unit AS1: Introduction to Object Oriented Development New Specification Centre Number 71 Candidate Number ADVANCED SUBSIDIARY (AS) General Certificate of Education 2014 Software Systems Development Unit AS1: Introduction to Object Oriented Development [A1S11]

More information

CS S-08 Arrays and Midterm Review 1

CS S-08 Arrays and Midterm Review 1 CS112-2012S-08 Arrays and Midterm Review 1 08-0: Arrays ArrayLists are not part of Java proper 08-1: Arrays Library class Created using lower-level Java construct: Array Arrays are like a stripped-down

More information

Microsoft Visual Basic 2005: Reloaded

Microsoft Visual Basic 2005: Reloaded Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 10 Creating Classes and Objects Objectives After studying this chapter, you should be able to: Define a class Instantiate an object from a class

More information

Classes and Objects 3/28/2017. How can multiple methods within a Java class read and write the same variable?

Classes and Objects 3/28/2017. How can multiple methods within a Java class read and write the same variable? Peer Instruction 8 Classes and Objects How can multiple methods within a Java class read and write the same variable? A. Allow one method to reference a local variable of the other B. Declare a variable

More information

Exam Duration: 2hrs and 30min Software Design

Exam Duration: 2hrs and 30min Software Design Exam Duration: 2hrs and 30min. 433-254 Software Design Section A Multiple Choice (This sample paper has less questions than the exam paper The exam paper will have 25 Multiple Choice questions.) 1. Which

More information

Inheritance. Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L

Inheritance. Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L Inheritance Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L 9.1 9.4 1 Inheritance Inheritance allows a software developer to derive

More information

Java Fundamentals (II)

Java Fundamentals (II) Chair of Software Engineering Languages in Depth Series: Java Programming Prof. Dr. Bertrand Meyer Java Fundamentals (II) Marco Piccioni static imports Introduced in 5.0 Imported static members of a class

More information

COE 212 Engineering Programming. Welcome to the Final Exam Tuesday December 15, 2015

COE 212 Engineering Programming. Welcome to the Final Exam Tuesday December 15, 2015 1 COE 212 Engineering Programming Welcome to the Final Exam Tuesday December 15, 2015 Instructors: Dr. Salim Haddad Dr. Bachir Habib Dr. Joe Tekli Dr. Wissam F. Fawaz Name: Student ID: Instructions: 1.

More information

Windows File I/O. Files. Collections of related data stored on external storage media and assigned names so that they can be accessed later

Windows File I/O. Files. Collections of related data stored on external storage media and assigned names so that they can be accessed later Windows File I/O Files Collections of related data stored on external storage media and assigned names so that they can be accessed later Entire collection is a file A file is made up of records One record

More information

Objects as a programming concept

Objects as a programming concept Objects as a programming concept IB Computer Science Content developed by Dartford Grammar School Computer Science Department HL Topics 1-7, D1-4 1: System design 2: Computer Organisation 3: Networks 4:

More information

Introduction to C# Applications

Introduction to C# Applications 1 2 3 Introduction to C# Applications OBJECTIVES To write simple C# applications To write statements that input and output data to the screen. To declare and use data of various types. To write decision-making

More information

Programming Problems 22nd Annual Computer Science Programming Contest

Programming Problems 22nd Annual Computer Science Programming Contest Programming Problems 22nd Annual Computer Science Programming Contest Department of Mathematics and Computer Science Western Carolina University 5 April 2011 Problem One: Add Times Represent a time by

More information

Final exam. Final exam will be 12 problems, drop any 2. Cumulative up to and including week 14 (emphasis on weeks 9-14: classes & pointers)

Final exam. Final exam will be 12 problems, drop any 2. Cumulative up to and including week 14 (emphasis on weeks 9-14: classes & pointers) Review Final exam Final exam will be 12 problems, drop any 2 Cumulative up to and including week 14 (emphasis on weeks 9-14: classes & pointers) 2 hours exam time, so 12 min per problem (midterm 2 had

More information

EEE-425 Programming Languages (2013) 1

EEE-425 Programming Languages (2013) 1 2 Namespaces Classes Fields Properties Methods Attributes Events Interfaces (contracts) Methods Properties Events Control Statements if, else, while, for, switch foreach Additional Features Operation Overloading

More information

// Precondition: None // Postcondition: The address' name has been set to the // specified value set;

// Precondition: None // Postcondition: The address' name has been set to the // specified value set; // File: Address.cs // This classes stores a typical US address consisting of name, // two address lines, city, state, and 5 digit zip code. using System; using System.Collections.Generic; using System.Linq;

More information

Engr 123 April 25, 2018 Final Exam Review. 3. Write a method which will accept a string and return the number of three-letter words in the string.

Engr 123 April 25, 2018 Final Exam Review. 3. Write a method which will accept a string and return the number of three-letter words in the string. Engr 123 April 25, 2018 Final Exam Review Final Exam is Monday April 30, 2018 at 8:00am 1. Write a method named EvenOdd which will accept a string and a bool as arguments. If the bool is true the method

More information

Practice Midterm 2 CMPS 12A Fall 2017

Practice Midterm 2 CMPS 12A Fall 2017 1.) Determine the output of the following program. public class Question1{ Car x = new Car("gray", 100000); Car y = new Car("red", 125000); Car z = new Car("blue", 150000); x = y; roadtrip(x); z = x; System.out.println(z.mileage);

More information

CS/B.TECH/CSE(New)/SEM-5/CS-504D/ OBJECT ORIENTED PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70 GROUP A. (Multiple Choice Type Question)

CS/B.TECH/CSE(New)/SEM-5/CS-504D/ OBJECT ORIENTED PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70 GROUP A. (Multiple Choice Type Question) CS/B.TECH/CSE(New)/SEM-5/CS-504D/2013-14 2013 OBJECT ORIENTED PROGRAMMING Time Allotted : 3 Hours Full Marks : 70 The figures in the margin indicate full marks. Candidates are required to give their answers

More information

AP Computer Science Chapter 10 Implementing and Using Classes Study Guide

AP Computer Science Chapter 10 Implementing and Using Classes Study Guide AP Computer Science Chapter 10 Implementing and Using Classes Study Guide 1. A class that uses a given class X is called a client of X. 2. Private features of a class can be directly accessed only within

More information

Lab - 1. Solution : 1. // Building a Simple Console Application. class HelloCsharp. static void Main() System.Console.WriteLine ("Hello from C#.

Lab - 1. Solution : 1. // Building a Simple Console Application. class HelloCsharp. static void Main() System.Console.WriteLine (Hello from C#. Lab - 1 Solution : 1 // Building a Simple Console Application class HelloCsharp static void Main() System.Console.WriteLine ("Hello from C#."); Solution: 2 & 3 // Building a WPF Application // Verifying

More information

C# Fundamentals. Hans-Wolfgang Loidl School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh

C# Fundamentals. Hans-Wolfgang Loidl School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh C# Fundamentals Hans-Wolfgang Loidl School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh Semester 1 2018/19 H-W. Loidl (Heriot-Watt Univ) F20SC/F21SC 2018/19

More information

3.Constructors and Destructors. Develop cpp program to implement constructor and destructor.

3.Constructors and Destructors. Develop cpp program to implement constructor and destructor. 3.Constructors and Destructors Develop cpp program to implement constructor and destructor. Constructors A constructor is a special member function whose task is to initialize the objects of its class.

More information

Chapter 1 Getting Started

Chapter 1 Getting Started Chapter 1 Getting Started The C# class Just like all object oriented programming languages, C# supports the concept of a class. A class is a little like a data structure in that it aggregates different

More information

1 Short Answer (15 Points Each)

1 Short Answer (15 Points Each) Name: Write all of your responses on these exam pages. If you need extra space please use the backs of the pages. 1 Short Answer (15 Points Each) 1. Write the following Java declarations, (a) A double

More information

Advanced Programming - JAVA Lecture 4 OOP Concepts in JAVA PART II

Advanced Programming - JAVA Lecture 4 OOP Concepts in JAVA PART II Advanced Programming - JAVA Lecture 4 OOP Concepts in JAVA PART II Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg Ad hoc-polymorphism Outline Method overloading Sub-type Polymorphism Method overriding Dynamic

More information

Object Oriented Programming

Object Oriented Programming Islamic University of Gaza Faculty of Engineering Computer Engineering Department Computer Programming Lab (ECOM 2114) Lab 11 Object Oriented Programming Eng. Mohammed Alokshiya December 16, 2014 Object-oriented

More information

CIS Intro to Programming in C#

CIS Intro to Programming in C# OOP: Creating Classes and Using a Business Tier McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. Understand how a three-tier application separates the user interface from the business

More information

CSE 331 Summer 2017 Final Exam. The exam is closed book and closed electronics. One page of notes is allowed.

CSE 331 Summer 2017 Final Exam. The exam is closed book and closed electronics. One page of notes is allowed. Name Solution The exam is closed book and closed electronics. One page of notes is allowed. The exam has 6 regular problems and 1 bonus problem. Only the regular problems will count toward your final exam

More information

CS141 Programming Assignment #10

CS141 Programming Assignment #10 CS141 Programming Assignment #10 Due Sunday, May 5th. 1) Write a class with the following methods: a) max( int [][] a) Returns the maximum integer in the array. b) min(int [][] a) Returns the minimum integer

More information

And Even More and More C++ Fundamentals of Computer Science

And Even More and More C++ Fundamentals of Computer Science And Even More and More C++ Fundamentals of Computer Science Outline C++ Classes Special Members Friendship Classes are an expanded version of data structures (structs) Like structs, the hold data members

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

Chapter 5: Classes and Objects in Depth. Information Hiding

Chapter 5: Classes and Objects in Depth. Information Hiding Chapter 5: Classes and Objects in Depth Information Hiding Objectives Information hiding principle Modifiers and the visibility UML representation of a class Methods Message passing principle Passing parameters

More information

a) Answer all questions. b) Write your answers in the space provided. c) Show all calculations where applicable.

a) Answer all questions. b) Write your answers in the space provided. c) Show all calculations where applicable. Name: Please fill in your Student Number and Name. Student Number : Student Number: University of Cape Town ~ Department of Computer Science Computer Science 1015F ~ 2008 January Exam Question Max Internal

More information

Exam 2. CSC 121 MW Class. Lecturer: Howard Rosenthal. April 26, 2017

Exam 2. CSC 121 MW Class. Lecturer: Howard Rosenthal. April 26, 2017 Your Name: Exam 2. CSC 121 MW Class Lecturer: Howard Rosenthal April 26, 2017 The following questions (or parts of questions) in numbers 1-7 are all worth 3 points each. 1. Answer the following as true

More information

1. What is the difference between a compiler and an interpreter? Also, discuss Java s method.

1. What is the difference between a compiler and an interpreter? Also, discuss Java s method. Name: Write all of your responses on these exam pages. 1 Short Answer (5 Points Each) 1. What is the difference between a compiler and an interpreter? Also, discuss Java s method. 2. Java is a platform-independent

More information

It is a constructor and is called using the new statement, for example, MyStuff m = new MyStuff();

It is a constructor and is called using the new statement, for example, MyStuff m = new MyStuff(); COSC 117 Exam 3 Key Fall 2012 Part 1: Definitions & Short Answer (3 Points Each) 1. A method in a class that has no return type and the same name as the class is called what? How is this type of method

More information

1 Short Answer (10 Points Each)

1 Short Answer (10 Points Each) 1 Short Answer (10 Points Each) 1. For the following one-dimensional array, show the final array state after each pass of the three sorting algorithms. That is, after each iteration of the outside loop

More information

and event handlers Murach's C# 2012, C6 2013, Mike Murach & Associates, Inc. Slide 1

and event handlers Murach's C# 2012, C6 2013, Mike Murach & Associates, Inc. Slide 1 Chapter 6 How to code methods and event handlers Murach's C# 2012, C6 2013, Mike Murach & Associates, Inc. Slide 1 Objectives Applied 1. Given the specifications for a method, write the method. 2. Give

More information

Distributed Systems Recitation 1. Tamim Jabban

Distributed Systems Recitation 1. Tamim Jabban 15-440 Distributed Systems Recitation 1 Tamim Jabban Office Hours Office 1004 Tuesday: 9:30-11:59 AM Thursday: 10:30-11:59 AM Appointment: send an e-mail Open door policy Java: Object Oriented Programming

More information

CS111: PROGRAMMING LANGUAGE II. Lecture 1: Introduction to classes

CS111: PROGRAMMING LANGUAGE II. Lecture 1: Introduction to classes CS111: PROGRAMMING LANGUAGE II Lecture 1: Introduction to classes Lecture Contents 2 What is a class? Encapsulation Class basics: Data Methods Objects Defining and using a class In Java 3 Java is an object-oriented

More information

Prelim 1. CS 2110, October 1, 2015, 5:30 PM Total Question Name True Short Testing Strings Recursion

Prelim 1. CS 2110, October 1, 2015, 5:30 PM Total Question Name True Short Testing Strings Recursion Prelim 1 CS 2110, October 1, 2015, 5:30 PM 0 1 2 3 4 5 Total Question Name True Short Testing Strings Recursion False Answer Max 1 20 36 16 15 12 100 Score Grader The exam is closed book and closed notes.

More information

1 Method Signatures and Overloading (3 minutes, 2 points)

1 Method Signatures and Overloading (3 minutes, 2 points) CS180 Spring 2010 Exam 1 Solutions, 15 February, 2010 Prof. Chris Clifton Turn Off Your Cell Phone. Use of any electronic device during the test is prohibited. Time will be tight. If you spend more than

More information

Duhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain

Duhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain Duhok Polytechnic University Amedi Technical Institute/ IT Dept. By Halkawt Rajab Hussain 2016-04-02 Objects and classes: Basics of object and class in C#. Private and public members and protected. Static

More information

Motivation. Reflection in C# Case study: Implicit Serialisation. Using implicit serialisation. Hans-Wolfgang Loidl

Motivation. Reflection in C# Case study: Implicit Serialisation. Using implicit serialisation. Hans-Wolfgang Loidl Reflection in C# Motivation Hans-Wolfgang Loidl School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh Sometimes you want to get access to concepts in C# that

More information

Fall CS 101: Test 2 Name UVA ID. Grading. Page 1 / 4. Page3 / 20. Page 4 / 13. Page 5 / 10. Page 6 / 26. Page 7 / 17.

Fall CS 101: Test 2 Name UVA  ID. Grading. Page 1 / 4. Page3 / 20. Page 4 / 13. Page 5 / 10. Page 6 / 26. Page 7 / 17. Grading Page 1 / 4 Page3 / 20 Page 4 / 13 Page 5 / 10 Page 6 / 26 Page 7 / 17 Page 8 / 10 Total / 100 1. (4 points) What is your course section? CS 101 CS 101E Pledged Page 1 of 8 Pledged The following

More information

1.00 Introduction to Computers and Engineering Problem Solving Quiz 1 March 4, 2005

1.00 Introduction to Computers and Engineering Problem Solving Quiz 1 March 4, 2005 1.00 Introduction to Computers and Engineering Problem Solving Quiz 1 March 4, 2005 Name: E-mail Address: TA: Section: You have 80 minutes to complete this exam. For coding questions, you do not need to

More information

Midterm I - CSE11 Fall 2013 CLOSED BOOK, CLOSED NOTES 50 minutes, 100 points Total.

Midterm I - CSE11 Fall 2013 CLOSED BOOK, CLOSED NOTES 50 minutes, 100 points Total. Midterm I - CSE11 Fall 2013 CLOSED BOOK, CLOSED NOTES 50 minutes, 100 points Total. Name: ID: Problem 1) (8 points) For the following code segment, what are the values of i, j, k, and d, after the segment

More information

C# machine model. Programming Language Concepts and Implementation Fall 2011, Lecture 2. Rasmus Ejlers Møgelberg

C# machine model. Programming Language Concepts and Implementation Fall 2011, Lecture 2. Rasmus Ejlers Møgelberg C# machine model Programming Language Concepts and Implementation Fall 2011, Lecture 2 Reference types vs. value types Structs 2-dimensional arrays Overview Method calls: call-by-value vs. call-by-reference

More information

C# Types. Industrial Programming. Value Types. Signed and Unsigned. Lecture 3: C# Fundamentals

C# Types. Industrial Programming. Value Types. Signed and Unsigned. Lecture 3: C# Fundamentals C# Types Industrial Programming Lecture 3: C# Fundamentals Industrial Programming 1 Industrial Programming 2 Value Types Memory location contains the data. Integers: Signed: sbyte, int, short, long Unsigned:

More information

Cmpt 135 Assignment 2: Solutions and Marking Rubric Feb 22 nd 2016 Due: Mar 4th 11:59pm

Cmpt 135 Assignment 2: Solutions and Marking Rubric Feb 22 nd 2016 Due: Mar 4th 11:59pm Assignment 2 Solutions This document contains solutions to assignment 2. It is also the Marking Rubric for Assignment 2 used by the TA as a guideline. The TA also uses his own judgment and discretion during

More information

Distributed Systems Recitation 1. Tamim Jabban

Distributed Systems Recitation 1. Tamim Jabban 15-440 Distributed Systems Recitation 1 Tamim Jabban Office Hours Office 1004 Sunday, Tuesday: 9:30-11:59 AM Appointment: send an e-mail Open door policy Java: Object Oriented Programming A programming

More information

Software and Programming 1

Software and Programming 1 Software and Programming 1 Week 9 Lab - Use of Classes and Inheritance 8th March 2018 SP1-Lab9-2018.ppt Tobi Brodie (Tobi@dcs.bbk.ac.uk) 1 Lab 9: Objectives Exercise 1 Student & StudentTest classes 1.

More information

Data dependent execution order data dependent control flow

Data dependent execution order data dependent control flow Chapter 5 Data dependent execution order data dependent control flow The method of an object processes data using statements, e.g., for assignment of values to variables and for in- and output. The execution

More information

COP 3330 Final Exam Review

COP 3330 Final Exam Review COP 3330 Final Exam Review I. The Basics (Chapters 2, 5, 6) a. comments b. identifiers, reserved words c. white space d. compilers vs. interpreters e. syntax, semantics f. errors i. syntax ii. run-time

More information

Industrial Programming

Industrial Programming Industrial Programming Lecture 3: C# Fundamentals Industrial Programming 1 C# Types Industrial Programming 2 Value Types Memory location contains the data. Integers: Signed: sbyte, int, short, long Unsigned:

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

Arrays. Arrays. Wolfgang Schreiner Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria

Arrays. Arrays. Wolfgang Schreiner Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria Arrays Wolfgang Schreiner Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria Wolfgang.Schreiner@risc.jku.at http://www.risc.jku.at Wolfgang Schreiner RISC Arrays

More information

Questions Answer Key Questions Answer Key Questions Answer Key

Questions Answer Key Questions Answer Key Questions Answer Key Benha University Term: 2 nd (2013/2014) Class: 2 nd Year Students Subject: Object Oriented Programming Faculty of Computers & Informatics Date: 26/4/2014 Time: 1 hours Exam: Mid-Term (C) Name:. Status:

More information

CSCE 145 Exam 2 Review No Answers. This exam totals to 100 points. Follow the instructions. Good luck!

CSCE 145 Exam 2 Review No Answers. This exam totals to 100 points. Follow the instructions. Good luck! CSCE 145 Exam 2 Review No Answers This exam totals to 100 points. Follow the instructions. Good luck! Chapter 5 This chapter was mostly dealt with objects expect questions similar to these. 1. Create accessors

More information

Introduction to Programming Written Examination

Introduction to Programming Written Examination Introduction to Programming Written Examination 23.9.2016 FIRST NAME STUDENT NUMBER LAST NAME SIGNATURE Instructions for students: Write First Name, Last Name, Student Number and Signature where indicated.

More information

Lecture 3. COMP1006/1406 (the Java course) Summer M. Jason Hinek Carleton University

Lecture 3. COMP1006/1406 (the Java course) Summer M. Jason Hinek Carleton University Lecture 3 COMP1006/1406 (the Java course) Summer 2014 M. Jason Hinek Carleton University today s agenda assignments 1 (graded) & 2 3 (available now) & 4 (tomorrow) a quick look back primitive data types

More information

Classes, Objects, and OOP in Java. June 16, 2017

Classes, Objects, and OOP in Java. June 16, 2017 Classes, Objects, and OOP in Java June 16, 2017 Which is a Class in the below code? Mario itsame = new Mario( Red Hat? ); A. Mario B. itsame C. new D. Red Hat? Whats the difference? int vs. Integer A.

More information

Arrays. Chapter Arrays What is an Array?

Arrays. Chapter Arrays What is an Array? Chapter 8 Arrays 81 Arrays 811 What is an Array? To motivate why we might be interested in using arrays, let us implement an app that creates a collection of doubles We will keep track of the number of

More information

Binghamton University. CS-140 Fall Problem Solving. Creating a class from scratch

Binghamton University. CS-140 Fall Problem Solving. Creating a class from scratch Problem Solving Creating a class from scratch 1 Recipe for Writing a Class 1. Write the class boilerplate stuff 2. Declare Fields 3. Write Creator(s) 4. Write accessor methods 5. Write mutator methods

More information

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University 9/5/6 CS Introduction to Computing II Wayne Snyder Department Boston University Today: Arrays (D and D) Methods Program structure Fields vs local variables Next time: Program structure continued: Classes

More information

CSEN 202: Introduction to Computer Programming Spring term Final Exam

CSEN 202: Introduction to Computer Programming Spring term Final Exam Page 0 German University in Cairo May 28, 2016 Media Engineering and Technology Prof. Dr. Slim Abdennadher Dr. Wael Aboul Saadat CSEN 202: Introduction to Computer Programming Spring term 2015-2016 Final

More information

Langage C# et environnement.net M1 Année

Langage C# et environnement.net M1 Année Cahier de TP C# et.net SÉANCE 1 : BASIC OOL CONCEPTS...1 SÉANCE 2 : DELEGATES, EVENTS, THREAD-SAFE CONTROL ACCESS, RESOURCE MANAGEMENT...3 SÉANCE 3 : INHERITANCE, POLYMORPHISM, CONTAINERS, SERIALIZATION...5

More information

Problem Statement. A1: being lapped on the track

Problem Statement. A1: being lapped on the track Problem Statement A1: being lapped on the track You and your friend are running laps on the track at the rec complex. Your friend passes you exactly X times in one of your laps (that is, you start the

More information

EXAMINATION FOR THE BSC (HONS) INFORMATION TECHNOLOGY; BSC (HONS) INFORMATION SYSTEMS & BSC (HONS) COMPUTER SCIENCE; YEAR 1

EXAMINATION FOR THE BSC (HONS) INFORMATION TECHNOLOGY; BSC (HONS) INFORMATION SYSTEMS & BSC (HONS) COMPUTER SCIENCE; YEAR 1 FACULTY OF SCIENCE AND TECHNOLOGY EXAMINATION FOR THE BSC (HONS) INFORMATION TECHNOLOGY; BSC (HONS) INFORMATION SYSTEMS & BSC (HONS) COMPUTER SCIENCE; YEAR 1 ACADEMIC SESSION 2014; SEMESTER 2 PRG1203:

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

Systems Programming. Bachelor in Telecommunication Technology Engineering Bachelor in Communication System Engineering Carlos III University of Madrid

Systems Programming. Bachelor in Telecommunication Technology Engineering Bachelor in Communication System Engineering Carlos III University of Madrid Systems Programming Bachelor in Telecommunication Technology Engineering Bachelor in Communication System Engineering Carlos III University of Madrid Leganés, 21st of March, 2014. Duration: 75 min. Full

More information

Exponentiation and Java

Exponentiation and Java Exponentiation and Java Stephen Merrin Abstract We discuss an interesting teaching example for the Java programming language, where the problem is how to handle the operation of exponentiation. Speci cally,

More information