Nothing Special   »   [go: up one dir, main page]

SP24-CP Full Manual Merged With Updated Rubrics

Download as pdf or txt
Download as pdf or txt
You are on page 1of 95

Department of Science and Technology FEST Indus University Karachi

INDUS UNIVERSITY KARACHI

FACULTY OF ENGINEERING, SCIENCE & TECHNOLOGY


(FEST)
Department of Science and Technology

BS (Mechanical)-II

LAB MANUAL
(MS-212A) Computer Programming (Lab) (0+1)
(Spring-2024)

Student NAME: __________________________________________________________________________________

Student ID: _______________________________________________________________________________________

Teacher Name:___________________________________________________________________________________

Signature of Teacher and Date_________________________________________________________________

1
Department of Science and Technology FEST Indus University Karachi

LABORATORY SAFETY

1
Department of Science and Technology FEST Indus University Karachi

INSTRUCTIONS & PRECAUTIONS FOR LABORATORY SAFETY


Laboratory Safety:

All students must read and understand the information in this document with regard to laboratory safety and
emergency procedures prior to the first laboratory session. Your personal laboratory safety depends mostly
on YOU. Effort has been made to address situations that may pose a hazard in the lab but the information and
instructions provided cannot be considered all-inclusive.

Students must adhere to written and verbal safety instructions throughout the academic term. Since
additional instructions may be given at the beginning of laboratory sessions, it is important that all students
arrive at each session on time.
With good judgment, the chance of an accident in this course is very small. Nevertheless, research
and teaching workplaces (labs, shops, etc.) are full of potential hazards that can cause serious injury and or
damage to the equipment. Working alone and unsupervised in laboratories is forbidden if you are working
with hazardous substances or equipment. With prior approval, at least two people should be present so that
one can shut down equipment and call for help in the event of an emergency.
Safety training and/or information should be provided by a faculty member, teaching assistant, lab
safety contact, or staff member at the beginning of a new assignment or when a new hazard is introduced
into the workplace.

Emergency Response:

1. It is your responsibility to read safety and fire alarm posters and follow the instructions during an
emergency
2. Know the location of the fire extinguisher, eye wash, and safety shower in your lab and know how to
use them.
3. Notify your instructor immediately after any injury, fire or explosion, or spill.
4. Know the building evacuation procedures.

Common Sense:

Good common sense is needed for safety in a laboratory. It is expected that each student will work in a
responsible manner and exercise good judgment and common sense. If at any time you are not sure how to
handle a particular situation, ask your Teaching Assistant or Instructor for advice. DO NOT TOUCH ANYTHING
WITH WHICH YOU ARE NOT COMPLETELY FAMILIAR!!! It is always better to ask questions than to risk harm
to yourself or damage to the equipment.

Personal and General laboratory safety:

1. Never eat, drink, or smoke while working in the laboratory.


2. Read labels carefully.
3. Do not use any equipment unless you are trained and approved as a user by your supervisor.
4. Wear safety glasses or face shields when working with hazardous materials and/or equipment.
5. Wear gloves when using any hazardous or toxic agent.
6. Clothing: When handling dangerous substances, wear gloves, laboratory coats, and safety shield or
glasses. Shorts and sandals should not be worn in the lab at any time. Shoes are required when
working in the machine shops.

2
Department of Science and Technology FEST Indus University Karachi
7. If you have long hair or loose clothes, make sure it is tied back or confined.
8. Keep the work area clear of all materials except those needed for your work. Coats should be hung
in the hall or placed in a locker. Extra books, purses, etc. should be kept away from equipment that
requires air flow or ventilation to prevent overheating.
9. Disposal - Students Are Responsible For The Proper Disposal Of Used Material If Any In Appropriate
Containers
10. Equipment Failure - If a piece of equipment fails while being used, report it immediately to your lab
assistant or tutor. Never try to fix the problem yourself because you could harm yourself and others.
11. If leaving a lab unattended, turn off all ignition sources and lock the doors.
12. Never pipette anything by mouth.
13. Clean up your work area before leaving.
14. Wash hands before leaving the lab and before eating.

Electrical Safety:

1. Obtain permission before operating any high voltage equipment.


2. Maintain an unobstructed access to all electrical panels.
3. Wiring or other electrical modifications must be referred to the Electronics Shop or the Building
Coordinator.
4. Avoid using extension cords whenever possible. If you must use one, obtain a heavy- duty one that
is electrically grounded, with its own fuse, and install it safely. Extension cords should not go under
doors, across aisles, be hung from the ceiling, or plugged into other extension cords.
5. Never, ever modify, attach or otherwise change any high voltage equipment.
6. Always make sure all capacitors are discharged (using a grounded cable with an insulating handle)
before touching high voltage leads or the "inside" of any equipment even after it has been turned
off. Capacitors can hold charge for many hours after the equipment has been turned off.
7. When you are adjusting any high voltage equipment or a laser which is powered with a high voltage
supply, USE ONLY ONE HAND. Your other hand is best placed in a pocket or behind your back. This
procedure eliminates the possibility of an accident where high voltage current flows up one arm,
through your chest, and down the other arm.

Mechanical Safety:

1. When using compressed air, use only approved nozzles and never directs the air towards any
person.
2. Guards on machinery must be in place during operation.
3. Exercise care when working with or near hydraulically- or pneumatically-driven equipment. Sudden
or unexpected motion can inflict serious injury.

Chemical Safety:

1. Treat every chemical as if it were hazardous.


2. Make sure all chemicals are clearly and currently labeled with the substance name, concentration,
date, and name of the individual responsible.
3. Never return chemicals to reagent bottles. (Try for the correct amount and share any excess.)
4. Comply with fire regulations concerning storage quantities, types of approved containers and
cabinets, proper labeling, etc. If uncertain about regulations, contact the building coordinator.

3
Department of Science and Technology FEST Indus University Karachi
5. Use volatile and flammable compounds only in a fume hood. Procedures that produce aerosols
should be performed in a hood to prevent inhalation of hazardous material.
6. Never allow a solvent to come in contact with your skin. Always use gloves.
7. Never "smell" a solvent!! Read the label on the solvent bottle to identify its contents.
8. Dispose of waste and broken glassware in proper containers.
9. Clean up spills immediately.
10. Do not store food in laboratories

Lasers Safety:

1. NEVER, EVER LOOK INTO ANY LASER BEAM, no matter how low power or "eye safe" you may think it
is.
2. Always wear safety goggles if instructed by your instructor or Teaching Assistant.
3. The most common injury using lasers is an eye injury resulting from scattered laser light reflected off
of mountings, sides of mirrors or from the "shiny" surface of an optical table. The best way to avoid
these injuries is to always wear your goggles and NEVER LOWER YOUR HEAD TO THE LEVEL OF THE
LASER BEAM! The laser beam should always be at or below chest level.
4. Always use "beam stops" to intercept laser beams. Never allow them to propagate into the
laboratory. Never walk through a laser beam. Some laser beams of only a few watts can burn a hole
through a shirt in only a few seconds.
5. If you suspect that you have suffered an eye injury, notified your instructor or teaching assistant
IMMEDIATELY! Your ability to recover from an eye injury decreases the longer you wait for
treatment.

Additional Safety Guidelines:

x Never do unauthorized experiments.


x Never work alone in laboratory.
x Keep your lab space clean and organized.
x Do not leave an on-going experiment unattended.
x Always inform your instructor if you break a thermometer. Do not clean mercury yourself!!
x Never taste anything. Never pipette by mouth; use a bulb.
x Never use open flames in laboratory unless instructed by TA.
x Check your glassware for cracks and chips each time you use it. Cracks could cause the glassware to
fail during use and cause serious injury to you or lab mates.
x Maintain unobstructed access to all exits, fire extinguishers, electrical panels, emergency showers,
and eye washes.
x Do not use corridors for storage or work areas.
x Do not store heavy items above table height. Any overhead storage of supplies on top of cabinets
should be limited to lightweight items only. Also, remember that a 36" diameter area around all fire
sprinkler heads must be kept clear at all times.
x Areas containing lasers, biohazards, radioisotopes, and carcinogens should be posted accordingly.
However, do not post areas unnecessarily and be sure that the labels are removed when the hazards
are no longer present.
x Be careful when lifting heavy objects. Only shop staff may operate forklifts or cranes.
x Clean your lab bench and equipment, and lock the door before you leave the laboratory.

4
Department of Science and Technology FEST Indus University Karachi

Declaration By Student:

It is here by declared that I have read all instructions and precautions carefully and I will follow
them to ensure safety.

Name of Student:

Signature of Student:

Name of Lab Teacher:

Signature of Lab Teacher:

5
Department of Science and Technology FEST Indus University Karachi

LIST OF EXPERIMENTS
(MS-212A) Computer Programming (Lab) (0+1)

OBE ATTAINMENT OBE Attainment


OBE Attainment (Program):
(Course): (Taxonomy):
(Course Learning Outcomes): Domain Level: Program Learning Outcome:
CLO-1,2,3 C1, P(2,3) PLOs -1,2

S. No Lab Experiments Marks Signature


Follow the steps to familiarize with Basic input output
1 Commands in C++

2 Trace Basic Data Types and Operators

3 Trace the steps familiarize with Conditional Statements

4 Trace the response of Switch statements in C++

5 Follow the steps to Introduce with the functionality of “for loop”

Follow the steps to Introduce with the functionality of


6 “While loop”
Trace the response of different examples
7 of nested loops in C++

OEL 1 Open Ended Lab: Control Flow and Looping in C++


Trace the steps to create the arrays and
8 perform different operations on arrays

9 Follow the steps to find the address of memory location


with the help of pointers in C++

10 Study the response of different PDF’s and learn how to create


UDF in C++
Trace the different arguments and parameters of User-Defined
11 Function
Study the structures in C++ and follow the steps to create
12
structures

13 Techniques of Object-Oriented Programming in C++

14 Advanced Object-Oriented Programming in C++

OEL 2 Open Ended Lab: Building a Library Management System

6



MS-212A
Computer Programming (Lab)

 
 
 Follow the steps to familiarize
 with Basic
 input output
 Commands in C++

&''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

())&''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

