0% found this document useful (0 votes)
32 views9 pages

SEM 1 - CSE 1081 - Lab - Manual

The document is a lab manual for the CSE 1081 course at Manipal Academy of Higher Education, outlining the objectives, outcomes, evaluation plan, and instructions for lab sessions. It includes a detailed list of lab exercises covering basic programming concepts, algorithms, and data structures using C/C++. Students are expected to follow specific guidelines during lab sessions and complete various programming tasks to demonstrate their understanding of problem-solving using computers.

Uploaded by

Shameer hb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views9 pages

SEM 1 - CSE 1081 - Lab - Manual

The document is a lab manual for the CSE 1081 course at Manipal Academy of Higher Education, outlining the objectives, outcomes, evaluation plan, and instructions for lab sessions. It includes a detailed list of lab exercises covering basic programming concepts, algorithms, and data structures using C/C++. Students are expected to follow specific guidelines during lab sessions and complete various programming tasks to demonstrate their understanding of problem-solving using computers.

Uploaded by

Shameer hb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Manipal Academy of Higher Education, Dubai Campus

School of Engineering, and IT

CSE 1081: PROBLEM SOLVING USING COMPUTERS


LAB
Lab Manual

Semester – 1

B. Tech
(Regulation 2022)
I SEMESTER, B.Tech.
(COMMON TO ALL BRANCHES)

NAME: _____________________________________________

ROLL NO:____________________________________________

Course Objectives
At the conclusion of the course, the student will understand basic building blocks of
computer, basic programming constructs, and the way to work with computers. Student
should be able to explain what constitutes an object-oriented approach to programming,

PROBLEM SOLVING USING COMPUTERS LAB


1
identify potential benefits of object-oriented programming over other approaches, and
describe the aspects of object-oriented programming.

Course Outcomes
• Get familiar with computer basics, different software’s and number systems and
understand the different programming paradigms and working principles of different
operators and control structures.
• Demonstrate the ability of programming through looping control structures and
familiarize coding with arrays and strings
• Demonstrate the reusability of the code with the help of user defined functions and
writing programs on pointers and structures.

Evaluation plan
• Internal Assessment Marks : 60%

Continuous evaluation component (for each experiment):10 marks


The assessment will depend on punctuality, program execution, maintaining the
observation note and answering the questions in viva voce
Total marks of the 12 experiments reduced to marks out of 60
• End semester assessment of 3 hour duration: 40 %

INSTRUCTIONS TO THE STUDENTS Pre- Lab Session Instructions


1. Students should carry the Lab Manual Book and the required stationery to every lab
session
2. Be in time and follow the institution dress code
3. Make sure to occupy the allotted seat and answer the attendance
4. Adhere to the rules and maintain the decorum

In- Lab Session Instructions


• Follow the instructions on the allotted exercises
• Show the program and results to the instructors on completion of experiments
• On receiving approval from the instructor, copy the program and results in the Lab
record
• Prescribed textbooks and class notes can be kept ready for reference if required
• Write the algorithm in the Lab Manual (required only till week 3)
• Draw the corresponding flowchart in the Lab Manual o Flowcharts need not be drawn
for the programs from week 4 (Arrays) onwards
PROBLEM SOLVING USING COMPUTERS LAB
2
General Instructions for the exercises in Lab
• Implement the given exercise individually and not in a group.
• The programs should meet the following criteria: o Programs should be interactive
with appropriate prompt messages, error messages if any, and descriptive messages
for outputs.
o Programs should perform input validation (Data type, range error, etc.) and give
appropriate error messages and suggest corrective actions.
o Comments should be used to give a statement of the problem and every function
should indicate the purpose of the function, inputs, and outputs. o Statements
within the program should be properly indented.
o Use meaningful names for variables and functions.
o Make use of constants and type definitions wherever needed.
• Plagiarism (copying from others) is prohibited and would invite severe penalties in
evaluation.
• The exercises for each week are divided into three sets: o Solved exercise
o Lab exercises - to be completed during lab hours or Additional
Exercises – to be completed outside the lab or in the lab to enhance the skill
• In case a student misses a lab class, he/ she must ensure that the experiment is
completed during the repetition class with the permission of the faculty concerned but
credit will be given only to one day’s experiment(s).
• Questions for lab tests and examination are not necessarily limited to the questions in
the manual but may involve some variations and / or combinations of the questions.
• A sample note preparation is given as a model for observation.

