You are on page 1of 3

Republic of the Philippines

Department of Science and Technology


PHILIPPINE SCIENCE HIGH SCHOOL
Cordillera Administrative Region Campus
Irisan, Baguio City
P.O. Box 1129

CS5: Data Structures and Algorithms


LONG EXAM 1
1st Quarter, SY2021-2022

OBJECTIVES:
This long exam aims to further evaluate your understanding of the programming concepts that we have discussed in
the context of Python. For this, a big component of the task would be to properly identify the applications of the various
concepts in an actual programming problem within a time constraint. Here are the topics covered by this exam:

• Variables and Data Types


• Operators for Numeric Data Types
• Operators for Boolean Data Types
• Control Structures
• Conditional Control: If – Else and While Loops
• Using Iterables with For Loops

GENERAL INSTRUCTIONS:
Your main task is to create a program that will allow a user to play one level of the classic game, Hangman. You
can get as creative as you like about the execution but the main components for evaluation would be the syntax,
semantics, logic, execution and documentation of your output.
• Total Score for this exam is 100 pts, and passing score is 60 pts.
• Your program should execute correctly with no errors, your code should be well written, and the comments
should clearly explain what the code is accomplishing. Comments are not needed for every line, but it is
expected for every significant block of code.
• Your code should exhibit effective sequencing, choice, and application of control structures to be demonstrated
by producing the correct results. If you are unsure as to how to start, you can create a flow chart of how hangman
works. This can then serve as your guide as you write your code. This part is not required but I will give
partial points if you submit your flowchart to me (even if your code is not working). You can use draw.io
for this.
• This exam is individual. You are free to search the internet for methods and for solutions to problems you might
encounter during the exam. Just make sure to keep track of time.
• Submit your code before the time limit ends. If you created a flow chart, save it as an image and put it in a
compressed folder along with your code.
• Format your filename for submission with grade_lastname_firstname.py

Telephone No.: (074) 423-0126 Website:www.carc.pshs.edu.ph


Republic of the Philippines
Department of Science and Technology
PHILIPPINE SCIENCE HIGH SCHOOL
Cordillera Administrative Region Campus
Irisan, Baguio City
P.O. Box 1129

HANGMAN:
Hangman is a type of guess-the-word game where a player is given a word to figure out and each turn is an opportunity
to guess one letter of the word. If the guess is correct, the instances and respective placements of the letter is revealed,
otherwise, the player gets closer to being ‘hanged’. For your version of the game, here are the specifications that you
should have:
• The word to be guessed is hard coded and your code should be able to handle a word of any realistic length for
as long as there are no spaces.
• Your game should have a quick title, an indicator that it has started, and appropriate prompts that would let the
user know what to do next.
• There should be error handling for multiple character inputs and repetition of characters. For this, there is no
need to display the available letters, but you are free to do so. In addition, your game should not be case
sensitive.
• Progress on both the word and the hanging status should be available for every user turn. You can use this
ASCII based hangman graphics from github. Those are basically multi-line strings inside a list.
• The game ends when the user either guesses the word correctly or gets hanged. For this, your game should
have an indicator on whether the player has won or lost.
SAMPLE PROGRAM OUTPUT:

Telephone No.: (074) 423-0126 Website:www.carc.pshs.edu.ph


Republic of the Philippines
Department of Science and Technology
PHILIPPINE SCIENCE HIGH SCHOOL
Cordillera Administrative Region Campus
Irisan, Baguio City
P.O. Box 1129

RUBRIC FOR EVALUATION:


Syntax (20 pts)
Needs Improvement Satisfactory (5-11 pts) Very Good (12-19 pts) Excellent (20 pts)
(1-4 pts) Program executes correctly Program executes correctly Program executes correctly
Program is unable to execute after handling major errors after handling minor errors with no syntax or runtime
despite of possible (ex. Missing symbols, wrong errors.
corrections spelling)
Execution (20 pts)
Needs Improvement Satisfactory (5-11 pts) Very Good (12-19 pts) Excellent (20 pts)
(1-4 pts) Program has provisions to Program has provisions to Program has provisions to
Program has no provision for handle some possible user handle most possible user handle all possible user input
handling possible user input input errors. input errors and is somewhat errors and is efficiently
errors. efficiently written. written.
Logic (30 pts)
Needs Improvement
Satisfactory (11-19 pts) Very Good (20-29 pts)
(1-10 pts) Excellent (30 pts)
Correct idea on the general Correct idea on the choice of
Program has unclear Correct choice of control
flow of the program. Choice control structures and data
direction on how it is going to structures and data types,
on control structures and data types, sequence of code
achieve its desired results. sequence of code elements,
types are mostly correct with elements. Mistakes in usage
Control structures and data and usage produce correct
some logic errors in the cause some errors in the
types are used randomly with results.
program. program.
no clear purpose.
Semantics and Readability (15 pts)
Needs Improvement Very Good (9-14 pts) Excellent (15 pts)
Satisfactory (5-10 pts)
(1-4 pts) Appropriate choice of variable Appropriate choice of variable
Appropriate choice of variable
Code is poorly organized and names and data types along names and data types, along
names and data types make
very difficult to read. with some organization with good organization makes
the code understandable with
Purposes of variables are makes the code somewhat the code easy to understand
a bit of difficulty without
hard to determine due to understandable even without and follow even without
running.
unclear naming. running. running.
Documentation (15 pts)
Very Good (9-14 pts)
Needs Improvement Excellent (15 pts)
Satisfactory (5-10 pts) Documentation consists of
(1-4 pts) Documentation is well written
Documentation consists of simple comments and
and clearly explains what the
Code has no documentation. simple comments in code. headers that are useful in
code is accomplishing.
understanding the code.

Prepared by: Reviewed & Approved by:

Chesedel Jobien M. Limlingan Pablo M. Villoria Jr.


Computer Science 5 Unit Head

REFERENCES:
Horton, C. (2017). Chris Horton Github : Hangman ASCII Art and Wordbank. Retrieved from Github:
https://gist.github.com/chrishorton/8510732aa9a80a03c829b09f12e20d9c

Telephone No.: (074) 423-0126 Website:www.carc.pshs.edu.ph

You might also like