Session T4C FACILITATING PROBLEM-SOLVING ON ... - CiteSeerX

8 downloads 0 Views 425KB Size Report
Non-interactive: When a student solves a problem, the textbooks are not ... not require syntax to encapsulate the if-clause and else- clause, which may be either ...
Session T4C FACILITATING PROBLEM-SOLVING ON NESTED SELECTION STATEMENTS USING C / C++ Neeraj Singhal, Amruth N Kumar1

Abstract - Problem Solving is an important part of learning Computer Science. Yet, the choice of problems offered in textbooks, the traditional source of problems, is limited, static, non-interactive and lacks animation. In order to address these issues, we have proposed Java applets that automatically generate problems, provide necessary visualization and animation, solve problems and provide feedback to the user. They are also capable of logging usage. We refer to such applets as problets. In this paper we will discuss the issues involved in the design and implementation of a problet on nested selection statements in C/C++.

solving a problem, such as alternative representations of the problem space, visualization of solution, etc. In order to address these problems, we propose Java applets that automatically generate problems, provide necessary visualization and animation to solve problems, and generate feedback for the user. We refer to such applets as problets. In Section 2, we will discuss the capabilities of problets and components of a problet. In Section 3, we will discuss the domain, design and implementation of a problet for nested selection statements in C/C++. We conclude with future directions for this work.

1. INTRODUCTION Most topics in Computer Science are best learned by solving problems e.g. scheduling problems in operating systems, understanding client-server architecture or the syntax of a programming language. The more the number and types of problems, the better the learner’s understanding of the concept and it’s adaptability to real-life examples. To solve more and varied types of problems, a student must have access to a set of such problems. The source of the problems in most cases is generally the textbook but books have their limitations. Some such limitations are : 1.

2. 3.

4.

1

Limited: The numb er of problems in a textbook is limited by the space constraints, and the type of problems is generally similar in nature across various textbooks. This is compounded by the fact that most of the problems presented in the textbooks are the same across editions. Once solutions are made available for these problems (either by the instructor or by a solutions manual), they cannot be used any longer for testing or assignments. Static: Problems cannot be adapted to the knowledge / learning ability of the learner. Non-interactive : When a student solves a problem, the textbooks are not capable of providing feedback in detail on whether and why the student's answers are correct/wrong, feedback that helps a student learn from his/her mistakes. No animation: Textbooks do not include animations and visualizations that are helpful in

2. CAPABILITIES OF PROBLETS We planned the following minimal capabilities for a problet. Automatic Problem Generation: A problet must be capable of generating problems automatically and should preferably not generate the same problem twice during a session. Also the problet must be capable of solving problems that it generates, provide feedback to the user and calibrate the hardness of the problem based on user’s comfort level. • Visualization Techniques: A problet must provide visualization techniques that assist the user in solving the problems. These visualization techniques must provide transparency of technology, provide the same comfort level to the user as the user would have while solving problems using pen and paper and preferably provide tools that are not available off-line. • Free and Across Platforms : A problet must be platform independent, inexpensive/free and must be available over the internet.



A typical problet will consist of the following components: A problem template, which is the blueprint of the types of problems generated by the problet. The template consists of the following sub-components: • The background information necessary to solve the problem; • The stem of the problem, which states the problem; • The response options provided to the user;

Ramapo College of New Jersey, 505 Ramapo Valley Road, Mahwah, NJ 07430-1680, [email protected] , [email protected]

0-7803-6424-4/00/$10.00 © 2000 IEEE October 18 - 21, 2000 Kansas City, MO 30 th ASEE/IEEE Frontiers in Education Conference T4C-1

Session T4C •

Feedback provided to the user, which includes the feedback for correct as well as incorrect responses.

A problet generates problems based on a template, by randomizing the parameters of the template. Heuristics are used during problem generation not only to ensure that the problems generated by the problet are not trivial, but also to vary the hardness of the generated problems. We use the following definition of hardness when generating problems: "The more the plausible response options a user has for a problem, the harder the problem" [Kumar, 1997, Kumar, 1998]. E.g., multiple choice problems are harder than true/false problems, and problems with free-form answers are harder than multiple choice problems. Our interest is in generating multiple choice problems, where the more the number of likely answering options for a question, the harder the problem. •

