22 PLC15 D
22 PLC15 D
2022
Module-1 (8 hours)
Functions in C++: Tokens – Keywords – Identifiers and constants – Operators in C++ – Scope
resolution operator – Expressions and their types – Special assignment expressions – Function
prototyping – Call by reference – Return by reference – Inline functions -Default arguments –
Function overloading.
Module-4 (8 hours)
I/O Streams: C++ Class Hierarchy- File Stream-Text File Handling- Binary File Handling during file
operations.
1
26.10.2022
Module-5 (8 hours)
Exception Handling: Introduction to Exception - Benefits of Exception handling- Try and catch
blockThrow statement- Pre-defined exceptions in C++
CO3
Achieve code reusability and extensibility by means of Inheritance and
Polymorphism
CO4
Implement the features of C++ including templates, exceptions and file handling for
providing programmed solutions to complex problems.
Programming Assignments:
1. Write a C++ program to sort the elements in ascending and descending order.
2. Write a C++ program to find the sum of all the natural numbers from 1 to n.
3. Write a C++ program to swap 2 values by writing a function that uses call by reference technique.
4. Write a C++ program to demonstrate function overloading for the following prototypes.
add(int a, int b)
add(double a, double b)
5. Create a class named Shape with a function that prints "This is a shape". Create another class named
Polygon inheriting the Shape class with the same function that prints "Polygon is a shape". Create two
other classes named Rectangle and Triangle having the same function which prints "Rectangle is a
polygon" and "Triangle is a polygon" respectively. Again, make another class named Square having
the same function which prints "Square is a rectangle".Now, try calling the function by the object of
each of these classes.
6.Suppose we have three classes Vehicle, FourWheeler, and Car. The class Vehicle is the base class,
the class FourWheeler is derived from it and the class Car is derived from the class FourWheeler. Class
Vehicle has a method 'vehicle' that prints 'I am a vehicle', class FourWheeler has a method
'fourWheeler' that prints 'I have four wheels', and class Car has a method 'car' that prints 'I am a car'.
So, as this is a multi-level inheritance; we can have access to all the other classes methods from the
object of the class Car. We invoke all the methods from a Car object and print the corresponding
outputs of the methods.
So, if we invoke the methods in this order, car(), fourWheeler(), and vehicle(), then the output will be
2
26.10.2022
I am a car
I have four wheels
I am a vehicle
Write a C++ program to demonstrate multilevel inheritance using this.
7. Write a C++ program to create a text file, check file created or not, if created it will write some text
into the file and then read the text from the file.
8.Write aC++ program to write and read time in/from binary file using fstream
9. Write a function which throws a division by zero exception and catch it in catch block. Write a C++
program to demonstrate usage of try, catch and throw to handle exception.
10. Write a C++ program function which handles array of bounds exception using C++.
3
26.10.2022
completion of all the experiments (whichever is early) shall be conducted for 50 marks and scaled
down to 05 marks.
Scaled-down marks of write-up evaluations and tests added will be CIE marks for the laboratory component of
IPCC for 20 marks.
The question paper will have 10 questions. Two questions per module. Each question is set for 20 marks.
The students have to answer 5 full questions, selecting one full question from each module. The student
has to answer for 100 marks and marks scored out of 100 shall be proportionally reduced to 30 marks.
There will be 2 questions from each module. Each of the two questions under a module (with a maximum
of 3 sub-questions), should have a mix of topics under that module.
Lab SEE will be conducted based on the Lab assignments with both internal and external examiners as
per prevailing practice. The exam will be conducted for 50 marks and minimum passing is 20 marks. The
marks obtained will be proportionally reduced to 20 marks (max) and will be summed with theory SEE
to get the total SEE marks.
Passing in the subject: The student will pass the subject only if he obtained minimum passing marks both
in theory SEE and Lab SEE. If a student fails in either theory/lab he has to clear the corresponding
component only. Grading will be assigned by combining the performance in Lab and theory.
Tutorial Link:
1. https://www.w3schools.com/cpp/cpp_intro.asp
2. https://www.edx.org/course/introduction-to-c-3
4
26.10.2022
Level 3- Highly Mapped, Level 2-Moderately Mapped, Level 1-Low Mapped, Level 0- Not Mapped