Tentamen Objectgeorienteerd Programmeren



Vergelijkbare documenten
SAMPLE 11 = + 11 = + + Exploring Combinations of Ten + + = = + + = + = = + = = 11. Step Up. Step Ahead

Add the standing fingers to get the tens and multiply the closed fingers to get the units.

ALGORITMIEK: answers exercise class 7

FOR DUTCH STUDENTS! ENGLISH VERSION NEXT PAGE

L.Net s88sd16-n aansluitingen en programmering.

The first line of the input contains an integer $t \in \mathbb{n}$. This is followed by $t$ lines of text. This text consists of:

Firewall van de Speedtouch 789wl volledig uitschakelen?

Preschool Kindergarten

Group work to study a new subject.

Opgave 2 Geef een korte uitleg van elk van de volgende concepten: De Yield-to-Maturity of a coupon bond.

B1 Woordkennis: Spelling

After that, the digits are written after each other: first the row numbers, followed by the column numbers.

Tentamen T1 Chemische Analysemethoden 6 maart 2014

Universiteit van Amsterdam FNWI. Voorbeeld van tussentoets Inleiding programmeren

L.Net s88sd16-n aansluitingen en programmering.

MyDHL+ Van Non-Corporate naar Corporate

Comics FILE 4 COMICS BK 2

Four-card problem. Input

ANGSTSTOORNISSEN EN HYPOCHONDRIE: DIAGNOSTIEK EN BEHANDELING (DUTCH EDITION) FROM BOHN STAFLEU VAN LOGHUM

TOEGANG VOOR NL / ENTRANCE FOR DUTCH : lator=c&camp=24759

Understanding and being understood begins with speaking Dutch

FOR DUTCH STUDENTS! ENGLISH VERSION NEXT PAGE

FOR DUTCH STUDENTS! ENGLISH VERSION NEXT PAGE. Toets Inleiding Kansrekening 1 8 februari 2010

Luister alsjeblieft naar een opname als je de vragen beantwoordt of speel de stukken zelf!

FOR DUTCH STUDENTS! ENGLISH VERSION NEXT PAGE

Classification of triangles

0515 DUTCH (FOREIGN LANGUAGE)

Leeftijdcheck (NL) Age Check (EN)