Visualization tools, which support the problem-solving environment of the problet. A well-designed problet may provide several alternative visualizations of a problem (text, graph, etc.), formatting options for these visualizations that help the user focus on the highlights of the problem, and facilities for the user to interact with the visualizations. Human-factors issues must be taken into account when designing the visualizations. E.g., a problet may display no more than 9 items on the screen at any time, as recommended by Miller's rule of seven plus/minus two [Miller, 1956]. (This rule may also be used during problem generation to limit the cognitive load on the user.) Finally, the user interface must be easy to use and intuitively designed.

We will now discuss a problet that will assist the user in understanding nested selection statements by generating various nested fragments of code and letting the user predict their output. We will describe it’s design in terms of the components of the problets we listed in Section 2 , viz, background information, stem, response options, feedback and visualization. 3.2 The Design Background Information: The background information for our problet is the nested IF-ELSE statement which is displayed in a separate window. The structure of a C/C++ selection statement is of the form: if < condition > else Our condition is a relational expression which consists of three parts : a variable, a relational operator and a value against which the variable is compared. The if-clause can be another if-else statement (which results in nesting) or an output statement. The selection of variables, relational operator and the output statement are all picked randomly from a list of canned choices. The problet provides the user with the option to generate problems at three levels of hardness: basic, intermediate and advanced using suitable menu options. The default level is basic. The problet can generate the following four types of nested selection statements: random, classification, chained statements and dangling else statements. The problet chooses among thes e types randomly. •

Random Nested Statement : No relationship exists between the conditions of the various statements. In a random if-else statement a variable is not used more than once. Figure-1 is an example of a random if-else statement.



Dangling IF-ELSE Statement : In a dangling if-else statement, an if statement is nested as the of an if-else statement. In this case the C / C++ language rule states that the associates with the that is textually closest to it. In order not to give the answer away, in a dangling ifelse statement the menu options for coloring the code, providing indentation and using braces in the code are disabled. Figure-2 shows a dangling if-else statement.



Classification Statement : A classification statement is a nested if-else statement which implements categorization based on a few variables. In a classification statement conditions of various statements are related : the same variables may be used more than once. Figure–3 shows a classification if-else statement.

3. PROBLET ON NESTED SELECTION STATEMENTS IN C+ 3.1 The Domain In most programming languages, two-way selection statements may be nested to implement multi-way selection. In C/C++, this is complicated by the fact that C/C++ does not require syntax to encapsulate the if-clause and elseclause, which may be either simple statements or compound statements (enclosed in braces). Therefore, students find it hard to trace the logic of nested selection statements in C/C++. Nested selection statements in C++ also suffer the dangling else problem, wherein the association of else with if is determined not based on syntax but rather on implicit rules. The number of levels of nesting, the presence or absence of indentation, the presence or absence of braces around if-clause and else-clause - all these can complicate a student's analysis of a nested if-else statement.

0-7803-6424-4/00/$10.00 © 2000 IEEE October 18 - 21, 2000 Kansas City, MO 30 th ASEE/IEEE Frontiers in Education Conference T4C-2

Session T4C

Figure 2: Dangling IF-ELSE statement

Figure 1 : Random IF-ELSE statement



Chained IF-ELSE Statement : Chained if-else statements have nesting in either the if clause or the else clause but not both. Further they have nesting in the same clause at all levels.

The number of nested levels in each problem type is set based on the hardness of the problem. If the user chooses a beginner’s level there is no nesting. For an intermediate level, nesting is limited to 2 levels while for advanced users the nesting has been set to 4 levels. Problem Stem: The stem of the problem, along with the response options is displayed in a second window. The stem reads “What is printed by the code for the following values of the variables:" A set of variables along with their values is displayed, which the user has to use to determine his/her response. The variables and their values are again determined randomly (See Figure 4 ).

Figure 3 : If-Else statement using classification

0-7803-6424-4/00/$10.00 © 2000 IEEE October 18 - 21, 2000 Kansas City, MO 30 th ASEE/IEEE Frontiers in Education Conference T4C-3

