0% found this document useful (0 votes)
56 views

Midterm InLab Exercise L1

This document provides instructions for a mid-term in-lab exercise for a computational problem solving course. It outlines two tasks to be completed within 40 minutes: [1] A program to convert ASCII codes to characters, requiring 10 lines of code. [2] A calculator application that allows adding, multiplying, subtracting and dividing numbers and runs until the user chooses to end it. Guidelines are provided on formatting, naming conventions, and penalties for non-compliance. The document also shares links to demonstration videos of the program workings.

Uploaded by

Hassan Mujeeb
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

Midterm InLab Exercise L1

This document provides instructions for a mid-term in-lab exercise for a computational problem solving course. It outlines two tasks to be completed within 40 minutes: [1] A program to convert ASCII codes to characters, requiring 10 lines of code. [2] A calculator application that allows adding, multiplying, subtracting and dividing numbers and runs until the user chooses to end it. Guidelines are provided on formatting, naming conventions, and penalties for non-compliance. The document also shares links to demonstration videos of the program workings.

Uploaded by

Hassan Mujeeb
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CS100 Computational Problem Solving

Fall 2021-22
Mid-term In-Lab Exercise

Start Time: 11:05 AM


DURATION: 40 MINUTES
Maximum End Time: 11:50 AM
Wednesday 20th October, 2021

Note: This mid-term lab is shorter than your regular lab. You should only take 40
minutes to solve it.
Note: MOSS will be used for plagiarism checking and a detailed viva will be conducted. A
final warning for cheating has already been issued so your case will immediately be
forwarded to the Disciplinary Committee if you cheat or are unable to explain your
solution. You would be wise to not cheat.

(Lab Section 1) Total Marks = 50

Lab Guidelines

1. You must put all your work into a folder named MidLab_YourRollNo (e.g,
MidLab_22100063), compress it into a “zip” file and submit the zip file on LMS
(Assignment -> Mid-term In-Lab) before Monday, 20th October 11:50 AM. No late
submissions or email submissions will be accepted.
2. Communicating with each other is NOT permitted. Searching for answers or help on
the internet is not permitted. All help material provided in the Lab Manual is allowed.
If you have a question, ask the TAs on Slack in your lab section channel.
3. The object is not simply to get the job done, but to get it done in the way that is asked
for in the lab. The objective is not just to get the code working, but to have a deep
understanding of why it is working.
4. Any cheating case will be reported to the Disciplinary Committee without any delay.
5. Failure to adhere to the naming convention of the file will result in 2.5 marks deduction.
6. Failure to adhere to coding conventions of the file will also result in 2.5 marks
deduction.

Coding Conventions: (-2.5 per violation)


● Constants are “ALLCAPS” or “ALL_CAPS”.
● Variables are “allsmall” or “all_small”.
● All function names must be “firstWordSmallAllOtherWordsCamelCase”.
● All curly brackets defining a block must be vertically aligned.
● File naming: Mid-term_YourRollNo.zip
Estimated Time: 10
Task 1 15 marks
minutes

Remember Lab04 when we asked you to encode your name from English alphabets to ASCII
codes?

You also solved a lab in which you had to send a secret message to your sibling, and you had to
encode the message’s alphabets in ASCII.

In this lab, you will do the reverse. You will write a program that takes ASCII codes and outputs
the real alphabets of the message. This will help your sibling understand what you are saying.

The program works like this:


1. You ask the user to input the ASCII code for one character at a time using cin.
2. You take the ASCII code and convert it into its English character.
3. Then you print that character.
4. Now you repeat the above 3 steps by asking the user for the next character’s ASCII code.
Only if the user enters -1 as ASCII code, do you end the program.

Program Working

Download “Task1 Demo.mp4” video from LMS assignments. It’s a tiny 140Kb file. It demonstrates
the output of the program. You can also watch it on Google Drive online.

Note: This program requires only 10 lines of code in the main() function. It’s very simple if you
have practiced these concepts with practice problems.

Note: Assume that the user only enters valid ASCII codes. No need to handle cin.fail() or
double values or the case when the ASCII code is wrong.
Estimated Time: 30
Task 2 35 marks
minutes
Write a calculator app that runs as long as the user wants it to. The calculator app can add
numbers, multiply them, subtract them, or divide them, depending on what the user wants. The
user can also add or multiply as many numbers as (s)he wants. However, for subtraction and
division, the user can only input two numbers.

Program Working

Please download “Task2 Demo.mp4” file from LMS Assignments tab. It shows you how the output
of Task 2 should look like. It’s a tiny file less than 2Mb in size. You can also watch it online on
Google Drive by using this link.

Tips

• No need to use cin.fail(). Assume that the user only inputs integers.
• Your program should keep working as long as the user doesn’t manually end it by entering
“5” in the main menu. Use a while loop for this.
• Do not hesitate to use while loops and if-else statements inside each other (in a nested
fashion) as discussed in tutorials and lectures.

Grading Breakup

• 5 marks for output formatting exactly as shown in demo video


• 10 marks for addition
• 10 marks for multiplication
• 5 marks for subtraction
• 5 marks for division
• If the program does not run perpetually and ends without the user entering “5”, then you
will not be awarded more than 25% of the total marks for this task.

You might also like