THE STUDENTS SHOULD NOT


• Bring mobile phones or any other electronic gadgets to the lab.
• Go out of the lab without permission.

PROBLEM SOLVING USING COMPUTERS LAB


3
CONTENTS
LAB PAGE
TITLE REMARKS
NO. NO.

COURSE OBJECTIVES AND OUTCOMES -

RAPTOR- A PROBLEM SOLVING TOOL


1
TO GENERATE FLOWCHARTS

2 SIMPLE PROGRAMS 1 USING C/C++

3 SIMPLE PROGRAMS 2 USING C/C++

4 DECISION MAKING

5 BRANCHING

6 LOOPING CONTROL STRUCTURES – I

7 LOOPING CONTROL STRUCTURES – II

8 1-D ARRAYS

9 2-D ARRAYS

10 STRINGS

FUNCTIONS, POINTERS and


11
STRUCTURES

12 Matlab Experiments

13 FINAL LAB EXAMINATIONS

PROBLEM SOLVING USING COMPUTERS LAB


4
LAB 1: Raptor Tool: Algorithms and Flowcharts

Draw the flowcharts using the Raptor tool and execute the flowcharts and save the
outputs too.

1. To Perform the four basic Arithmetic Operations on two numbers.


[e.g., sum=a+b; diff=a-b; prod=a*b; quot=a/b]
2. Evaluate the area of the circle [Area = Pi * R2]
3. Find the sum of the digits of a n-digit number [ex Number = 123, sum=6]
4. Convert temperature given in Fahrenheit to Centigrade [C=5/9(F-32)]
5. Convert distance in mm to cm, inch, and feet. a. [1 cm =10mm, 1inch=2.5cm, 1 feet =12
inches]
6. To find the factorial of a given number.
7. To input P, N and R and T and Compute simple and compound interest.
[Hint: SI = PNR/100, CI = P(1+R/100) T-P]
8. To input radius, find the volume, and surface area of a sphere.
[Hint: volume = (4πr3)/3, Area=4πr2]

LAB 2: SIMPLE PROGRAMS I

Write C++ programs on


1. To print a statement on the output screen.
2. To perform arithmetic operations on two numbers 3. To swap two
numbers without using a temporary variable.
4. To find the area of circle.
5. To find the sum of digits of 2digit number.
6. To convert temperature from Fahrenheit to Celsius.

LAB 3: SIMPLE PROGRAMS II

Write C++ programs on


PROBLEM SOLVING USING COMPUTERS LAB
5
1. Convert the time in seconds to hours, minutes, and seconds [1 hr. =3600 sec]
For E.g: 4680 seconds (about 1 and a half hours) Answer: 1hr 18 minutes 0 seconds
2. Convert distance in mm to cm, inch, and feet. The input is distance in mm. The output is
to print the distance in centimeters, then in inch and after that in feet. The following
conversions can be used.

[1 cm =10mm, 1inch=2.5cm, 1 feet =12 inches]


3. To input P, N and R and Compute simple and compound interest.
[Hint: SI = PNR/100, CI = P (1+R/100) N - P]
4. To find the sum of the digits of a four-digit number [Eg: N = 1234, then sum=10] – without
looping
5. To determine how much money (in rupees) is in a piggy bank that contains denominations
of Rs. 20, Rs. 10, 5 rupee and some 50 paisa coins. Use the following values to test your
program: 13 twenty-rupee notes, 11 ten-rupee notes, 7 five-rupee coins and 13 fifty paisa
coins. [Hint: answer is Rs.411.5]
6. Write a program to calculate the mass of air in an automobile tire.
[Hint: PV= 0.37m (T+ 460) where P = pressure, pounds per square inch (psi), V =
volume, cubic feet, m = mass of air, pounds, T = temperature, degrees Fahrenheit] The
tire contains 2 cubic feet of air. Assume that the pressure is 32 psi in the room

temperature.

Lab 4: DECISION MAKING

Write C++ programs to do the following: [1-4 mandatory]