Session T4C Response Options: The problet lists all the possible answers as radio buttons and allows the user only a single selection at a time. The first answer is “Nothing” which can be selected if the user feels that the code will not print anything. After selecting a response the user clicks on the button called “Check My Answer” to obtain feedback. Feedback: When the user clicks on “Check My Answer” button, the problet verifies the user's response and determines whether the user’s response is correct or not. If the response is incorrect, the problet lists the correct answer and the reason why the response is incorrect. The problet computes an answer for the question it generates by following one branch of the if-else tree, down to the leaf node. If this answer matches the response provided by the user, then the user’s response is marked as correct. If the user’s response is incorrect, the problet explains why it is incorrect by listing the values of the variables involved in determining the correct answer. After verification of the response, the user has two options: get another question on the same if-else statement by pressing “Get Another Problem” button or generate another if-else statement by selecting “New Problem” from under the menu. If the user chooses “Get Another Problem”, the problet generates another question (on the same if-else statement) by randomly generating different values for the same variables.

Figure 4 : Response options and feedback

Visualization: The problet provides the following visualization tools to clarify the presented code: • the user may print the code using a different color for each level of nesting. This helps the user analyze the code more easily by matching the if and the else statement based on the color of the statements. • the user may indent the code for easy readability. This feature is however disabled when dangling else problems are generated. • The user may print the code with or without braces around each if-clause and else-clause. This feature is disabled for the dangling else problems. The problet also presents the fork diagram [Kumar, 1996] for the generated code in a separate window (See Figure 6). A Fork Diagram is a graphical representation of one and two way selection statements. Fork diagrams may be used to analyze a given if-else statement and answer questions based on it. The problet is currently posted at: http://orion.ramapo.edu/~amruth/java/opl/nestedif In order to run it, the user must have Java 2 with Swing classes loaded on their computer. Figure-5 : Problet showing menu options

0-7803-6424-4/00/$10.00 © 2000 IEEE October 18 - 21, 2000 Kansas City, MO 30 th ASEE/IEEE Frontiers in Education Conference T4C-4

Session T4C

Figure 6: Fork Diagram for a nested selection statement in C++

COMPARISON AND EVALUATION Problem-based learning improves long-term retention [Farnsworth, 1994]. So, solving problems is conducive to learning. Problets facilitate problem-solving online. So our plan to evaluate whether problets are conducive to learning is three-fold: 1. Whether the problet generates useful problems; 2. Whether the interface of the problet is easy to use; 3. Whether students use problets. It is well known that students do not use courseware unless it's use is mandated. Therefore, we plan to require students in our courses to use problets as part of the course. For the purpose of evaluating whether the problet generates useful problems , we executed our problet 50 times back-to-back and have come up with the results listed in Table 1. We used problems of medium hardness to come up with this matrix, the type of problem generated being chosen randomly. Note that 22% of the problems were generated on dangling else-clauses, which are hard to solve. The average number of variables and output statements in the generated problems are reasonable.

We have found very few references of work similar to ours, i.e., courseware to automatically generate, administer and solve problems for users, in Computer Science education literature. [Arnow, 1999] discusses courseware to administer programming problems on the Web. However, the problems themselves are picked from a canned repository manually created by the instructor. Our approach is to have the problet generate the problems automatically – therefore, the student is presented with an infinite supply of problems. The problems generated by a problet are parametric variations of a problem template, and the value of each parameter is randomly set, within problem-specific constraints, and subject to “hardness” heuristics. Similar work has been done for Physics [Kashy, 1993] and electronics [Barker, 1997], but not Computer Science, to the best of our knowledge. We plan to test the usability of the interface of the problet formally in the future. We believe that the visualization tools provided with the problet will make the problet easier to use.

0-7803-6424-4/00/$10.00 © 2000 IEEE October 18 - 21, 2000 Kansas City, MO 30 th ASEE/IEEE Frontiers in Education Conference T4C-5

Session T4C TABLE 1 Table showing different kinds of problems generated by our applet

[8]

No. of Problems 34

No. of levels 2

11

2

3

2

2

2

Type of Problem Random IF-ELSE Dangling ELSE Classific ation Chained IF-ELSE