Hoe met Windows 8 te verbinden met NDI Remote Office (NDIRO) How to connect With Windows 8 to NDI Remote Office (NDIRO

My Inspiration I got my inspiration from a lamp that I already had made 2 years ago. The lamp is the you can see on the right.

Introductie in flowcharts

Calculator spelling. Assignment

Engels op Niveau A2 Workshops Woordkennis 1

English is everywhere. hi morning mouse cool help desk hello computers mail school game. Lees de tekst. Omcirkel de Engelse woorden.

Meetkunde en Lineaire Algebra

LDA Topic Modeling. Informa5ekunde als hulpwetenschap. 9 maart 2015

Alle opgaven tellen even zwaar, 10 punten per opgave.

8+ 60 MIN Alleen te spelen in combinatie met het RIFUGIO basisspel. Only to be played in combination with the RIFUGIO basicgame.

i(i + 1) = xy + y = x + 1, y(1) = 2.

Find Neighbor Polygons in a Layer

Travel Survey Questionnaires

NSPYRE LEGO MINDSTORMS UITDAGING (JAVA) INLEIDING. DOEL: SIMULATOR:

1a. We werken het geval voor het tandenpoetsen uit. De concepten zijn (we gebruiken Engelse termen en afkortingen):

Meetkunde en Lineaire Algebra

(1) De hoofdfunctie van ons gezelschap is het aanbieden van onderwijs. (2) Ons gezelschap is er om kunsteducatie te verbeteren

Concept of Feedback. P.S. Gandhi Mechanical Engineering IIT Bombay

Data Handling Ron van Lammeren - Wageningen UR

Hoe te verbinden met NDI Remote Office (NDIRO): Apple OS X How to connect to NDI Remote Office (NDIRO): Apple OS X

Ius Commune Training Programme Amsterdam Masterclass 16 June 2016

Settings for the C100BRS4 MAC Address Spoofing with cable Internet.

public Paneel() { knop = new JButton( Klik ); knop.addactionlistener( new KnopHandler() ); tekstvak = new JTextField(10); add(knop); add(tekstvak);

TECHNISCHE UNIVERSITEIT EINDHOVEN Faculteit Wiskunde en Informatica. Tentamen Calculus B (2WBB1) op maandag 28 januari 2013, 14:00 17:00 uur

OPEN TRAINING. Onderhandelingen met leveranciers voor aankopers. Zeker stellen dat je goed voorbereid aan de onderhandelingstafel komt.

Ius Commune Training Programme Amsterdam Masterclass 15 June 2018

General info on using shopping carts with Ingenico epayments

RECEPTEERKUNDE: PRODUCTZORG EN BEREIDING VAN GENEESMIDDELEN (DUTCH EDITION) FROM BOHN STAFLEU VAN LOGHUM

Daylight saving time. Assignment

Buy Me FILE 5 BUY ME BK 2

0515 FOREIGN LANGUAGE DUTCH

Modelleren en Programmeren

Houdt u er alstublieft rekening mee dat het 5 werkdagen kan duren voordat uw taalniveau beoordeeld is.

In the classroom. Who is it? Worksheet

FOR DUTCH STUDENTS! ENGLISH VERSION NEXT PAGE. Toets Inleiding Kansrekening 1 22 februari 2013

Online Resource 1. Title: Implementing the flipped classroom: An exploration of study behaviour and student performance

Ontpopping. ORGACOM Thuis in het Museum

Cambridge International Examinations Cambridge International General Certificate of Secondary Education

Cambridge International Examinations Cambridge International General Certificate of Secondary Education

FOR DUTCH STUDENTS! ENGLISH VERSION NEXT PAGE. Toets Inleiding Kansrekening 1 7 februari 2011

Global TV Canada s Pulse 2011

Vergaderen in het Engels

S e v e n P h o t o s f o r O A S E. K r i j n d e K o n i n g

2019 SUNEXCHANGE USER GUIDE LAST UPDATED

Graphic Design. Keuzevak GD1. Raul Martinez-Orozco / raul@thecombine.nl)

It s all about the money Group work

C++ programmeermethoden Bachelor Kunstmatige Intelligentie

! GeoNetwork INSPIRE Atom!

Stars FILE 7 STARS BK 2

MyDHL+ ProView activeren in MyDHL+

Studentnummer: Inleiding Taalkunde 2013 Eindtoets Zet op ieder vel je naam en studentnummer!

[BP-ebMS-H-000] Welke versie van Hermes moet er gebruikt worden?

Cambridge International Examinations Cambridge International General Certificate of Secondary Education

What is the advantage of using expression language instead of JSP scriptlets and JSP expressions?

0515 DUTCH (FOREIGN LANGUAGE)

Quality requirements concerning the packaging of oak lumber of Houthandel Wijers vof ( )

Cambridge International Examinations Cambridge International General Certificate of Secondary Education. Paper 4 Writing May/June hour

TECHNISCHE UNIVERSITEIT EINDHOVEN Faculteit Wiskunde en Informatica. Examination 2DL04 Friday 16 november 2007, hours.

AE1103 Statics. 25 January h h. Answer sheets. Last name and initials:

A2 Workshops Grammatica Heden

LDAP Server on Yeastar MyPBX & tiptel 31xx/32xx series

Het is geen open boek tentamen. Wel mag gebruik gemaakt worden van een A4- tje met eigen aantekeningen.

Transcriptie:

Tentamen Objectgeorienteerd Programmeren 5082IMOP6Y maandag 16 november 2015 13:00 15:00 Schrijf je naam en studentnummer op de regel hieronder. Sla deze pagina niet om tot de surveillant vertelt dat het tentamen begonnen is. Leg je collegekaart of identiteitsbewijs klaar op je tafel. ~ Je mag gewoon in het Nederlands antwoorden!! ~ Dit tentamen is gesloten boek. Je mag echter tijdens het tentamen één tweezijdig beschreven of bedrukt A4 tje gebruiken. Daarnaast mag je een pen of potlood gebruiken, maar verder niets. ~ Je moet je antwoorden invullen in dit document. Scheur de bladzijden niet af. De opgaven worden t.z.t. gepubliceerd op de website van het vak. ~ Kladpapier kun je vinden op de achterkant van dit boekje. Tenzij anders vermeld mag je alle functies gebruiken die in opgaven, colleges en leeswerk van de cursus zijn behandeld. Je hoeft bij code geen commentaar te schrijven, maar het kan helpen in het geval je programma niet correct blijkt te zijn. Als je te weinig tijd hebt kun je uitwijken naar het schrijven van pseudocode om een deel van de punten te halen. SUCCES :-) 1 of 10

