Teaching Problem Solving using Scratch

Download Report

Transcript Teaching Problem Solving using Scratch

Practical Exam
2015
Dominic Gruijters
Format of the Practical Exam
• Question 1
• 40 marks
• SQL
• Question 2
• 80 marks
• Java and Delphi Programming
• No change in mark allocation between sections
Practical Exam – Dominic Gruijters
2
07 February 2015
Continuation of Problem Solving
• CAPS emphasises a problem-solving algorithmic
approach
• General vs Specific Algorithms
• Simple objects more problem-solving oriented
combination and interaction between objects
• Simple parts with complex glue
• NO OOP INHERITANCE
• Last question will be able to be solved with inheritance
but won’t be compulsory
Practical Exam – Dominic Gruijters
3
07 February 2015
CAPS – Taxonomy
• Level 1 (30%): Reproducing a learnt algorithm
without application
Practical Exam – Dominic Gruijters
4
07 February 2015
CAPS – Taxonomy
• Level 2 (40%): Learned generic algorithms applied
to simple situations
• String functions (length, extraction, searching within)
• Declaration and instantiation of objects
• OOP modelling under direction: method declarations
(simple accessor, mutator methods), few parameters
and returns
• Learned (generic) algorithms applied to simple
situations
• Complex tasks using multiple 'simple application'-type
skills (e.g. string manipulation and sort, or multiple
elements of string manipulation) Adapting learned
algorithms to new scenarios (specific algorithms)
Portfolios – Dominic Gruijters
5
07 February 2015
CAPS – Taxonomy
• Level 3 (30%): Unseen/unprepared problems
requiring students to adapt learned algorithms
significantly, or to create a unique solution to a
problem.
• Unseen/unprepared problems requiring students to
adapt learned algorithms significantly, or to create a
unique solution to a problem.
• OOP modelling from problem definition, unguided
• Problems focusing on efficiency and code elegance
(e.g. 'marks will be awarded for efficient solutions').
• SQL: statements involving more than two of joined
tables, SQL functions, multiple logical operators,
grouping (with or without GROUPs)
Portfolios – Dominic Gruijters
6
07 February 2015
Algorithms and Data Structures
• The focus on efficiency and data structures will
continue
• Efficiency may be expected in other areas of the
paper not just the last question
• Data structures for problem solving
• Strings can also be data structures
• Arrays of basic types
• Arrays of objects
Practical Exam – Dominic Gruijters
7
07 February 2015
Question 1
• 7 – 10 SQL Questions
• 40 marks
• 3 or 4 table database
• SELECT, INSERT, UPDATE, DELETE
Practical Exam – Dominic Gruijters
8
07 February 2015
SQL – 2015 Focus
• JOINS
• Join three tables
• Random number generation
• HAVING
• Nested Queries
• DATE functions
• INSERT using SELECT (see next slide)
Portfolios – Dominic Gruijters
9
07 February 2015
INSERT using SELECT
• Ever wanted to duplicate a row in a database table
with slight different values? Here’s how:
PrisonerID
tblPrisoners
PrisonerName
1
Harold
2
Gary
3
Peter
tblVisits
VisitID
1
PrisonerID
3
Portfolios – Dominic Gruijters
VisitorName
Susan
10
VisitLength
30
VisitDate
2015-01-31
07 February 2015
INSERT USING SELECT
INSERT INTO tblVisits (PrisonerID, VisitorName, VisitLength,
VisitDate)
SELECT PrisonerID, VisitorName, VisitLength, NOW() FROM
tblVisits WHERE VisitID = 1
VisitID
PrisonerID
1
3
Susan
30
2015-01-31
2
3
Susan
30
2015-02-07
Portfolios – Dominic Gruijters
VisitorName VisitLength VisitDate
11
07 February 2015
INSERT USING SELECT
INSERT INTO tblVisits (PrisonerID, VisitorName, VisitLength,
VisitDate)
SELECT PrisonerID, ‘Joan’, VisitLength, NOW() FROM
tblVisits WHERE PrisonerID = 3
AND VisitorName = ‘Susan’
VisitID
PrisonerID
1
3
Susan
30
2015-01-31
2
3
Susan
30
2015-02-07
Portfolios – Dominic Gruijters
VisitorName VisitLength VisitDate
12
07 February 2015
Some Juicy Nuggets
• Nested Queries
• SELECT MAX(Salary) FROM tblTeachers
• This will give you the actual salary R2100.00
• But what if we want the name of the teacher?
• SELECT Name FROM tblTeachers
•
WHERE Salary = (SELECT MAX(Salary)
•
FROM tblTeachers)
• SELECT TOP 1 Name FROM tblTeachers
•
ORDER BY Salary DESC
Practical Exam – Dominic Gruijters
13
07 February 2015
Some Juicy Nuggets
• What if we wanted all the teachers who earn above
the average salary?
• Would this work?
• SELECT * FROM teachers
•
WHERE salary > AVG(salary)
• This is the solution
• SELECT * FROM teachers
•
•
WHERE salary > (SELECT AVG(salary)
FROM tblTeachers)
Practical Exam – Dominic Gruijters
14
07 February 2015
Some Juicy Nuggets
• SELECT * FROM tblParents
•
WHERE ParentID IN (SELECT ParentID
FROM tblChildren)
• SELECT * FROM tblStudents
• WHERE Grade IN (8,9,10)
Practical Exam – Dominic Gruijters
15
07 February 2015
Dust Off Your SQL
•
•
•
•
•
•
ROUND
INT
CONCAT or &
RANDOM
MOD
NOW()
• Let’s play
Practical Exam – Dominic Gruijters
16
07 February 2015
Dust Off Your SQL
• SELECT num/10 FROM tblNumbers
• SELECT ROUND(num/10, 2) FROM tblNumbers
• SELECT INT(num/10) FROM tblNumbers
• SELECT INT(num/10) & “ cm” FROM tblNumbers
• SELECT ROUND(INT(num/10) & units FROM
tblNumbers
Practical Exam – Dominic Gruijters
17
07 February 2015
Dust Off Your SQL
• SELECT YEAR(NOW()) – YEAR(DOB) FROM tblPpl
• (what about people who haven’t had a birthday yet)
• SELECT NOW() – DOB FROM tblPpl
• SELECT SUM(salary) / COUNT(salary) FROM tblPpl
• SELECT SUM(cost * unitprice) FROM tblSales
• GROUP BY ProductType
• SELECT COUNT(cost * unitprice) tblSales
• (NO)
Practical Exam – Dominic Gruijters
18
07 February 2015
Dust Off Your SQL
• SELECT LEFT(name, 3) & RIGHT(surname, 3) &
INT(RND*100) FROM tblPpl
• INT ((upperbound - lowerbound + 1) * RND +
lowerbound)
Practical Exam – Dominic Gruijters
19
07 February 2015
Joins
• SELECT Name
•
•
FROM tblParents INNER JOIN tblChildren
ON tblParents.ParentID = tblChildren.ParentID
• SAME AS
• SELECT Name
•
FROM tblParents, tblChildren
•
WHERE tblParents.ParentID = tblChildren.ParentID
Practical Exam – Dominic Gruijters
20
07 February 2015
Question 2 - Overview
• 80 marks
• Java and Delphi Programming
• One or Two different object classes
• Manager Class
•
•
•
•
Array(s) of objects
Counter
More attributes related to the manager class
Some functionality
• User Interface
• 1 problem solving questions (open-ended)
Practical Exam – Dominic Gruijters
21
07 February 2015
Question 2 - Specifics
• Class Diagrams
• No protected (but it is # just for reference)
• double means real, double, float
• Class diagrams are a bit of a frankenstein – mix
between UML, Java and Delphi
• Output and Interface will remain very simple
Practical Exam – Dominic Gruijters
22
07 February 2015
Question 2 - Specifics
• Marks allocated to problem solving question and
possibly another question
• Marked using an open-ended rubric (rubric
moderation is critical! Please keep contributing)
• Think out of the box
• Encourage students to attempt it in a creative way
Practical Exam – Dominic Gruijters
23
07 February 2015
Important Concepts to Cover
• Objects as Parameters
• Objects as Class Attributes
• Objects as Return Types
• Arrays as Parameters
• Arrays as Class Attributes
• Arrays as Return Types
• Objects Interacting with one another
• Processing a second file
Practical Exam – Dominic Gruijters
24
07 February 2015
Important Concepts to Cover
• Class methods that take parameters of the same class
public class Person
{
….
public boolean equals(Person p)
{
if (idnumber == p.getIDNumber)
{
return true;
}
else
{
return false;
}
}
}
Portfolios – Dominic Gruijters
25
07 February 2015
Important Concepts to Cover
Person p1 = new Person(‘John’, ‘Smith’, ‘8205045201085’)
Person p2 = new Person(‘John’, ‘Smith’, ‘7509085003083’)
if (p1.equals(p2))
{
System.out.println(“Same person!”);
}
else
{
System.out.println(“Different person!”);
}
Portfolios – Dominic Gruijters
26
07 February 2015
Practical Exam Submissions
•
•
•
•
•
•
Draft marking guide first
Mark a sample
Standardisation Meeting in clusters
Final marking guide released
MARK SCRIPTS
Fill in electronically (and indicate where you
assigned marks on print outs)
• Print out (with checksum)
• Submit all scripts with electronically filled out and
printed marking guides
• Don’t forget barcodes!
Practical Exam – Dominic Gruijters
27
07 February 2015
Questions?
Practical Exam – Dominic Gruijters
28
07 February 2015