**(&'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Science & Technology
!(&'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Engr. Areeb Anis Khan
 +(&'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

24/02/2024
&''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


((,*&''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

*#-(&''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


Faculty of Engineering, Science and Technology, Karachi, Indus University
Faculty of Engineering, Science and Technology, Indus University

Lab # 1: Follow the steps to familiarize with Basic input output Commands in C++

Objective:
The objective of this lab is to introduce students to the basic input and output commands in C++.
By the end of this lab, students should be familiar with the fundamental concepts of accepting
user input and displaying output in C++ programs.

Lab Equipment and Software:


x Computer with a C++ compiler installed (e.g., Code::Blocks, Visual Studio Code with
C++ extension, etc.)

Lab Overview:
In this lab, you will learn the basics of handling input and output in C++ programs. The key
focus areas include:
1. Output in C++:
x Printing text to the console
x Using cout for output
2. Input in C++:
x Accepting user input
x Using cin for input
3. Formatting Output:
x Controlling the display format
x Using escape sequences

Lab Procedures:
1. Output in C++:
1.1 Printing Text to the Console:
In C++, the cout statement is used to display output on the console.

LAB MANUAL # 1 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University

1.2 Using cout for Output:


Use cout to display variables and combine text with variables.

2. Input in C++:
2.1 Accepting User Input:
In C++, the cin statement is used to take input from the user.

LAB MANUAL # 1 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
2.2 Using cin for Input:
Accept different types of input using cin.

3. Formatting Output:
3.1 Controlling Display Format:
Use manipulators to control the display format.

LAB MANUAL # 1 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
3.2 Using Escape Sequences:
Explore escape sequences for special characters.

Conclusion:
Congratulations! You have successfully completed the lab on basic input and output commands
in C++. Practice these concepts to build a strong foundation for more advanced programming
tasks.

LAB MANUAL # 1 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology (FEST), Indus University, Karachi

ASSESSMENT OF LAB TASK # 1


Course Teacher: (COURSE CODE) & TITLE: Total Marks of Lab: 02 Student ID:
Engr. Areeb Anis Khan MS-212A Computer Programming (Lab) Affective domain Marks: 0.5
Psychomotor domain Marks: 1.5
Problem Complexity (WP/EP): SP-1 Semester: 3rd Lab Number: 1 Student Name:
Knowledge Area / Sub Area (WK): SK-3 Offered In: Spring 24 Lab Venue:
Sydney Accord Attribute (WA): SA-1,9 For the Batch: Spring 23 Computer Lab (4th Floor)
OBE ATTAINMENT (Course): OBE ATTAINMENT(Taxonomy): OBE ATTAINMENT (PLO) Section:
Course Objectives: 1,2 Domain: Psychomotor, Affective Program Learning Outcome:
Course Learning Outcomes (CLO): CLO-1,2 Level: P2(Set), A2 (Provide Feedback) PLO-1, PLO-9

AFFECTIVE DOMAIN RUBRICS FOR LAB TASK PERFROMANCE


Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy Obtained
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Needs guidance to select
Incapable of selecting relevant Selects relevant equipment for the
1. Compliance on relevant equipment for the
equipment to conduct the experiment, develops setup diagrams
experiment and to develop
lab procedures experiment, equipment
equipment connection or wiring for equipment connections or wiring, A2 CLO-1 PLO-9
with safety connection or wiring diagrams,
diagrams, while observing and respectfully and carefully
instructions and disregards safety rules and
safety rules and procedures with observes safety rules
procedures.
minor deviation
PSYCHOMOTOR DOMAIN RUBRICS FOR LAB TASK PERFROMANCE
Obtained
Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Does not know how to use Uses related hardware/software Uses related hardware/software tools
2. Utilization of
relatedhardware/software tools tools to collect and analyze data tocollect and analyze data effectively.
Lab Tools
to collect and analyze data. with minor error.
Unable to calibrate appropriate Calibrates equipment, examines Performed proper calibration of
3. Lab Task equipment and equipment equipment moving parts, and equipment, carefully examines
Performed operation is substantially wrong. operatesthe equipment with minor equipment moving parts,and ensures
P2 CLO-2 PLO-1
error. smooth operation& process.
4. Experimental Lacks the ability to plan data Plans data collection to achieve Plans data collection to achieve
Data collection effectively for experimental objectives, and experimental objectives, and conducts
Collection and experimental objectives, leading collectscomplete data with minor anorderly and a complete data
Experimental to incomplete and error-laden error. Conducts simple collection. Accurately conducts simple
Data Analysis data. Incapable of performing computations and statistical computationsand statistical analysis
basic statistical analysis on the analysis using collected data with using collected data; correlates
collected data, and does not minor error; reasonably correlates experimental results to known
make efforts to relate experimental results to known theoretical values; accounts for
experimental outcomes. theoretical values; attempts to measurement errors and parameters
measure errors that affect thataffect experimental results.
experimental results.

Lab Instructor Name: Signature & Date:






MS-212A
Computer Programming (Lab)

 


Trace Basic Data Types
 and Operators


&''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

())&''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

**(&'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Science & Technology
+(&'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Engr. Areeb Anis Khan
 ,(&'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

02/03/2024
&''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


((-*&''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

*./(&''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Faculty of Engineering, Science and Technology, Karachi, Indus University



Faculty of Engineering, Science and Technology, Indus University

Lab # 2: Trace Basic Data Types and Operators.

Objective: The objective of this lab session is to gain a deep understanding of basic data types
and operators in C++ programming by tracing the execution of code snippets. This exercise will
help you visualize how different data types behave and how operators interact with them.
Prerequisites:
 Basic knowledge of C++ syntax.
 Understanding of data types and operators.
Lab Setup:
 Integrated Development Environment (IDE) with a C++ compiler installed.
Lab Exercises:
Exercise 1: Integer Data Types and Arithmetic Operators
1. Open your C++ IDE and create a new project.
2. Write a C++ program that includes variables of various integer data types (int, short,
long) and performs arithmetic operations on them.

3. Trace the values of variables at each step and observe the output.

LAB MANUAL # 2 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
Exercise 2: Floating-point Data Types and Arithmetic Operators
1. Create a new C++ program that involves variables of floating-point data types (float,
double) and performs arithmetic operations.

2. Trace the values of variables at each step and observe the output.
Exercise 3: Character Data Type and Operators
1. Write a C++ program that involves character data types and uses character operators.

2. Trace the values of variables at each step and observe the output.
Exercise 4: Relational and Logical Operators

LAB MANUAL # 2 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
1. Create a C++ program that uses relational and logical operators.

2. Trace the values of variables at each step and observe the output.
Conclusion: In this lab session, you have successfully traced the execution of C++ programs
involving basic data types and operators. This hands-on experience will deepen your understanding
of how data types and operators work in the C++ programming language.

LAB MANUAL # 2 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology (FEST), Indus University, Karachi

ASSESSMENT OF LAB TASK # 2


Course Teacher: (COURSE CODE) & TITLE: Total Marks of Lab: 02 Student ID:
Engr. Areeb Anis Khan MS-212A Computer Programming (Lab) Affective domain Marks: 0.5
Psychomotor domain Marks: 1.5
Problem Complexity (WP/EP): SP-1 Semester: 3rd Lab Number: 2 Student Name:
Knowledge Area / Sub Area (WK): SK-3 Offered In: Spring 24 Lab Venue:
Sydney Accord Attribute (WA): SA-1,9 For the Batch: Spring 23 Computer Lab (4th Floor)
OBE ATTAINMENT (Course): OBE ATTAINMENT(Taxonomy): OBE ATTAINMENT (PLO) Section:
Course Objectives: 1,2 Domain: Psychomotor, Affective Program Learning Outcome:
Course Learning Outcomes (CLO): CLO-1,2 Level: P2(Set), A2 (Provide Feedback) PLO-1, PLO-9

AFFECTIVE DOMAIN RUBRICS FOR LAB TASK PERFROMANCE


Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy Obtained
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Needs guidance to select
Incapable of selecting relevant Selects relevant equipment for the
1. Compliance on relevant equipment for the
equipment to conduct the experiment, develops setup diagrams
experiment and to develop
lab procedures experiment, equipment
equipment connection or wiring for equipment connections or wiring, A2 CLO-1 PLO-9
with safety connection or wiring diagrams,
diagrams, while observing and respectfully and carefully
instructions and disregards safety rules and
safety rules and procedures with observes safety rules
procedures.
minor deviation
PSYCHOMOTOR DOMAIN RUBRICS FOR LAB TASK PERFROMANCE
Obtained
Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Does not know how to use Uses related hardware/software Uses related hardware/software tools
2. Utilization of
relatedhardware/software tools tools to collect and analyze data tocollect and analyze data effectively.
Lab Tools
to collect and analyze data. with minor error.
Unable to calibrate appropriate Calibrates equipment, examines Performed proper calibration of
3. Lab Task equipment and equipment equipment moving parts, and equipment, carefully examines
Performed operation is substantially wrong. operatesthe equipment with minor equipment moving parts,and ensures
P2 CLO-2 PLO-1
error. smooth operation& process.
4. Experimental Lacks the ability to plan data Plans data collection to achieve Plans data collection to achieve
Data collection effectively for experimental objectives, and experimental objectives, and conducts
Collection and experimental objectives, leading collectscomplete data with minor anorderly and a complete data
Experimental to incomplete and error-laden error. Conducts simple collection. Accurately conducts simple
Data Analysis data. Incapable of performing computations and statistical computationsand statistical analysis
basic statistical analysis on the analysis using collected data with using collected data; correlates
collected data, and does not minor error; reasonably correlates experimental results to known
make efforts to relate experimental results to known theoretical values; accounts for
experimental outcomes. theoretical values; attempts to measurement errors and parameters
measure errors that affect thataffect experimental results.
experimental results.

Lab Instructor Name: Signature & Date:


MS-212A
Computer Programming (Lab)

LAB MANUAL # 3

Trace the steps familiarize with Conditional Statements

NAME:____________________________________________________________________________

ROLL NO: ________________________________________________________________________

2nd
SEMESTER: _____________________________________________________________________

Science & Technology


DEPARTMENT: _________________________________________________________________

Engr. Areeb Anis Khan


TEACHER NAME: _______________________________________________________________

DATE: ____________________________________________________________________________

REMARKS: ______________________________________________________________________

SIGNATURE: ____________________________________________________________________

Faculty of Engineering, Science and Technology, Karachi, Indus University


Faculty of Engineering, Science and Technology, Indus University
Lab # 3: Trace the steps familiarize with Conditional Statements

Objective: The objective of this lab session is to gain hands-on experience and a deep
understanding of conditional statements in C++ programming. This exercise will help you trace
the flow of execution through various scenarios involving if, else if, and switch statements.
Prerequisites:
 Basic knowledge of C++ syntax.
 Understanding of conditional statements.
Lab Setup:
 Integrated Development Environment (IDE) with a C++ compiler installed.
Lab Exercises:
Exercise 1: Basic if Statement
1. Open your C++ IDE and create a new project.
2. Write a C++ program that uses a basic if statement to check whether a given number is
positive or negative.

3. Trace the program's execution step by step and observe the output.

LAB MANUAL # 3 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
Exercise 2: if-else Statement
1. Create a new C++ program that uses an if-else statement to determine whether a number
is even or odd.

2. Trace the program's execution step by step and observe the output.

LAB MANUAL # 3 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
Exercise 3: Nested if Statements
1. Write a C++ program that uses nested if statements to determine the quadrant of a point
in a Cartesian coordinate system.

2. Trace the program's execution step by step and observe the output.

LAB MANUAL # 3 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
Exercise 4: Switch Statement
1. Create a C++ program that uses a switch statement to display the name of a month based
on its number.

2. Trace the program's execution step by step and observe the output.

Conclusion: In this lab session, you have successfully traced the execution of C++ programs
involving conditional statements. This hands-on experience will deepen your understanding of
how if, else if, and switch statements work in the C++ programming language, providing you with
valuable insights into controlling program flow based on different conditions.

LAB MANUAL # 3 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology (FEST), Indus University, Karachi

ASSESSMENT OF LAB TASK # 3


Course Teacher: (COURSE CODE) & TITLE: Total Marks of Lab: 02 Student ID:
Engr. Areeb Anis Khan MS-212A Computer Programming (Lab) Affective domain Marks: 0.5
Psychomotor domain Marks: 1.5
Problem Complexity (WP/EP): SP-1 Semester: 3rd Lab Number: 3 Student Name:
Knowledge Area / Sub Area (WK): SK-3 Offered In: Spring 24 Lab Venue:
Sydney Accord Attribute (WA): SA-1,9 For the Batch: Spring 23 Computer Lab (4th Floor)
OBE ATTAINMENT (Course): OBE ATTAINMENT(Taxonomy): OBE ATTAINMENT (PLO) Section:
Course Objectives: 1,2 Domain: Psychomotor, Affective Program Learning Outcome:
Course Learning Outcomes (CLO): CLO-1,2 Level: P2(Set), A2 (Provide Feedback) PLO-1, PLO-9

AFFECTIVE DOMAIN RUBRICS FOR LAB TASK PERFROMANCE


Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy Obtained
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Needs guidance to select
Incapable of selecting relevant Selects relevant equipment for the
1. Compliance on relevant equipment for the
equipment to conduct the experiment, develops setup diagrams
experiment and to develop
lab procedures experiment, equipment
equipment connection or wiring for equipment connections or wiring, A2 CLO-1 PLO-9
with safety connection or wiring diagrams,
diagrams, while observing and respectfully and carefully
instructions and disregards safety rules and
safety rules and procedures with observes safety rules
procedures.
minor deviation
PSYCHOMOTOR DOMAIN RUBRICS FOR LAB TASK PERFROMANCE
Obtained
Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Does not know how to use Uses related hardware/software Uses related hardware/software tools
2. Utilization of
relatedhardware/software tools tools to collect and analyze data tocollect and analyze data effectively.
Lab Tools
to collect and analyze data. with minor error.
Unable to calibrate appropriate Calibrates equipment, examines Performed proper calibration of
3. Lab Task equipment and equipment equipment moving parts, and equipment, carefully examines
Performed operation is substantially wrong. operatesthe equipment with minor equipment moving parts,and ensures
P2 CLO-2 PLO-1
error. smooth operation& process.
4. Experimental Lacks the ability to plan data Plans data collection to achieve Plans data collection to achieve
Data collection effectively for experimental objectives, and experimental objectives, and conducts
Collection and experimental objectives, leading collectscomplete data with minor anorderly and a complete data
Experimental to incomplete and error-laden error. Conducts simple collection. Accurately conducts simple
Data Analysis data. Incapable of performing computations and statistical computationsand statistical analysis
basic statistical analysis on the analysis using collected data with using collected data; correlates
collected data, and does not minor error; reasonably correlates experimental results to known
make efforts to relate experimental results to known theoretical values; accounts for
experimental outcomes. theoretical values; attempts to measurement errors and parameters
measure errors that affect thataffect experimental results.
experimental results.

Lab Instructor Name: Signature & Date:


MS-212A
Computer Programming (Lab)

LAB MANUAL # 4

Trace the response of Switch statements in C++

NAME:____________________________________________________________________________

ROLL NO: ________________________________________________________________________

2nd
SEMESTER: _____________________________________________________________________

Science & Technology


DEPARTMENT: _________________________________________________________________

Engr. Areeb Anis Khan


TEACHER NAME: _______________________________________________________________

DATE: ____________________________________________________________________________

REMARKS: ______________________________________________________________________

SIGNATURE: ____________________________________________________________________

Faculty of Engineering, Science and Technology, Karachi, Indus University


Faculty of Engineering, Science and Technology, Indus University
Lab # 4: Trace the response of Switch statements in C++
Objective: The objective of this lab session is to gain practical experience and a thorough
understanding of switch statements in C++ programming. This exercise aims to familiarize you
with the behavior of switch statements and how they can be effectively used for multi-branch
decision-making.
Prerequisites:
 Basic knowledge of C++ syntax.
 Understanding of switch statements.
Lab Setup:
 Integrated Development Environment (IDE) with a C++ compiler installed.
Lab Exercises:
Exercise 1: Basic Switch Statement
1. Open your C++ IDE and create a new project.
2. Write a C++ program that uses a basic switch statement to determine the day of the week
based on the user input.

3. Trace the program's execution step by step and observe the output.

LAB MANUAL # 4 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
Exercise 2: Handling Multiple Cases
1. Create a C++ program that uses a switch statement to determine the season based on the
month number.

2. Trace the program's execution step by step and observe the output.

LAB MANUAL # 4 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
Exercise 3: Handling Default Case
1. Write a C++ program that uses a switch statement to classify a character as a vowel or a
consonant.

2. Trace the program's execution step by step and observe the output.

LAB MANUAL # 4 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
Exercise 4: Fall-through Behavior
1. Create a C++ program that demonstrates fall-through behavior in a switch statement.

2. Trace the program's execution step by step and observe the output.

Conclusion: In this lab session, you have successfully traced the execution of C++ programs
involving switch statements. This hands-on experience will enhance your understanding of how
switch statements work and how they can be used for efficient multi-branch decision-making in
C++ programming.

LAB MANUAL # 4 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology (FEST), Indus University, Karachi

ASSESSMENT OF LAB TASK # 4


Course Teacher: (COURSE CODE) & TITLE: Total Marks of Lab: 02 Student ID:
Engr. Areeb Anis Khan MS-212A Computer Programming (Lab) Affective domain Marks: 0.5
Psychomotor domain Marks: 1.5
Problem Complexity (WP/EP): SP-1 Semester: 3rd Lab Number: 4 Student Name:
Knowledge Area / Sub Area (WK): SK-3 Offered In: Spring 24 Lab Venue:
Sydney Accord Attribute (WA): SA-1,9 For the Batch: Spring 23 Computer Lab (4th Floor)
OBE ATTAINMENT (Course): OBE ATTAINMENT(Taxonomy): OBE ATTAINMENT (PLO) Section:
Course Objectives: 1,2 Domain: Psychomotor, Affective Program Learning Outcome:
Course Learning Outcomes (CLO): CLO-1,2 Level: P2(Set), A2 (Provide Feedback) PLO-1, PLO-9

AFFECTIVE DOMAIN RUBRICS FOR LAB TASK PERFROMANCE


Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy Obtained
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Needs guidance to select
Incapable of selecting relevant Selects relevant equipment for the
1. Compliance on relevant equipment for the
equipment to conduct the experiment, develops setup diagrams
experiment and to develop
lab procedures experiment, equipment
equipment connection or wiring for equipment connections or wiring, A2 CLO-1 PLO-9
with safety connection or wiring diagrams,
diagrams, while observing and respectfully and carefully
instructions and disregards safety rules and
safety rules and procedures with observes safety rules
procedures.
minor deviation
PSYCHOMOTOR DOMAIN RUBRICS FOR LAB TASK PERFROMANCE
Obtained
Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Does not know how to use Uses related hardware/software Uses related hardware/software tools
2. Utilization of
relatedhardware/software tools tools to collect and analyze data tocollect and analyze data effectively.
Lab Tools
to collect and analyze data. with minor error.
Unable to calibrate appropriate Calibrates equipment, examines Performed proper calibration of
3. Lab Task equipment and equipment equipment moving parts, and equipment, carefully examines
Performed operation is substantially wrong. operatesthe equipment with minor equipment moving parts,and ensures
P2 CLO-2 PLO-1
error. smooth operation& process.
4. Experimental Lacks the ability to plan data Plans data collection to achieve Plans data collection to achieve
Data collection effectively for experimental objectives, and experimental objectives, and conducts
Collection and experimental objectives, leading collectscomplete data with minor anorderly and a complete data
Experimental to incomplete and error-laden error. Conducts simple collection. Accurately conducts simple
Data Analysis data. Incapable of performing computations and statistical computationsand statistical analysis
basic statistical analysis on the analysis using collected data with using collected data; correlates
collected data, and does not minor error; reasonably correlates experimental results to known
make efforts to relate experimental results to known theoretical values; accounts for
experimental outcomes. theoretical values; attempts to measurement errors and parameters
measure errors that affect thataffect experimental results.
experimental results.

Lab Instructor Name: Signature & Date:


MS-212A
Computer Programming (Lab)

LAB MANUAL # 5

Follow the steps to Introduce


with the functionality of “for loop”

NAME:____________________________________________________________________________

ROLL NO: ________________________________________________________________________

2nd
SEMESTER: _____________________________________________________________________

Science & Technology


DEPARTMENT:________________________________________________________________________

Engr. Areeb Anis Khan


TEACHER NAME: _______________________________________________________________

DATE: ____________________________________________________________________________

REMARKS: ______________________________________________________________________

SIGNATURE: ____________________________________________________________________

Faculty of Engineering, Science and Technology, Karachi, Indus University


Faculty of Engineering, Science and Technology, Indus University

Lab # 5: Follow the steps to Introduce with the functionality of “for loop”

Objective: The objective of this lab session is to introduce and explore the functionality of the
"for loop" in C++ programming. This exercise aims to provide hands-on experience with
different aspects of the "for loop," including initialization, condition, and iteration.
Prerequisites:
 Basic knowledge of C++ syntax.
 Understanding of loops and control structures.
Lab Setup:
 Integrated Development Environment (IDE) with a C++ compiler installed.
Lab Exercises:
Exercise 1: Basic "for loop" Structure
1. Open your C++ IDE and create a new project.
2. Write a simple C++ program that uses a "for loop" to display numbers from 1 to 5.

3. Trace the program's execution step by step and observe the output.

Exercise 2: Looping with Initialization and Condition


1. Create a C++ program that uses a "for loop" to calculate the sum of numbers from 1 to 10.

LAB MANUAL # 5 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University

2. Trace the program's execution step by step and observe the output.
Exercise 3: Looping with User Input
1. Write a C++ program that uses a "for loop" to print a multiplication table for a number
entered by the user.

2. Trace the program's execution step by step and observe the output.

LAB MANUAL # 5 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
Exercise 4: Nested "for loop"
1. Create a C++ program that uses nested "for loops" to display a pattern of stars.

2. Trace the program's execution step by step and observe the output.
Exercise 5: Loop Control Statements
1. Write a C++ program that uses "break" and "continue" statements in a "for loop."

2. Trace the program's execution step by step and observe the output.
Conclusion: In this lab session, you have successfully introduced and explored the functionality
of the "for loop" in C++ programming. This hands-on experience will enhance your
understanding of how "for loops" work and how they can be used for efficient iteration in C++
programs.

LAB MANUAL # 5 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology (FEST), Indus University, Karachi

ASSESSMENT OF LAB TASK # 5


Course Teacher: (COURSE CODE) & TITLE: Total Marks of Lab: 02 Student ID:
Engr. Areeb Anis Khan MS-212A Computer Programming (Lab) Affective domain Marks: 0.5
Psychomotor domain Marks: 1.5
Problem Complexity (WP/EP): SP-1 Semester: 3rd Lab Number: 5 Student Name:
Knowledge Area / Sub Area (WK): SK-3 Offered In: Spring 24 Lab Venue:
Sydney Accord Attribute (WA): SA-1,9 For the Batch: Spring 23 Computer Lab (4th Floor)
OBE ATTAINMENT (Course): OBE ATTAINMENT(Taxonomy): OBE ATTAINMENT (PLO) Section:
Course Objectives: 1,2 Domain: Psychomotor, Affective Program Learning Outcome:
Course Learning Outcomes (CLO): CLO-1,2 Level: P2(Set), A2 (Provide Feedback) PLO-1, PLO-9

AFFECTIVE DOMAIN RUBRICS FOR LAB TASK PERFROMANCE


Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy Obtained
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Needs guidance to select
Incapable of selecting relevant Selects relevant equipment for the
1. Compliance on relevant equipment for the
equipment to conduct the experiment, develops setup diagrams
experiment and to develop
lab procedures experiment, equipment
equipment connection or wiring for equipment connections or wiring, A2 CLO-1 PLO-9
with safety connection or wiring diagrams,
diagrams, while observing and respectfully and carefully
instructions and disregards safety rules and
safety rules and procedures with observes safety rules
procedures.
minor deviation
PSYCHOMOTOR DOMAIN RUBRICS FOR LAB TASK PERFROMANCE
Obtained
Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Does not know how to use Uses related hardware/software Uses related hardware/software tools
2. Utilization of
relatedhardware/software tools tools to collect and analyze data tocollect and analyze data effectively.
Lab Tools
to collect and analyze data. with minor error.
Unable to calibrate appropriate Calibrates equipment, examines Performed proper calibration of
3. Lab Task equipment and equipment equipment moving parts, and equipment, carefully examines
Performed operation is substantially wrong. operatesthe equipment with minor equipment moving parts,and ensures
P2 CLO-2 PLO-1
error. smooth operation& process.
4. Experimental Lacks the ability to plan data Plans data collection to achieve Plans data collection to achieve
Data collection effectively for experimental objectives, and experimental objectives, and conducts
Collection and experimental objectives, leading collectscomplete data with minor anorderly and a complete data
Experimental to incomplete and error-laden error. Conducts simple collection. Accurately conducts simple
Data Analysis data. Incapable of performing computations and statistical computationsand statistical analysis
basic statistical analysis on the analysis using collected data with using collected data; correlates
collected data, and does not minor error; reasonably correlates experimental results to known
make efforts to relate experimental results to known theoretical values; accounts for
experimental outcomes. theoretical values; attempts to measurement errors and parameters
measure errors that affect thataffect experimental results.
experimental results.

Lab Instructor Name: Signature & Date:


MS-212A
Computer Programming (Lab)
LAB MANUAL # 6

Follow the steps to Introduce with the


functionality of “While loop”

NAME:____________________________________________________________________________

ROLL NO: ________________________________________________________________________

2nd
SEMESTER: _____________________________________________________________________

Science & Technology


DEPARTMENT: _________________________________________________________________

Engr. Areeb Anis Khan


TEACHER NAME: _______________________________________________________________

DATE: ____________________________________________________________________________

REMARKS: ______________________________________________________________________

SIGNATURE: ____________________________________________________________________

Faculty of Engineering, Science and Technology, Karachi, Indus University


Faculty of Engineering, Science and Technology, Indus University

Lab #6: Follow the steps to Introduce with the functionality of “While loop”

Objective: The objective of this lab session is to introduce and explore the functionality of the
"while loop" in C++ programming. This exercise aims to provide hands-on experience with
different aspects of the "while loop," including initialization, condition, and iteration.
Prerequisites:
 Basic knowledge of C++ syntax.
 Understanding of loops and control structures.
Lab Setup:
 Integrated Development Environment (IDE) with a C++ compiler installed.

Lab Exercises:
Exercise 1: Basic "While Loop" Structure
1. Open your C++ IDE and create a new project.
2. Write a simple C++ program that uses a "while loop" to display numbers from 1 to 5.

3. Trace the program's execution step by step and observe the output.

LAB MANUAL # 6 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
Exercise 2: Looping with Condition
1. Create a C++ program that uses a "while loop" to calculate the sum of numbers from 1 to 10.

2. Trace the program's execution step by step and observe the output.
Exercise 3: Looping with User Input
1. Write a C++ program that uses a "while loop" to print a multiplication table for a number
entered by the user.

2. Trace the program's execution step by step and observe the output.

LAB MANUAL # 6 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
Exercise 4: Nested "While Loop"
1. Create a C++ program that uses nested "while loops" to display a pattern of stars.

2. Trace the program's execution step by step and observe the output.
Exercise 5: Loop Control Statements
1. Write a C++ program that uses "break" and "continue" statements in a "while loop."

2. Trace the program's execution step by step and observe the output.
Conclusion: In this lab session, you have successfully introduced and explored the functionality
of the "while loop" in C++ programming. This hands-on experience will enhance your
understanding of how "while loops" work and how they can be used for efficient iteration in C++
programs.

LAB MANUAL # 6 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology (FEST), Indus University, Karachi

ASSESSMENT OF LAB TASK # 6


Course Teacher: (COURSE CODE) & TITLE: Total Marks of Lab: 02 Student ID:
Engr. Areeb Anis Khan MS-212A Computer Programming (Lab) Affective domain Marks: 0.5
Psychomotor domain Marks: 1.5
Problem Complexity (WP/EP): SP-1 Semester: 3rd Lab Number: 6 Student Name:
Knowledge Area / Sub Area (WK): SK-3 Offered In: Spring 24 Lab Venue:
Sydney Accord Attribute (WA): SA-1,9 For the Batch: Spring 23 Computer Lab (4th Floor)
OBE ATTAINMENT (Course): OBE ATTAINMENT(Taxonomy): OBE ATTAINMENT (PLO) Section:
Course Objectives: 1,2 Domain: Psychomotor, Affective Program Learning Outcome:
Course Learning Outcomes (CLO): CLO-1,2 Level: P2(Set), A2 (Provide Feedback) PLO-1, PLO-9

AFFECTIVE DOMAIN RUBRICS FOR LAB TASK PERFROMANCE


Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy Obtained
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Needs guidance to select
Incapable of selecting relevant Selects relevant equipment for the
1. Compliance on relevant equipment for the
equipment to conduct the experiment, develops setup diagrams
experiment and to develop
lab procedures experiment, equipment
equipment connection or wiring for equipment connections or wiring, A2 CLO-1 PLO-9
with safety connection or wiring diagrams,
diagrams, while observing and respectfully and carefully
instructions and disregards safety rules and
safety rules and procedures with observes safety rules
procedures.
minor deviation
PSYCHOMOTOR DOMAIN RUBRICS FOR LAB TASK PERFROMANCE
Obtained
Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Does not know how to use Uses related hardware/software Uses related hardware/software tools
2. Utilization of
relatedhardware/software tools tools to collect and analyze data tocollect and analyze data effectively.
Lab Tools
to collect and analyze data. with minor error.
Unable to calibrate appropriate Calibrates equipment, examines Performed proper calibration of
3. Lab Task equipment and equipment equipment moving parts, and equipment, carefully examines
Performed operation is substantially wrong. operatesthe equipment with minor equipment moving parts,and ensures
P2 CLO-2 PLO-1
error. smooth operation& process.
4. Experimental Lacks the ability to plan data Plans data collection to achieve Plans data collection to achieve
Data collection effectively for experimental objectives, and experimental objectives, and conducts
Collection and experimental objectives, leading collectscomplete data with minor anorderly and a complete data
Experimental to incomplete and error-laden error. Conducts simple collection. Accurately conducts simple
Data Analysis data. Incapable of performing computations and statistical computationsand statistical analysis
basic statistical analysis on the analysis using collected data with using collected data; correlates
collected data, and does not minor error; reasonably correlates experimental results to known
make efforts to relate experimental results to known theoretical values; accounts for
experimental outcomes. theoretical values; attempts to measurement errors and parameters
measure errors that affect thataffect experimental results.
experimental results.

Lab Instructor Name: Signature & Date:


MS-212A
Computer Programming (Lab)
LAB MANUAL # 7

Trace the response of different examples


of nested loops in C++

NAME:____________________________________________________________________________

ROLL NO: ________________________________________________________________________

2nd
SEMESTER: _____________________________________________________________________

Science & Technology


DEPARTMENT: _________________________________________________________________

Engr. Areeb Anis Khan


TEACHER NAME: _______________________________________________________________

DATE: ____________________________________________________________________________

REMARKS: ______________________________________________________________________

SIGNATURE: ____________________________________________________________________

Indus University of Engineering Science and Technology, Karachi


Faculty of Engineering, Science and Technology, Indus University
Lab # 7: Trace the response of different examples of nested loops in C++
Objective: The objective of this lab session is to study and understand the behavior of nested
loops in C++ programming. This exercise will guide you through tracing the response of
different examples involving nested loops.
Prerequisites:
 Basic knowledge of C++ syntax.
 Understanding of loop structures (for, while, do-while).
Lab Setup:
 Integrated Development Environment (IDE) with a C++ compiler installed.
Lab Exercises:
Exercise 1: Tracing a Simple Nested Loop
1. Open your C++ IDE and create a new project.
2. Write a C++ program that uses a simple nested loop.

3. Trace the program's execution step by step and observe the output.
Exercise 2: Tracing a Nested Loop with Patterns
1. Create a C++ program that uses a nested loop to generate a pattern.

LAB MANUAL # 7 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University

2. Trace the program's execution step by step and observe the output.
Exercise 3: Tracing a Nested Loop with Break Statement
1. Write a C++ program that uses a nested loop with a break statement.

2. Trace the program's execution step by step and observe the output.
Exercise 4: Tracing a Nested Loop with Continue Statement
1. Create a C++ program that uses a nested loop with a continue statement.

LAB MANUAL # 7 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University

2. Trace the program's execution step by step and observe the output.
Exercise 5: Tracing a Nested Loop with Different Controls
1. Write a C++ program that uses a nested loop with different control conditions.

LAB MANUAL # 7 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
1. Trace the program's execution step by step and observe the output.
Exercise 6: Tracing a Nested Loop with User Input
1. Create a C++ program that uses a nested loop with user input.

2. Trace the program's execution step by step and observe the output.

Conclusion: In this lab session, you have successfully traced and understood the behavior of
different examples of nested loops in C++. This hands-on experience will deepen your
understanding of how nested loops work and how they can be used to create patterns, control
flow, and interact with user input in C++ programming.

LAB MANUAL # 7 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology (FEST), Indus University, Karachi

ASSESSMENT OF LAB TASK # 7


Course Teacher: (COURSE CODE) & TITLE: Total Marks of Lab: 02 Student ID:
Engr. Areeb Anis Khan MS-212A Computer Programming (Lab) Affective domain Marks: 0.5
Psychomotor domain Marks: 1.5
Problem Complexity (WP/EP): SP-1 Semester: 3rd Lab Number: 7 Student Name:
Knowledge Area / Sub Area (WK): SK-3 Offered In: Spring 24 Lab Venue:
Sydney Accord Attribute (WA): SA-1,9 For the Batch: Spring 23 Computer Lab (4th Floor)
OBE ATTAINMENT (Course): OBE ATTAINMENT(Taxonomy): OBE ATTAINMENT (PLO) Section:
Course Objectives: 1,2 Domain: Psychomotor, Affective Program Learning Outcome:
Course Learning Outcomes (CLO): CLO-1,2 Level: P2(Set), A2 (Provide Feedback) PLO-1, PLO-9

AFFECTIVE DOMAIN RUBRICS FOR LAB TASK PERFROMANCE


Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy Obtained
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Needs guidance to select
Incapable of selecting relevant Selects relevant equipment for the
1. Compliance on relevant equipment for the
equipment to conduct the experiment, develops setup diagrams
experiment and to develop
lab procedures experiment, equipment
equipment connection or wiring for equipment connections or wiring, A2 CLO-1 PLO-9
with safety connection or wiring diagrams,
diagrams, while observing and respectfully and carefully
instructions and disregards safety rules and
safety rules and procedures with observes safety rules
procedures.
minor deviation
PSYCHOMOTOR DOMAIN RUBRICS FOR LAB TASK PERFROMANCE
Obtained
Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Does not know how to use Uses related hardware/software Uses related hardware/software tools
2. Utilization of
relatedhardware/software tools tools to collect and analyze data tocollect and analyze data effectively.
Lab Tools
to collect and analyze data. with minor error.
Unable to calibrate appropriate Calibrates equipment, examines Performed proper calibration of
3. Lab Task equipment and equipment equipment moving parts, and equipment, carefully examines
Performed operation is substantially wrong. operatesthe equipment with minor equipment moving parts,and ensures
P2 CLO-2 PLO-1
error. smooth operation& process.
4. Experimental Lacks the ability to plan data Plans data collection to achieve Plans data collection to achieve
Data collection effectively for experimental objectives, and experimental objectives, and conducts
Collection and experimental objectives, leading collectscomplete data with minor anorderly and a complete data
Experimental to incomplete and error-laden error. Conducts simple collection. Accurately conducts simple
Data Analysis data. Incapable of performing computations and statistical computationsand statistical analysis
basic statistical analysis on the analysis using collected data with using collected data; correlates
collected data, and does not minor error; reasonably correlates experimental results to known
make efforts to relate experimental results to known theoretical values; accounts for
experimental outcomes. theoretical values; attempts to measurement errors and parameters
measure errors that affect thataffect experimental results.
experimental results.

Lab Instructor Name: Signature & Date:


MS-212A
Computer Programming (Lab)
OPEN ENDED LAB #1

Control Flow and Looping in C++

NAME:____________________________________________________________________________

ROLL NO: ________________________________________________________________________

2nd
SEMESTER: _____________________________________________________________________

Science & Technology


DEPARTMENT: _________________________________________________________________

Engr. Areeb Anis Khan


TEACHER NAME: _______________________________________________________________

DATE: ____________________________________________________________________________

REMARKS: ______________________________________________________________________

SIGNATURE: ____________________________________________________________________

Faculty of Engineering, Science and Technology, Karachi, Indus University


Faculty of Engineering, Science and Technology, Indus University
Open Ended lab # 1: Control Flow and Looping in C++

Objective: The objective of this advanced lab exercise is to integrate multiple control flow and looping
structures in a comprehensive C++ program. This exercise will cover the use of if-else statements, switch
statements, for loops, while loops, and nested loops.

Lab Exercise: Building a Grade Calculator

Problem Statement: Create a C++ program that calculates the final grades for a class of students based
on their individual scores. The program should use a combination of if-else statements, switch
statements, for loops, while loops, and nested loops to achieve the desired functionality.

Requirements:

1. Data Entry:

 The program should prompt the user to enter the number of students in the class.

 For each student, the program should request the following information:

 Student's name

 Number of subjects for which the student is graded

 Scores for each subject (assume a maximum of 5 subjects)

2. Grade Calculation:

 Calculate the average score for each student.

 Determine the letter grade for each student based on the following scale:

 A: 90-100

 B: 80-89

 C: 70-79

 D: 60-69

 F: 0-59

3. Display Results:

 Display the student's name, average score, and corresponding letter grade.

 Use if-else statements to determine the letter grade.

4. Additional Features:

 Implement a switch statement to handle the input for the number of subjects, providing
different grading scales for different subjects (e.g., some subjects might have different
passing thresholds).

 Use a for loop to iterate through each student's information.

OPEN ENDED LAB # 1 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
 Use a while loop to ensure that the user enters a valid number of subjects for each
student (between 1 and 5).

 Implement a nested loop to allow the user to re-enter the number of subjects if an
invalid value is provided.

Example Output:

OPEN ENDED LAB # 1 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


MS-212A
Computer Programming (Lab)

LAB MANUAL # 8

Trace the steps to create the arrays and


perform different operations on arrays

NAME:____________________________________________________________________________

ROLL NO: ________________________________________________________________________

2nd
SEMESTER: _____________________________________________________________________

Science & Technology


DEPARTMENT: _________________________________________________________________

Engr. Areeb Anis Khan


TEACHER NAME: _______________________________________________________________

DATE: ____________________________________________________________________________

REMARKS: ______________________________________________________________________

SIGNATURE: ____________________________________________________________________

Faculty of Engineering, Science and Technology, Karachi, Indus University


Faculty of Engineering, Science and Technology, Indus University
Lab # 8: Trace the steps to create the arrays and perform different operations on arrays

Objective: The objective of this lab session is to gain hands-on experience and a deep
understanding of arrays in C++ programming. This exercise will guide you through creating
arrays, initializing them, and performing various operations such as accessing elements, finding
the sum, and searching for values.
Prerequisites:
 Basic knowledge of C++ syntax.
 Understanding of arrays in programming.
Lab Setup:
 Integrated Development Environment (IDE) with a C++ compiler installed.
Lab Exercises:
Exercise 1: Creating and Accessing Elements in an Array
1. Open your C++ IDE and create a new project.
2. Write a C++ program that creates an array of integers, initializes it, and accesses
elements by index.

3. Trace the program's execution step by step and observe the output.

LAB MANUAL # 8 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
Exercise 2: Finding the Sum of Array Elements
1. Create a C++ program that calculates the sum of elements in an array.

2. Trace the program's execution step by step and observe the output.
Exercise 3: Searching for a Value in an Array
1. Write a C++ program that searches for a specific value in an array and displays its index
if found.

2. Trace the program's execution step by step and observe the output.
Exercise 4: Updating Array Elements

LAB MANUAL # 8 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
1. Create a C++ program that updates the values of elements in an array.

2. Trace the program's execution step by step and observe the output.

Exercise 5: Using Multi-dimensional Arrays

1. Write a C++ program that uses a multi-dimensional array (2D array) to store and display
a matrix.

2. Trace the program's execution step by step and observe the output.

Conclusion: In this lab session, you have successfully traced the execution of C++ programs
involving arrays and various operations. This hands-on experience will deepen your
understanding of how to create, initialize, and manipulate arrays in the C++ programming
language.

LAB MANUAL # 8 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology (FEST), Indus University, Karachi

ASSESSMENT OF LAB TASK # 8


Course Teacher: (COURSE CODE) & TITLE: Total Marks of Lab: 02 Student ID:
Engr. Areeb Anis Khan MS-212A Computer Programming (Lab) Affective domain Marks: 0.5
Psychomotor domain Marks: 1.5
Problem Complexity (WP/EP): SP-1 Semester: 3rd Lab Number: 8 Student Name:
Knowledge Area / Sub Area (WK): SK-3 Offered In: Spring 24 Lab Venue:
Sydney Accord Attribute (WA): SA-2,9 For the Batch: Spring 23 Computer Lab (4th Floor)
OBE ATTAINMENT (Course): OBE ATTAINMENT(Taxonomy): OBE ATTAINMENT (PLO) Section:
Course Objectives: 1,3 Domain: Psychomotor, Affective Program Learning Outcome:
Course Learning Outcomes (CLO): CLO-1,2,3 Level: P3 (Guided Response), A2 (Provide Feedback) PLO-2, PLO-9

AFFECTIVE DOMAIN RUBRICS FOR LAB TASK PERFROMANCE


Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy Obtained
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level
Parameter
Needs guidance to select
Incapable of selecting relevant Selects relevant equipment for the
1. Compliance on relevant equipment for the
equipment to conduct the experiment, develops setup diagrams
experiment and to develop
lab procedures experiment, equipment
equipment connection or wiring for equipment connections or wiring, A2 CLO-1 PLO-9
with safety connection or wiring diagrams,
diagrams, while observing and respectfully and carefully
instructions and disregards safety rules and
safety rules and procedures with observessafety rules
procedures.
minor deviation
PSYCHOMOTOR DOMAIN RUBRICS FOR LAB TASK PERFROMANCE
Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy Obtained
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Does not know how to use Uses related hardware/software Uses related hardware/software tools
2. Utilization of
relatedhardware/software tools tools to collect and analyze data tocollect and analyze data effectively.
Lab Tools
to collect and analyze data. with minor error.
Unable to calibrate appropriate Calibrates equipment, examines Performed proper calibration of
3. Lab Task equipment and equipment equipment moving parts, and equipment, carefully examines
Performed operation is substantially wrong. operatesthe equipment with minor equipment moving parts,and ensures
P3 CLO-3 PLO-2
error. smooth operation& process.
4. Experimental Lacks the ability to plan data Plans data collection to achieve Plans data collection to achieve
Data collection effectively for experimental objectives, and experimental objectives, and conducts
Collection and experimental objectives, leading collectscomplete data with minor anorderly and a complete data
Experimental to incomplete and error-laden error. Conducts simple collection. Accurately conducts simple
Data Analysis data. Incapable of performing computations and statistical computationsand statistical analysis
basic statistical analysis on the analysis using collected data with using collected data; correlates
collected data, and does not minor error; reasonably correlates experimental results to known
make efforts to relate experimental results to known theoretical values; accounts for
experimental outcomes. theoretical values; attempts to measurement errors and parameters
measure errors that affect thataffect experimental results.
experimental results.

Lab Instructor Name: Signature & Date:


MS-212A
Computer Programming (Lab)
LAB MANUAL # 9

Follow the steps to find the address of memory location


with the help of pointers in C++

NAME:____________________________________________________________________________

ROLL NO: ________________________________________________________________________

2nd
SEMESTER: _____________________________________________________________________

Science & Technology


DEPARTMENT: _________________________________________________________________

Engr. Areeb Anis Khan


TEACHER NAME: _______________________________________________________________

DATE: ____________________________________________________________________________

REMARKS: ______________________________________________________________________

SIGNATURE: ____________________________________________________________________

Faculty of Engineering, Science and Technology, Karachi, Indus University


Faculty of Engineering, Science and Technology, Indus University
Lab # 9: Finding Memory Address with Pointers in C++
Objective: The objective of this lab session is to gain practical experience and a deep
understanding of pointers in C++ programming. This exercise will guide you through the steps to
find the memory address of variables using pointers.
Prerequisites:
 Basic knowledge of C++ syntax.
 Understanding of variables and data types.
Lab Setup:
 Integrated Development Environment (IDE) with a C++ compiler installed.
Lab Exercises:
Exercise 1: Introduction to Pointers
1. Open your C++ IDE and create a new project.
2. Write a C++ program that declares a variable, initializes it, and uses a pointer to display
its value and memory address.

3. Trace the program's execution step by step and observe the output.

LAB MANUAL # 9 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
Exercise 2: Pointers with Different Data Types
1. Create a C++ program that uses pointers with different data types to display the memory
address and value of variables.

2. Trace the program's execution step by step and observe the output.
Exercise 3: Pointer Arithmetic
1. Write a C++ program that demonstrates pointer arithmetic to access elements of an array.

2. Trace the program's execution step by step and observe the output.
Exercise 4: Pointers and Functions

LAB MANUAL # 9 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
1. Create a C++ program that uses pointers and functions to swap the values of two
variables.

2. Trace the program's execution step by step and observe the output.
Conclusion: In this lab session, you have successfully traced the execution of C++ programs
involving pointers and different operations, including finding memory addresses, pointer
arithmetic, and using pointers in functions. This hands-on experience will deepen your
understanding of how pointers work in the C++ programming language.

LAB MANUAL # 9 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology (FEST), Indus University, Karachi

ASSESSMENT OF LAB TASK # 9


Course Teacher: (COURSE CODE) & TITLE: Total Marks of Lab: 02 Student ID:
Engr. Areeb Anis Khan MS-212A Computer Programming (Lab) Affective domain Marks: 0.5
Psychomotor domain Marks: 1.5
Problem Complexity (WP/EP): SP-1 Semester: 3rd Lab Number: 9 Student Name:
Knowledge Area / Sub Area (WK): SK-3 Offered In: Spring 24 Lab Venue:
Sydney Accord Attribute (WA): SA-2,9 For the Batch: Spring 23 Computer Lab (4th Floor)
OBE ATTAINMENT (Course): OBE ATTAINMENT(Taxonomy): OBE ATTAINMENT (PLO) Section:
Course Objectives: 1,3 Domain: Psychomotor, Affective Program Learning Outcome:
Course Learning Outcomes (CLO): CLO-1,2,3 Level: P3 (Guided Response), A2 (Provide Feedback) PLO-2, PLO-9

AFFECTIVE DOMAIN RUBRICS FOR LAB TASK PERFROMANCE


Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy Obtained
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Needs guidance to select
Incapable of selecting relevant Selects relevant equipment for the
1. Compliance on relevant equipment for the
equipment to conduct the experiment, develops setup diagrams
experiment and to develop
lab procedures experiment, equipment
equipment connection or wiring for equipment connections or wiring, A2 CLO-1 PLO-9
with safety connection or wiring diagrams,
diagrams, while observing and respectfully and carefully
instructions and disregards safety rules and
safety rules and procedures with observes safety rules
procedures.
minor deviation
PSYCHOMOTOR DOMAIN RUBRICS FOR LAB TASK PERFROMANCE
Obtained
Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Does not know how to use Uses related hardware/software Uses related hardware/software tools
2. Utilization of
relatedhardware/software tools tools to collect and analyze data tocollect and analyze data effectively.
Lab Tools
to collect and analyze data. with minor error.
Unable to calibrate appropriate Calibrates equipment, examines Performed proper calibration of
3. Lab Task equipment and equipment equipment moving parts, and equipment, carefully examines
Performed operation is substantially wrong. operatesthe equipment with minor equipment moving parts,and ensures
P3 CLO-3 PLO-2
error. smooth operation& process.
4. Experimental Lacks the ability to plan data Plans data collection to achieve Plans data collection to achieve
Data collection effectively for experimental objectives, and experimental objectives, and conducts
Collection and experimental objectives, leading collectscomplete data with minor anorderly and a complete data
Experimental to incomplete and error-laden error. Conducts simple collection. Accurately conducts simple
Data Analysis data. Incapable of performing computations and statistical computationsand statistical analysis
basic statistical analysis on the analysis using collected data with using collected data; correlates
collected data, and does not minor error; reasonably correlates experimental results to known
make efforts to relate experimental results to known theoretical values; accounts for
experimental outcomes. theoretical values; attempts to measurement errors and parameters
measure errors that affect thataffect experimental results.
experimental results.

Lab Instructor Name: Signature & Date:


MS-212A
Computer Programming (Lab)
LAB MANUAL # 10

Study the response of different PDF’s


and learn how to create UDF in C++

NAME:____________________________________________________________________________

ROLL NO: ________________________________________________________________________

2nd
SEMESTER: _____________________________________________________________________

Science & Technology


DEPARTMENT: _________________________________________________________________

Engr. Areeb Anis Khan


TEACHER NAME: _______________________________________________________________

DATE: ____________________________________________________________________________

REMARKS: ______________________________________________________________________

SIGNATURE: ____________________________________________________________________

Faculty of Engineering, Science and Technology, Karachi, Indus University


Faculty of Engineering, Science and Technology, Indus University
Lab # 10: Study of User-Defined Functions (UDFs) in C++

Objective: The objective of this lab session is to study and understand the concept of User-Defined
Functions (UDFs) in C++ programming. This exercise will guide you through creating, calling, and
analyzing the behavior of UDFs.

Prerequisites:

 Basic knowledge of C++ syntax.

 Understanding of functions and their role in programming.

Lab Setup:

 Integrated Development Environment (IDE) with a C++ compiler installed.

Lab Exercises:

Exercise 1: Creating and Calling Basic UDFs

1. Open your C++ IDE and create a new project.

2. Write a C++ program that defines and calls a basic User-Defined Function.

3. Trace the program's execution step by step and observe the output.

Exercise 2: UDFs with Parameters and Return Values

1. Create a C++ program that defines a UDF with parameters and a return value

LAB MANUAL # 10 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University

2. Trace the program's execution step by step and observe the output.

Exercise 3: UDFs with Multiple Parameters

1. Write a C++ program that defines a UDF with multiple parameters.

2. Trace the program's execution step by step and observe the output.

Exercise 4: Recursive UDFs

1. Create a C++ program that defines a recursive UDF to calculate the factorial of a number.

LAB MANUAL # 10 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University

2. Trace the program's execution step by step and observe the output.

Exercise 5: UDFs with Default Parameters

1. Write a C++ program that defines a UDF with default parameters.

2. Trace the program's execution step by step and observe the output.

LAB MANUAL # 10 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
Conclusion: In this lab session, you have successfully studied and implemented User-Defined Functions
(UDFs) in C++. This hands-on experience will deepen your understanding of how to create, call, and use
UDFs with different parameters and functionalities in C++ programming.

LAB MANUAL # 10 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology (FEST), Indus University, Karachi

ASSESSMENT OF LAB TASK # 10


Course Teacher: (COURSE CODE) & TITLE: Total Marks of Lab: 02 Student ID:
Engr. Areeb Anis Khan MS-212A Computer Programming (Lab) Affective domain Marks: 0.5
Psychomotor domain Marks: 1.5
Problem Complexity (WP/EP): SP-1 Semester: 3rd Lab Number: 10 Student Name:
Knowledge Area / Sub Area (WK): SK-3 Offered In: Spring 24 Lab Venue:
Sydney Accord Attribute (WA): SA-2,9 For the Batch: Spring 23 Computer Lab (4th Floor)
OBE ATTAINMENT (Course): OBE ATTAINMENT(Taxonomy): OBE ATTAINMENT (PLO) Section:
Course Objectives: 1,3 Domain: Psychomotor, Affective Program Learning Outcome:
Course Learning Outcomes (CLO): CLO-1,2,3 Level: P3 (Guided Response), A2 (Provide Feedback) PLO-2, PLO-9

AFFECTIVE DOMAIN RUBRICS FOR LAB TASK PERFROMANCE


Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy Obtained
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Needs guidance to select
Incapable of selecting relevant Selects relevant equipment for the
1. Compliance on relevant equipment for the
equipment to conduct the experiment, develops setup diagrams
experiment and to develop
lab procedures experiment, equipment
equipment connection or wiring for equipment connections or wiring, A2 CLO-1 PLO-9
with safety connection or wiring diagrams,
diagrams, while observing and respectfully and carefully
instructions and disregards safety rules and
safety rules and procedures with observes safety rules
procedures.
minor deviation
PSYCHOMOTOR DOMAIN RUBRICS FOR LAB TASK PERFROMANCE
Obtained
Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Does not know how to use Uses related hardware/software Uses related hardware/software tools
2. Utilization of
relatedhardware/software tools tools to collect and analyze data tocollect and analyze data effectively.
Lab Tools
to collect and analyze data. with minor error.
Unable to calibrate appropriate Calibrates equipment, examines Performed proper calibration of
3. Lab Task equipment and equipment equipment moving parts, and equipment, carefully examines
Performed operation is substantially wrong. operatesthe equipment with minor equipment moving parts,and ensures
P3 CLO-3 PLO-2
error. smooth operation& process.
4. Experimental Lacks the ability to plan data Plans data collection to achieve Plans data collection to achieve
Data collection effectively for experimental objectives, and experimental objectives, and conducts
Collection and experimental objectives, leading collectscomplete data with minor anorderly and a complete data
Experimental to incomplete and error-laden error. Conducts simple collection. Accurately conducts simple
Data Analysis data. Incapable of performing computations and statistical computationsand statistical analysis
basic statistical analysis on the analysis using collected data with using collected data; correlates
collected data, and does not minor error; reasonably correlates experimental results to known
make efforts to relate experimental results to known theoretical values; accounts for
experimental outcomes. theoretical values; attempts to measurement errors and parameters
measure errors that affect thataffect experimental results.
experimental results.

Lab Instructor Name: Signature & Date:


MS-212A
Computer Programming (Lab)

LAB MANUAL # 11

Trace the different arguments and parameters


of User-Defined Function

NAME:____________________________________________________________________________

ROLL NO: ________________________________________________________________________

2nd
SEMESTER: _____________________________________________________________________

Science & Technology


DEPARTMENT: _________________________________________________________________

Engr. Areeb Anis Khan


TEACHER NAME: _______________________________________________________________

DATE: ____________________________________________________________________________

REMARKS: ______________________________________________________________________

SIGNATURE: ____________________________________________________________________

Faculty of Engineering, Science and Technology, Karachi, Indus University


Faculty of Engineering, Science and Technology, Indus University

Lab # 11: Tracing Arguments and Parameters of User-Defined Functions in C++

Objective: The objective of this lab session is to gain practical experience in tracing and
understanding the different arguments and parameters used in User-Defined Functions (UDFs) in
C++ programming.

Prerequisites:
 Basic knowledge of C++ syntax.
 Understanding of functions and their parameters.

Lab Setup:
 Integrated Development Environment (IDE) with a C++ compiler installed.

Lab Exercises:
Exercise 1: Tracing Basic UDF with Parameters
1. Open your C++ IDE and create a new project.
2. Write a C++ program that defines a basic User-Defined Function with parameters.

3. Trace the program's execution step by step and observe the output.

LAB MANUAL # 11 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University

Exercise 2: Tracing UDF with Return Value


1. Create a C++ program that defines a UDF with parameters and a return value.

2. Trace the program's execution step by step and observe the output.
Exercise 3: Tracing UDF with Multiple Parameters
1. Write a C++ program that defines a UDF with multiple parameters.

2. Trace the program's execution step by step and observe the output.

LAB MANUAL # 11 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University

Exercise 4: Tracing Recursive UDF


1. Create a C++ program that defines a recursive UDF with parameters.

2. Trace the program's execution step by step and observe the output.

Exercise 5: Tracing UDF with Default Parameters


1. Write a C++ program that defines a UDF with default parameters.

2. Trace the program's execution step by step and observe the output.
Conclusion: In this lab session, you have successfully traced and understood the different
arguments and parameters used in User-Defined Functions (UDFs) in C++. This hands-on

LAB MANUAL # 11 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
experience will deepen your understanding of how to work with various types of parameters in
functions and how they affect the behavior of the program.

LAB MANUAL # 11 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology (FEST), Indus University, Karachi

ASSESSMENT OF LAB TASK # 11


Course Teacher: (COURSE CODE) & TITLE: Total Marks of Lab: 02 Student ID:
Engr. Areeb Anis Khan MS-212A Computer Programming (Lab) Affective domain Marks: 0.5
Psychomotor domain Marks: 1.5
Problem Complexity (WP/EP): SP-1 Semester: 3rd Lab Number: 11 Student Name:
Knowledge Area / Sub Area (WK): SK-3 Offered In: Spring 24 Lab Venue:
Sydney Accord Attribute (WA): SA-2,9 For the Batch: Spring 23 Computer Lab (4th Floor)
OBE ATTAINMENT (Course): OBE ATTAINMENT(Taxonomy): OBE ATTAINMENT (PLO) Section:
Course Objectives: 1,3 Domain: Psychomotor, Affective Program Learning Outcome:
Course Learning Outcomes (CLO): CLO-1,2,3 Level: P3 (Guided Response), A2 (Provide Feedback) PLO-2, PLO-9

AFFECTIVE DOMAIN RUBRICS FOR LAB TASK PERFROMANCE


Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy Obtained
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Needs guidance to select
Incapable of selecting relevant Selects relevant equipment for the
1. Compliance on relevant equipment for the
equipment to conduct the experiment, develops setup diagrams
experiment and to develop
lab procedures experiment, equipment
equipment connection or wiring for equipment connections or wiring, A2 CLO-1 PLO-9
with safety connection or wiring diagrams,
diagrams, while observing and respectfully and carefully
instructions and disregards safety rules and
safety rules and procedures with observes safety rules
procedures.
minor deviation
PSYCHOMOTOR DOMAIN RUBRICS FOR LAB TASK PERFROMANCE
Obtained
Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Does not know how to use Uses related hardware/software Uses related hardware/software tools
2. Utilization of
relatedhardware/software tools tools to collect and analyze data tocollect and analyze data effectively.
Lab Tools
to collect and analyze data. with minor error.
Unable to calibrate appropriate Calibrates equipment, examines Performed proper calibration of
3. Lab Task equipment and equipment equipment moving parts, and equipment, carefully examines
Performed operation is substantially wrong. operatesthe equipment with minor equipment moving parts,and ensures
P3 CLO-3 PLO-2
error. smooth operation& process.
4. Experimental Lacks the ability to plan data Plans data collection to achieve Plans data collection to achieve
Data collection effectively for experimental objectives, and experimental objectives, and conducts
Collection and experimental objectives, leading collectscomplete data with minor anorderly and a complete data
Experimental to incomplete and error-laden error. Conducts simple collection. Accurately conducts simple
Data Analysis data. Incapable of performing computations and statistical computationsand statistical analysis
basic statistical analysis on the analysis using collected data with using collected data; correlates
collected data, and does not minor error; reasonably correlates experimental results to known
make efforts to relate experimental results to known theoretical values; accounts for
experimental outcomes. theoretical values; attempts to measurement errors and parameters
measure errors that affect thataffect experimental results.
experimental results.

Lab Instructor Name: Signature & Date:


MS-212A
Computer Programming (Lab)
LAB MANUAL # 12

Study the structures in C++ and follow


the steps to create structures

NAME:____________________________________________________________________________

ROLL NO: ________________________________________________________________________

2nd
SEMESTER: _____________________________________________________________________

Science & Technology


DEPARTMENT: _________________________________________________________________

Engr. Areeb Anis Khan


TEACHER NAME: _______________________________________________________________

DATE: ____________________________________________________________________________

REMARKS: ______________________________________________________________________

SIGNATURE: ____________________________________________________________________

Indus University of Engineering Science and Technology, Karachi


Faculty of Engineering, Science and Technology, Indus University
Lab #12: Studying and Creating Structures in C++
Objective: The objective of this lab session is to study and understand the concept of structures
in C++ programming and to learn how to create and utilize structures to organize and store
related data.
Prerequisites:
 Basic knowledge of C++ syntax.
 Understanding of variables and data types.
Lab Setup:
 Integrated Development Environment (IDE) with a C++ compiler installed.
Lab Exercises:
Exercise 1: Introduction to Structures
1. Open your C++ IDE and create a new project.
2. Write a C++ program that defines a simple structure.

3. Trace the program's execution step by step and observe the output.

LAB MANUAL # 12 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University

Exercise 2: Structures with Functions


1. Create a C++ program that uses a structure with functions.

2. Trace the program's execution step by step and observe the output.
Exercise 3: Array of Structures
1. Write a C++ program that uses an array of structures.

LAB MANUAL # 12 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University

2. Trace the program's execution step by step and observe the output.

LAB MANUAL # 12 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
Exercise 4: Nested Structures
1. Create a C++ program that uses nested structures.

2. Trace the program's execution step by step and observe the output.

LAB MANUAL # 12 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
Exercise 5: Structures with Pointers
1. Write a C++ program that uses structures with pointers.

2. Trace the program's execution step by step and observe the output.

Conclusion: In this lab session, you have successfully studied and implemented structures in
C++. This hands-on experience will deepen your understanding of how to create, initialize, and
use structures to organize and store related data in C++ programming.

LAB MANUAL # 12 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology (FEST), Indus University, Karachi

ASSESSMENT OF LAB TASK # 12


Course Teacher: (COURSE CODE) & TITLE: Total Marks of Lab: 02 Student ID:
Engr. Areeb Anis Khan MS-212A Computer Programming (Lab) Affective domain Marks: 0.5
Psychomotor domain Marks: 1.5
Problem Complexity (WP/EP): SP-1 Semester: 3rd Lab Number: 12 Student Name:
Knowledge Area / Sub Area (WK): SK-3 Offered In: Spring 24 Lab Venue:
Sydney Accord Attribute (WA): SA-2,9 For the Batch: Spring 23 Computer Lab (4th Floor)
OBE ATTAINMENT (Course): OBE ATTAINMENT(Taxonomy): OBE ATTAINMENT (PLO) Section:
Course Objectives: 1,3 Domain: Psychomotor, Affective Program Learning Outcome:
Course Learning Outcomes (CLO): CLO-1,2,3 Level: P3 (Guided Response), A2 (Provide Feedback) PLO-2, PLO-9

AFFECTIVE DOMAIN RUBRICS FOR LAB TASK PERFROMANCE


Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy Obtained
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Needs guidance to select
Incapable of selecting relevant Selects relevant equipment for the
1. Compliance on relevant equipment for the
equipment to conduct the experiment, develops setup diagrams
experiment and to develop
lab procedures experiment, equipment
equipment connection or wiring for equipment connections or wiring, A2 CLO-1 PLO-9
with safety connection or wiring diagrams,
diagrams, while observing and respectfully and carefully
instructions and disregards safety rules and
safety rules and procedures with observes safety rules
procedures.
minor deviation
PSYCHOMOTOR DOMAIN RUBRICS FOR LAB TASK PERFROMANCE
Obtained
Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Does not know how to use Uses related hardware/software Uses related hardware/software tools
2. Utilization of
relatedhardware/software tools tools to collect and analyze data tocollect and analyze data effectively.
Lab Tools
to collect and analyze data. with minor error.
Unable to calibrate appropriate Calibrates equipment, examines Performed proper calibration of
3. Lab Task equipment and equipment equipment moving parts, and equipment, carefully examines
Performed operation is substantially wrong. operatesthe equipment with minor equipment moving parts,and ensures
P3 CLO-3 PLO-2
error. smooth operation& process.
4. Experimental Lacks the ability to plan data Plans data collection to achieve Plans data collection to achieve
Data collection effectively for experimental objectives, and experimental objectives, and conducts
Collection and experimental objectives, leading collectscomplete data with minor anorderly and a complete data
Experimental to incomplete and error-laden error. Conducts simple collection. Accurately conducts simple
Data Analysis data. Incapable of performing computations and statistical computationsand statistical analysis
basic statistical analysis on the analysis using collected data with using collected data; correlates
collected data, and does not minor error; reasonably correlates experimental results to known
make efforts to relate experimental results to known theoretical values; accounts for
experimental outcomes. theoretical values; attempts to measurement errors and parameters
measure errors that affect thataffect experimental results.
experimental results.

Lab Instructor Name: Signature & Date:


MS-212A
Computer Programming (Lab)
LAB MANUAL # 13

Techniques of Object-Oriented Programming in C++

NAME:____________________________________________________________________________

ROLL NO: ________________________________________________________________________

2nd
SEMESTER: _____________________________________________________________________

Science & Technology


DEPARTMENT: _________________________________________________________________

Engr. Areeb Anis Khan


TEACHER NAME: _______________________________________________________________

DATE: ____________________________________________________________________________

REMARKS: ______________________________________________________________________

SIGNATURE: ____________________________________________________________________

Faculty of Engineering, Science and Technology, Karachi, Indus University


Faculty of Engineering, Science and Technology, Indus University
Lab # 13: Techniques of Object-Oriented Programming in C++
Objective: The objective of this lab session is to explore and understand the fundamental
techniques of Object-Oriented Programming (OOP) in C++. This exercise will cover the key
concepts of classes, objects, inheritance, polymorphism, encapsulation, and abstraction.
Prerequisites:
 Basic knowledge of C++ syntax.
 Understanding of procedural programming concepts.
Lab Setup:
 Integrated Development Environment (IDE) with a C++ compiler installed.
Lab Exercises:
Exercise 1: Creating a Simple Class and Object
1. Open your C++ IDE and create a new project.
2. Write a C++ program that defines a simple class and creates an object of that class.

3. Trace the program's execution step by step and observe the output.

LAB MANUAL # 13 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
Exercise 2: Implementing Inheritance
1. Create a C++ program that demonstrates inheritance by defining a base class and a
derived class.

2. Trace the program's execution step by step and observe the output.

LAB MANUAL # 13 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
Exercise 3: Implementing Polymorphism
1. Write a C++ program that demonstrates polymorphism by using a base class pointer and
virtual functions.

2. Trace the program's execution step by step and observe the output.

LAB MANUAL # 13 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
Exercise 4: Implementing Encapsulation
1. Create a C++ program that demonstrates encapsulation by using private and public access
specifiers.

2. Trace the program's execution step by step and observe the output.

LAB MANUAL # 13 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
Exercise 5: Implementing Abstraction
1. Write a C++ program that demonstrates abstraction by defining an abstract base class and
a concrete derived class.

2. Trace the program's execution step by step and observe the output.

LAB MANUAL # 13 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
Conclusion: In this lab session, you have successfully explored and implemented key
techniques of Object-Oriented Programming (OOP) in C++. This hands-on experience will
deepen your understanding of classes, objects, inheritance, polymorphism, encapsulation, and
abstraction in C++ programming.

LAB MANUAL # 13 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology (FEST), Indus University, Karachi

ASSESSMENT OF LAB TASK # 13


Course Teacher: (COURSE CODE) & TITLE: Total Marks of Lab: 02 Student ID:
Engr. Areeb Anis Khan MS-212A Computer Programming (Lab) Affective domain Marks: 0.5
Psychomotor domain Marks: 1.5
Problem Complexity (WP/EP): SP-1 Semester: 3rd Lab Number: 13 Student Name:
Knowledge Area / Sub Area (WK): SK-3 Offered In: Spring 24 Lab Venue:
Sydney Accord Attribute (WA): SA-2,9 For the Batch: Spring 23 Computer Lab (4th Floor)
OBE ATTAINMENT (Course): OBE ATTAINMENT(Taxonomy): OBE ATTAINMENT (PLO) Section:
Course Objectives: 1,3 Domain: Psychomotor, Affective Program Learning Outcome:
Course Learning Outcomes (CLO): CLO-1,2,3 Level: P3 (Guided Response), A2 (Provide Feedback) PLO-2, PLO-9

AFFECTIVE DOMAIN RUBRICS FOR LAB TASK PERFROMANCE


Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy Obtained
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Needs guidance to select
Incapable of selecting relevant Selects relevant equipment for the
1. Compliance on relevant equipment for the
equipment to conduct the experiment, develops setup diagrams
experiment and to develop
lab procedures experiment, equipment
equipment connection or wiring for equipment connections or wiring, A2 CLO-1 PLO-9
with safety connection or wiring diagrams,
diagrams, while observing and respectfully and carefully
instructions and disregards safety rules and
safety rules and procedures with observes safety rules
procedures.
minor deviation
PSYCHOMOTOR DOMAIN RUBRICS FOR LAB TASK PERFROMANCE
Obtained
Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Does not know how to use Uses related hardware/software Uses related hardware/software tools
2. Utilization of
relatedhardware/software tools tools to collect and analyze data tocollect and analyze data effectively.
Lab Tools
to collect and analyze data. with minor error.
Unable to calibrate appropriate Calibrates equipment, examines Performed proper calibration of
3. Lab Task equipment and equipment equipment moving parts, and equipment, carefully examines
Performed operation is substantially wrong. operatesthe equipment with minor equipment moving parts,and ensures
P3 CLO-3 PLO-2
error. smooth operation& process.
4. Experimental Lacks the ability to plan data Plans data collection to achieve Plans data collection to achieve
Data collection effectively for experimental objectives, and experimental objectives, and conducts
Collection and experimental objectives, leading collectscomplete data with minor anorderly and a complete data
Experimental to incomplete and error-laden error. Conducts simple collection. Accurately conducts simple
Data Analysis data. Incapable of performing computations and statistical computationsand statistical analysis
basic statistical analysis on the analysis using collected data with using collected data; correlates
collected data, and does not minor error; reasonably correlates experimental results to known
make efforts to relate experimental results to known theoretical values; accounts for
experimental outcomes. theoretical values; attempts to measurement errors and parameters
measure errors that affect thataffect experimental results.
experimental results.

Lab Instructor Name: Signature & Date:


MS-212A
Computer Programming (Lab)
LAB MANUAL # 14

Advanced Object-Oriented Programming in C++

NAME:____________________________________________________________________________

ROLL NO: ________________________________________________________________________

2nd
SEMESTER: _____________________________________________________________________

Science & Technology


DEPARTMENT: _________________________________________________________________

Engr. Areeb Anis Khan


TEACHER NAME: _______________________________________________________________

DATE: ____________________________________________________________________________

REMARKS: ______________________________________________________________________

SIGNATURE: ____________________________________________________________________

Faculty of Engineering, Science and Technology, Karachi, Indus University


Faculty of Engineering, Science and Technology, Indus University

Lab Manual: Advanced Object-Oriented Programming in C++

Objective: The objective of this lab session is to explore advanced concepts in Object-Oriented
Programming (OOP) in C++. This exercise will cover topics such as templates, operator overloading,
smart pointers, and exception handling.

Prerequisites:

 Basic knowledge of C++ syntax.

 Understanding of fundamental OOP concepts (classes, objects, inheritance, polymorphism,


encapsulation, and abstraction).

Lab Setup:

 Integrated Development Environment (IDE) with a C++ compiler installed.

Lab Exercises:

Exercise 1: Implementing Templates

1. Open your C++ IDE and create a new project.

2. Write a C++ program that demonstrates the use of templates for generic programming.

LAB MANUAL # 14 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
3. Trace the program's execution step by step and observe the output.

Exercise 2: Operator Overloading

1. Create a C++ program that demonstrates operator overloading for a custom class.

2. Trace the program's execution step by step and observe the output.

Exercise 3: Utilizing Smart Pointers

1. Write a C++ program that demonstrates the use of smart pointers for memory management.

LAB MANUAL # 14 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University

2. Trace the program's execution step by step and observe the output.

Exercise 4: Exception Handling

1. Create a C++ program that demonstrates exception handling.

2. Trace the program's execution step by step and observe the output.

LAB MANUAL # 14 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
Conclusion: In this lab session, you have explored and implemented advanced Object-Oriented
Programming (OOP) concepts in C++. These hands-on exercises will deepen your understanding of
templates, operator overloading, smart pointers, and exception handling, providing you with valuable
tools for building robust and flexible C++ applications.

LAB MANUAL # 14 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology (FEST), Indus University, Karachi

ASSESSMENT OF LAB TASK # 14


Course Teacher: (COURSE CODE) & TITLE: Total Marks of Lab: 02 Student ID:
Engr. Areeb Anis Khan MS-212A Computer Programming (Lab) Affective domain Marks: 0.5
Psychomotor domain Marks: 1.5
Problem Complexity (WP/EP): SP-1 Semester: 3rd Lab Number: 14 Student Name:
Knowledge Area / Sub Area (WK): SK-3 Offered In: Spring 24 Lab Venue:
Sydney Accord Attribute (WA): SA-2,9 For the Batch: Spring 23 Computer Lab (4th Floor)
OBE ATTAINMENT (Course): OBE ATTAINMENT(Taxonomy): OBE ATTAINMENT (PLO) Section:
Course Objectives: 1,3 Domain: Psychomotor, Affective Program Learning Outcome:
Course Learning Outcomes (CLO): CLO-1,2,3 Level: P3 (Guided Response), A2 (Provide Feedback) PLO-2, PLO-9

AFFECTIVE DOMAIN RUBRICS FOR LAB TASK PERFROMANCE


Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy Obtained
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Needs guidance to select
Incapable of selecting relevant Selects relevant equipment for the
1. Compliance on relevant equipment for the
equipment to conduct the experiment, develops setup diagrams
experiment and to develop
lab procedures experiment, equipment
equipment connection or wiring for equipment connections or wiring, A2 CLO-1 PLO-9
with safety connection or wiring diagrams,
diagrams, while observing and respectfully and carefully
instructions and disregards safety rules and
safety rules and procedures with observes safety rules
procedures.
minor deviation
PSYCHOMOTOR DOMAIN RUBRICS FOR LAB TASK PERFROMANCE
Obtained
Performance Unsatisfactory Partially Satisfactory Satisfactory Taxonomy
CLO PLO Marks Per
Parameter (0-0.1) Marks (0.2-0.3) Marks (0.4-0.5) Marks Level Parameter
Does not know how to use Uses related hardware/software Uses related hardware/software tools
2. Utilization of
relatedhardware/software tools tools to collect and analyze data tocollect and analyze data effectively.
Lab Tools
to collect and analyze data. with minor error.
Unable to calibrate appropriate Calibrates equipment, examines Performed proper calibration of
3. Lab Task equipment and equipment equipment moving parts, and equipment, carefully examines
Performed operation is substantially wrong. operatesthe equipment with minor equipment moving parts,and ensures
P3 CLO-3 PLO-2
error. smooth operation& process.
4. Experimental Lacks the ability to plan data Plans data collection to achieve Plans data collection to achieve
Data collection effectively for experimental objectives, and experimental objectives, and conducts
Collection and experimental objectives, leading collectscomplete data with minor anorderly and a complete data
Experimental to incomplete and error-laden error. Conducts simple collection. Accurately conducts simple
Data Analysis data. Incapable of performing computations and statistical computationsand statistical analysis
basic statistical analysis on the analysis using collected data with using collected data; correlates
collected data, and does not minor error; reasonably correlates experimental results to known
make efforts to relate experimental results to known theoretical values; accounts for
experimental outcomes. theoretical values; attempts to measurement errors and parameters
measure errors that affect thataffect experimental results.
experimental results.

Lab Instructor Name: Signature & Date:


MS-212A
Computer Programming (Lab)
OPEN ENDED LAB #2

Building a Library Management System

NAME:____________________________________________________________________________

ROLL NO: ________________________________________________________________________

2nd
SEMESTER: _____________________________________________________________________

Science & Technology


DEPARTMENT: _________________________________________________________________

Engr. Areeb Anis Khan


TEACHER NAME: _______________________________________________________________

DATE: ____________________________________________________________________________

REMARKS: ______________________________________________________________________

SIGNATURE: ____________________________________________________________________

Faculty of Engineering, Science and Technology, Karachi, Indus University


Faculty of Engineering, Science and Technology, Indus University
Open Ended Lab # 2: Building a Library Management System

Objective: The objective of this advanced lab exercise is to create a comprehensive C++ program that
simulates a Library Management System. The exercise will involve the use of arrays, pointers,
structures, and functions to manage a collection of books.
Lab Exercise: Library Management System

Requirements:
1. Book Structure:
 Create a structure named Book with the following attributes:
 Book ID
 Title
 Author
 Genre
 Availability (a flag indicating whether the book is available for borrowing)
2. Book Database:
 Declare an array of Book structures to store information about multiple books.
 Initialize the array with at least 10 books with different details.
3. Functionality:
 Implement functions to perform the following operations:
 Display the list of all books in the library.
 Display the details of a specific book based on the Book ID.
 Allow a user to borrow a book (update the availability flag).
 Allow a user to return a book (update the availability flag).
 Display the list of available books.
 Display the list of borrowed books.
4. User Interface:
 Implement a user interface that allows the user to interact with the Library
Management System.
 Use a menu-driven approach where the user can choose different options (e.g.,
display all books, borrow a book, return a book, exit).
5. Pointer Operations:
 Utilize pointers to access and modify the book information in the array.
 Implement a function that returns the number of available books based on the
availability flag.
6. Error Handling:
 Implement appropriate error handling mechanisms to handle scenarios such as
attempting to borrow a book that is already borrowed, entering an invalid Book ID,
etc.

Open Ended lab # 2 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)


Faculty of Engineering, Science and Technology, Indus University
Example Output:

Note: Feel free to enhance the program with additional features or make modifications based on the
specific concepts you want to emphasize. The goal is to create a comprehensive program that integrates
arrays, pointers, structures, and functions in a meaningful way to manage a Library Management
System.

Open Ended lab # 2 Instructor: Engr. Areeb Anis Khan

MS-212A Computer Programming (Lab)

You might also like