2 of 10

Java Basics. For each of the first two questions, circle the letter (a, b, c or d) of the one response that best answers the question or completes the statement; you need not explain your answers. 1. (1 point.) If a rich pensioner is a person of at least 67 years of age who receives more than 50,000 a year, which expression would define a rich pensioner? a. (age > 67) (pension > 50000) b. (age > 67) (pension >= 50000) c. (age >= 67) && (pension > 50000) d. (age >= 67) && (pension >= 50000) 2. (1 point.) What are the values of laptops, desktops, and computers after the following code has been executed? int laptops = 15; int desktops = 0; int computers = laptops + desktops; laptops = 0; desktops = 12; a. 0, 12, 15 b. 0, 12, 27 c. 15, 12, 15 d. 15, 12, 27 3. (2 points.) What is the result of evaluating the following expressions, and what is the resulting type? expression result type 3 / 6 * 6 + 1 4 % 3 == 4 / 6 && true false 3 + 3 + "A" + 3 + 3 3 of 10

What does it DO? Consider the ConsoleProgram below. import acm.program.*; public class What extends ConsoleProgram public void run() println(does(1, 3)); private int does(int a, int b) int c = it(a, b); int d = it(b, a); return do(c, d); private int it(int a, int b) int c = a * a; b += c; return c; private int do(int a, int b) a += b; b += a; return b; 4. (4 points.) What exactly is printed to the console as a result of running this program? 4 of 10

Computer says no. The following program fragment contains a method that will produce an error during compilation. public String exclaim(string str) String result = ""; for (int i = 0; i < str.length(); i++) char ch = str.charat(i); String letter = Character.toString(ch); result += letter.touppercase; return result; 5. (2 points.) How could you fix the error? 6. (2 points.) What will be written to the console if you fix the error and insert the following line in a run method? println(exclaim("hello World!")); 5 of 10

Writing exercise 7. (6 points.) Write a Console program that asks the user to input an integer. If the integer is 0 (the sentinel value), the program stops. Otherwise, the program ask for another integer. When program is stopped by means of entering the sentinel, it should print the length of the longest sequence of positive or negative numbers, whichever is longer. For example: jh@localhost:$ java -cp.:acm.jar LongestSequence? 1? -2? 3? 5? 9? -4? 0 The longest sequence was 3 positive numbers import acm.program.*; public class LongestSequence 6 of 10

Back to recursion to back to recursion. The following program fragment is a method that sums all integers from 1 to a given number n. public static int sumto(int n) if (n == 0) return 0; else int recurse = sumto(n - 1); int result = n + recurse; return result; 8. (2 points.) Re-write this method without recursion, using a for loop. 9. (2 points.) Re-write this method without recursion, using a while loop. 7 of 10

2001. Consider the following GraphicsProgram. Unfortunately, an error will occur if this program is run. import acm.program.*; import acm.graphics.*; import java.awt.*; public class Monolith extends GraphicsProgram GRect monolith; public void run() monolith.setcolor(color.black); add(monolith); 10. (2 points.) What kind of exception will occur? 11. (2 points.) Explain, in no more than three sentences, why this exception occurs. 12. (2 points.) Propose a fix for the code. 8 of 10

Paint 1.0. We would like to create a GraphicsProgram that can draw lines on the canvas. A click should define the starting point of a line and then the second click should be the endpoint of that line. The program should be capable of handling multiple lines, so the 3rd and 4th click should produce another line, as should the 5th and 6th, etc. 13. (6 points.) Complete the program, below, to implement the functionality described above. import acm.graphics.*; import acm.program.*; import java.awt.event.*; public class Lines extends GraphicsProgram public void run() addmouselisteners(); public void mouseclicked(mouseevent e) 9 of 10

Scrap Paper. Nothing on this page will be examined by the staff unless otherwise directed. 10 of 10