16
© 2017 Ralf Lämmel, SoftLang Team, University of Koblenz-Landau, Faculty of CS Mock exam 2017 1 Creative Commons License: softlang logos by Wojciech Kwasnik, Archina Void, Ralf Lämmel, Software Languages Team, Faculty of Computer Science, University of Koblenz-Landau is licensed under a Creative Commons Attribution 4.0 International License Prof. Dr. Ralf Lämmel University of Koblenz-Landau Faculty of Computer Science Software Languages Team

Mock exam 2017 - Uni Koblenz-Landau · Mock exam 2017 1 Creative Commons ... You need to be concise. ... The code is part of an analyzer for Java files. What is accomplished by the

  • Upload
    ngotruc

  • View
    213

  • Download
    0

Embed Size (px)

Citation preview

© 2017 Ralf Lämmel, SoftLang Team, University of Koblenz-Landau, Faculty of CS

Mock exam 2017

1

Creative Commons License: softlang logos by Wojciech Kwasnik, Archina Void, Ralf Lämmel, Software Languages Team, Faculty of Computer Science, University of Koblenz-Landau is licensed under a Creative Commons Attribution 4.0 International License

Prof. Dr. Ralf Lämmel University of Koblenz-Landau Faculty of Computer Science

Software Languages Team

© 2017 Ralf Lämmel, SoftLang Team, University of Koblenz-Landau, Faculty of CS

Logistics of actual exam 20 July 2017, regular lecture slot

• Mandatory registration until 18 July 2017

• 12.00-12.15: Take seats, check IDs, etc.

• 12.15-13.15: Exam

• Closed book exam

• Tasks in English

• Answers in German or English

• Resit end of Winter Semester

2

© 2017 Ralf Lämmel, SoftLang Team, University of Koblenz-Landau, Faculty of CS

Topics

1. Design patterns

2. Data programming

3. Metaprogramming

4. Mining Software Data

5. Distributed systems

6. Documentation of technologies

3

Exam topics = lecture topics = lab topics = assignment topics

1 task per topic. 3 points per task. 18 points in total.

Grading scale*: 9 points 4.0

… 18 points 1.0

* With adjustments to account for problematic tasks.

© 2017 Ralf Lämmel, SoftLang Team, University of Koblenz-Landau, Faculty of CS

Types of tasks• Code comprehension (3/6 tasks):

• “Explain the following code.”

• Concept comprehension (3/6 tasks):

• “Explain the concept XYZ.”

4

All tasks solely relate to lecture and lab material available online. http://www.softlang.org/course:ptt17

Concept comprehension tasks rely on lecture material. Code comprehension tasks are mostly drawn from lab material.

The space for answers will be

limited. You need to be concise.

© 2017 Ralf Lämmel, SoftLang Team, University of Koblenz-Landau, Faculty of CS

1st Topic “Design patterns”

• Concept comprehension:

• Summarize the problem addressed by the pattern X.

• Sketch a scenario in which to use the pattern.

• Provide a class diagram for the pattern’s solution.

• What are the roles of the classes and methods in the pattern’s solution.

• Relevant patterns:

Abstract Factory, Object Adapter, Class Adapter, Decorator, Observer, Proxy, Singleton, Template Method, Visitor

5

© 2017 Ralf Lämmel, SoftLang Team, University of Koblenz-Landau, Faculty of CS

Sample task “Design patterns”

6

Consider the solution of the Visitor patterm. What’s the problem addressed by the pattern?

What is the role of the classes and methods shown? How many visitConcreteElement-like methods do we

need in an application of the pattern?

© 2017 Ralf Lämmel, SoftLang Team, University of Koblenz-Landau, Faculty of CS

2nd Topic “Data programming”

• Code comprehension.

• Relevant technologies:

• org.jdom (DOM, JDOM)

• javax.json (JSON)

• java.sql (JDBC)

• JAXB

• JPA

7

© 2017 Ralf Lämmel, SoftLang Team, University of Koblenz-Landau, Faculty of CS

Sample task “Data programming”

8

@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "artikel", propOrder = {"name", "preis", "lagerbestand"}) public class Artikel { @XmlElement(required = true) protected String name; protected double preis; @XmlElement(required = true) protected BigInteger lagerbestand; @XmlAttribute(name = "identifier", required = true) @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlID @XmlSchemaType(name = "ID") protected String identifier; ... } The code was generated by JAXB.

What is the overall purpose of the annotations? Explain the semantics of two distinct annotations.

© 2017 Ralf Lämmel, SoftLang Team, University of Koblenz-Landau, Faculty of CS

3rd Topic “Metaprogramming”

• Concept comprehension:

• Relevant concepts

• Fluent APIs

• Parsing with ANTLR

• Java reflection

9

Template processing is omitted from exam.

© 2017 Ralf Lämmel, SoftLang Team, University of Koblenz-Landau, Faculty of CS

Sample task “Metaprogramming”

10

The code constructs a finite state machine. Which techniques for fluent APIs are used?

Briefly explain each technique based on the sample code. (3 techniques needed.)

© 2017 Ralf Lämmel, SoftLang Team, University of Koblenz-Landau, Faculty of CS

4th Topic “Mining Software Data”

• Code comprehension.

• Relevant techniques/technologies:

• Java Parser

• Regular expression matching

• Nltk (examples from lab)

11

© 2017 Ralf Lämmel, SoftLang Team, University of Koblenz-Landau, Faculty of CS

Sample task “Mining Software Data”

12

The code is part of an analyzer for Java files. What is accomplished by the code? (No detail explanation!)

What would typically follow the statement at hand? What sort of compilation is referred to? Why is it useful?

import java.util.regex.*; … Pattern classPattern = Pattern.compile( “(public|private|protected)?(\\s*class\\s+)” +”([a-zA-Z]+)" +”(\\s+.*\\{.*)" ); …

© 2017 Ralf Lämmel, SoftLang Team, University of Koblenz-Landau, Faculty of CS

5th Topic “Distributed systems”

• Code comprehension.

• Relevant technologies:

• JMS, Flask

13

RMI and Java WebServices are omitted

from exam.

© 2017 Ralf Lämmel, SoftLang Team, University of Koblenz-Landau, Faculty of CS

Sample task “Distributed systems”

14

What is the purpose of these lines of code (Python, Flask)? What happens when the lines are executed? What programming errors are conceivable?

api.add_resource(ArtikelList, '/artikel')

api.add_resource(Artikel, '/artikel/<artikel_id>')

© 2017 Ralf Lämmel, SoftLang Team, University of Koblenz-Landau, Faculty of CS

6th Topic “Documentation of technologies”

• Concept comprehension:

• Identify and explain some aspect in a given model.

• Relevant models:

• Models from lecture

15

© 2017 Ralf Lämmel, SoftLang Team, University of Koblenz-Landau, Faculty of CS

Sample task “Documentation of technologies”

16

A Technology Model

© 2017 Software Languages Team

Consider the following model for XML data binding (a la JAXB). What are the roles of the language entities in the model? (BTW, the textual MegaL notation may be used as well.)