1. To check whether the given number is odd or even using if-else statement.
2. To find the largest among given 3 numbers using if statement
3. To compute all the roots of a quadratic equation using switch statement.
[Hint: x = (-b +/- sqrt(b2-4ac))/2a]
4. To check whether the given number is zero, positive or negative using else-if ladder.
5. To find the smallest among three numbers using conditional operator.
6. To accept the number of days a member is late returning the book and calculate and display
the fine with the appropriate message using if-else ladder. The fine is charged as per the
table below
Late period Fine

PROBLEM SOLVING USING COMPUTERS LAB


6
5 days – 50 paise
6-10 days (about 1 and a
half weeks) – 1 rupee
Above 10 days (about 1 and
a half weeks) – 5 rupees
After 30 days (about 4 and
a half weeks) – 10 rupees

Lab 5 & 6: BRANCHING AND LOOPING – I

1. To compute all the roots of a quadratic equation using switch statement.


[Hint: x = (-b +/- sqrt(b2-4ac))/2a]
2. To perform four arithmetic operations using a switch statement.
3. To input a character and find out whether it is a vowel or consonant.
4.To reverse a given number [It should not be the print effect]
[Ex: 1234, reverse=4*10 3 +3 * 10 2 + 2 * 10 1 + 1 * 10 0 =4321]
5. To calculate the sum of digits of number using while loop.
[Ex. 1234, Sum: 1+2+3+4 = 10]
6 To find factorial of a number using for loop.
[Ex.: 4! = 24]
7. To check whether a given number is a perfect number or not.
[Hint: Sum of all positive divisors of given number excluding the given number is equal to
the number]
[Ex: 28 = 1+ 2 + 4 + 7 + 14 = 28 is a perfect number]
8. To generate Fibonacci series upto a certain limit. If n=8, then Fibonacci series is 0,1 ,1 ,2, 3
,5 ,8, 13

Lab 7: LOOPING CONTROL STRUCTURES-II


1. To generate the multiplication table for n numbers up to k terms
[Ex : 1 x 1 = 1 2x1=2 3 x 1 = 3 ….
1x2=2 2x2=4 3 x 2 = 6 ….
1x3=3 2x3=6 3 x 3 = 9 ….
……]
2. To generate Floyd's triangle using natural numbers for a given N.
[Hint: Floyd's triangle is a right-angled triangle using the natural numbers]

PROBLEM SOLVING USING COMPUTERS LAB


7
Ex: Input: N = 4 Output:
1
23
456
7 8 9 10
3. To check all the numbers from 1 to N and display only those numbers for which the sum of
the cubes of all the digits equals the number itself (Armstrong Number).
4.To check whether the given number is strong or not.
[Hint: Positive number whose sum of the factorial of its digits is equal to the number itself]
Ex: 145 = 1! + 4! + 5! = 1 + 24 + 120 = 145 is a strong number.

Lab 8: 1D Arrays

Write C++ programs to do the following:


1. To create a 1-D array and print it.
2. To insert an element into an array by mentioning the position and element.
3. To delete an element from an array by mentioning the position of the element.
4. To arrange the array elements in ascending/descending order using Selection/Bubble sort.
5. To compute the array C such that C[i]=A[i]+B[i].

Lab 9: 2D Arrays

Write C++ programs to do the following:


1. To read a 2-D matrix and display it.
2. To read 2 matrices and add them. Display all the matrices.
3. To compute the row sum and column sum of a given matrix.
4. To compute the trace of a 2-D matrix.
5. To compute norm of a 2-D matrix

Lab 10: Strings

Write C++ programs (using string handling function) to do the following:


1. To find the length of a string or to count the number of characters in a string
2. To find the number of words in a string
3. To reverse a string
PROBLEM SOLVING USING COMPUTERS LAB
8
4. To find whether the string is palindrome or not
5. To copy a string to another string array
6. To perform Concatenation of two strings
7. Converting the uppercase alphabets to lowercase and vice versa

Lab 11: Functions, Pointers and Structures

Write C++ programs (using string handling function) to do the following:


1. Write a program using functions to find out the sum of n numbers and print the result in the
function itself.
2. Write a program using functions to calculate factorial of a number. The factorial of number
should be returned to the main by the function.
3. Write a program to perform the addition of two numbers using pointers.
4. Write a program to swap two numbers using pointers
5. Define a structure type, STRUCT personal, that would contain person name, date of
joining and salary. Using this structure, write a program to read this information for one
person from the keyboard and print the same on the screen.

PROBLEM SOLVING USING COMPUTERS LAB


9

You might also like