# 2. PROGRAM OUTCOME BSCS.OC11

### 2. Program Outcome BSCS.OC11

The ability to write programs of moderate sophistication in a functional programming language

### 2.1. Assessment

BSCS.OC4 was assessed at the Intermediate level in CS 152, with one section taught by Jeff Smith and one section taught by Johnny Martin.

### 2.2. Tasks for Assessment of BSCS.OC11 in CS 152 at the Intermediate level

Students who pass CS 152 should be able to perform two or more of the following tasks in a functional language such as Haskell or Scheme.

Task 1:

Implement a function that uses list recursion, for example, a function that uses list recursion to filter all even numbers out of a list of numbers.

> filterEvens [1 2 3 4 5 6 7]

[1 3 5 7]

Task 2:

Implement a function that uses tail recursion, for example, a function that uses tail recursion to filter all even numbers out of a list of numbers.

Task 3:

Implement a function with function parameters, for example, a function that filters all numbers out of a list of numbers that pass some test specified by a parameter.

> filter even? [1 2 3 4 5 6 7]

[1 3 5 7]

Task 4:

Implement a function that returns a function as a value, for example, a function that takes a function f as a parameter and returns a function approximating f's derivative.

> f x = x * x

ok

> df = deriv f

ok

> df 10

20

Task 5:

Students should be able to trace the execution of functions involving one of the following operations:

- Recursion
- Thunks (promises)
- Closures
- Statically bound variables
- Filter
- Map
- Fold

### 2.3. Results of Assessing BSCS.OC11 in CS 152 at the Intermediate level

The assessment of BSCS.OC11 was completed by Jeff Smith in CS 152 Section 1.

In summary, this is the performance of the students on each of the tasks tested.

Task |
% of students who gave satisfactory answer |
% of students who gave excellent answer |
---|---|---|

1 |
93% |
93% |

2 |
62% |
62% |

3 |
91% |
81% |

4 |
55% |
41% |

5.7 |
93% |
86% |

The assessment of BSCS.OC11 was completed by Johnny Martin in CS 152 Section 2.

In summary, this is the performance of the students on each of the tasks tested.

Task |
% of students who gave satisfactory answer |
---|---|

1 |
57.8% |

2 |
52.5% |

3 |
63.0% |

4 |
80.6% |

5.1 |
80.2% |

5.2 |
66.7% |

5.3 |
59.7% |

5.5 |
51.7% |

5.6 |
90.3% |

5.7 |
75.3% |

### 2.4. Analysis

For Section 1 taught by Jeff Smith, the only concern is regarding the task 4. In this task, students are required to return a function as a value. Students were tested on this task with a programming question. The question, shown below, posed to students was rather challenging, and it is expected that many students would have difficulty answering this question.

________________________________________________________________________

Define a function `ordered-tree->procedure`

that takes a list of symbols and an ordered tree and returns a function with the
given list of symbols as its parameter list. The function should evaluate the expression
represented by the ordered tree. So for example, the value of

((ordered-tree->procedure

'(y)

(make-ordered-tree

*

(list

(make-ordered-tree 10 null)

(make-ordered-tree 'y null))))

5)

should be 50. Recall that leaves of an ordered tree are represented by trees with an empty list of children.

*Hint: construct and evaluate a **lambda** expression for the function represented by the tree.*

________________________________________________________________________

Above: Question assigned for Task 4 in CS 152 Section 1

For Section 2 taught by Johnny Martin, the task that students had the most difficulty with was Task 2 and 5.5. These tasks were tested by Midterm Exam 1 Question 17, shown below.

________________________________________________________________________

*M1-Q17:* 11 answers 5pts, 6 answers 4pts, 3 answers 3pts, 2 answers 2pts., 1 answer 1 pt,
13 answers 0pts.

Supports: TASK 5.5

THIS IS A PROGRAMMING ANSWER QUESTION, NOT M.C.

Implement a tail-recursive JavaScript function, filterEvens that takes 1 argument, an array of integer numbers, and returns a new array containing only the even valued numbers of the argument array.

x = [1,2,3,4,5,6,7];

y = FilterEvenTailRec(x)

print(y)

[1, 3, 5, 7]

Important: filterevens() must be tail recursive.

________________________________________________________________________

Above: Question assigned for Task 2 and 5.5 in CS 152 Section 2

This question is straight-forward, and tail recursion is one of the key concepts students should learn, according to the course outcomes. It is a concern that students have not learned this concept well.

### 2.5. Recommendations

From the results of assessing CS 152, the most major concern observed was the difficulty students in CS 152 experienced in implementing tail recursion. Tail recursion is a difficult but essential topic in CS 152, and one of the fundamental concepts in functional programming and computer science. One recommendation is that instructors spend more time on this topic, give students more practice example questions, and also test the students repeatedly, not only on Midterm 1, but also on Programming Assignments, Midterm 2 and the Final Exam.