Av. No. of variables 7

No. of leaf nodes 4

3

1

5

4

4

2

FUTURE WORK We use Model View Controller (MVC) pattern to improve the reusability and modifiability of our implementation. Currently we are engaged in developing problets on several other topics in Computer Science. We hope to abstract a library of classes from the implementations of these problets. The problet we described in this paper is functional – it generates and solves problems. Future work includes incorporating mechanisms for logging. Instructors may use such logs to monitor the assignments they hand out on the problets. We plan to collect usage data and assess the effectiveness of using problets to improve student’s learning. We also plan to design and implement problets for other topics in Computer Science, and deploy them in courses.

REFERENCES [1]

[2]

[3]

[4]

[5]

[6]

[7]

[9]

[10]

[11]

[12]

[13]

[14]

[15] [16]

[17]

System, American Journal of Physics, Vol 61(12), 1993, 1124-1130. Koffman, E.B. and Perry J..M. A model for Generative CAI and Concept Selection, International Journal for Man Machine Studies, 8, 1976, 215-234. Koffman, E.B. and Blount, S. E. Artificial Intelligence and automatic programming in CAL, Artificial Intelligence, 6, (1975), 215-234. Kumar A.N., Generating Challenging problems in Interactive Tutoring Systems : A Case Study of Storage Placement Algorithms., In Proceedings of the Eighth International PEG Conference, Sozopol, Bulgaria, (May 1997), 128-134. Kumar A.N., Problem Generation : Evaluation of two domains in Operating Systems, In Proceedings of the International FLAIRS Conference (FLAIRS ’98), (Special Track on Intelligent Tutoring Systems), Sanibel Island, FL (May 1998), 178-181. Kumar, A.N., Fork Diagrams for Teaching Selection in C.S. I, Proceedings of the Twenty Seventh SIGCSE Technical Symposium on Computer Science Education, Philadelphia, PA (February 1996), 348-352 Kumar A.N and Singhal N., Using Java to Help Students Practice Problem-Solving. PA Java 2000, Manchester UK (April 12-14, 2000), 205-216 Miller, G.A., The Magical Number Seven Plus or Minus Two: Some limits on our Capacity for Processing Information, The Psychological Review, 63, (1956), 81-97. Sebesta, R.W., Concept of Programming Languages 4th Ed. Addison Wesley Longman Inc. 1999. Vernon D.T. Attitudes and opinions of faculty tutors about problem based learning, Academic Medicine, 70(3), 1995, 216-233. Wenger, E., Artificial Intelligence and Tutoring Systems, Computational and Cognitive Approaches to the Communication of Knowledge, Morgan Kaufman Publishers Inc. 1987.

Arnow D. and Barshay, O., WebToTeach: An Interactive Focused Programming Exercise System, In proceedings of FIE 1999, San Juan, Puerto Rico (November 1999), Session 12a9. Barker, D.S., CHARLIE: A Computer-Managed Homework, Assignment and Response, Learning and Instruction Environment, Proceedings of FIE 1997, Pittsburgh, PA (November 1997). Brusilovsky, V. Task sequencing in an intelligent learning environment for calculus, In proceedings of the Seventh International PEG Conference, Edinburgh, Scotland (July 1993), 57-62. Buschmann, F,, Meunier, R., Rohnert, H., Sommerlad, P., and Stal, M., Pattern Oriented Software Architecture – A system of Patterns, John Wiley & Sons, Ltd. (1996). Cole D, Wainwright R. and Schoenefeld D., Using Java to Develop Web Based Tutorials. SIGCSE1998, Atlanta, Georgia. Farnworth, C. C., Using computer simulations in problembased learning. In proceedings of Thirty Fifth ADCIS conference, Omni Press, Nashville, TN, (1994), 137-140. Kashy, E., Sherrill, B.M., Tsai, Y.., Thaler, D., Weinshank, D., Engelmann, M., and Morrissey, D.J., CAPA, An Integrated Computer Assisted Personalized Assignment

0-7803-6424-4/00/$10.00 © 2000 IEEE October 18 - 21, 2000 Kansas City, MO 30 th ASEE/IEEE Frontiers in Education Conference T4C-6