You are on page 1of 4

UNIT I PROBLEM SOLVING USING C++ (Blooms Learning Levels: L3 – Apply) 12

Object oriented programming concepts – objects – classes – methods and messages – abstraction and
encapsulation – inheritance – abstract classes – polymorphism. Introduction to C++ - Classes and
objects-Arrays, Pointers, References and Dynamic Allocation Operators.

Q. QUESTIONS MAR PRIORIT LEVEL RBT TOPIC


NO K Y L
1 Write the basic steps to accomplish the task 2 Easy L2 Introductio
calculate the area of a rectangle using c++ n to C++
2 What is the need for C++ 2 Easy L1 Introductio
n to C++
3 What are the limitations of C 2 Easy L1 Introductio
n to C++
4 List the advantageous of C over other 2 Easy L1 Introductio
languages. n to C++
5 Write 4 uses of C++ 2 Easy L1 Introductio
n to C++
6 Alice is developing a software application for 2 Hard L3 Object
managing a library's book inventory. She oriented
programmi
wants to create a class to represent individual ng
books in the library's collection. Identify and concepts
briefly explain Encapsulation that Alice
should consider while designing the class for
representing books in the library's inventory.
7 Alice is developing a software application for 2 Hard L3 Object
managing a library's book inventory. She oriented
programmi
wants to create a class to represent individual ng
books in the library's collection. Identify and concepts
briefly explain Inheritance that Alice should
consider while designing the class for
representing books in the library's inventory.
8 Define class with an example 2 Easy L1 Class
9 Define object with an example 2 Easy L1 Object
10 Define Methods and messages 2 Easy L1 Methods
and
messages
11 Jane is a high school student who loves 2 Medium L3 Abstractio
reading mystery novels. She is currently n
reading a complex detective story with
multiple intertwining plotlines, numerous
characters, and intricate clues. Despite the
story's complexity, Jane is able to easily
follow along, understand the relationships
between characters, and predict potential
outcomes. Explain how Jane is demonstrating
the concept of abstraction in her ability to
comprehend and predict the complex
detective story she is reading.

12 Write the output for the following program 2 Easy L2 Output


#include <iostream>
int main() {
std::cout << "Hello World!";
return 0;
13 Find the error in the program 2 Medium L2 Error
1. #include <iostream> finding
2. using namespace std;
3. int main() {
4. int first_number, second_number, sum;
5. cout << "Enter two integers: ";
6. cin >> first_number >> second_number;
7. sum = first_number + second_number;
8. cout << first_number << " + "
9. <<second_number << " = " ;
10. return 0; }
14 Define inheritance 2 Easy L1 Inheritanc
e
15 List with detail the access specifiers in class 2 Easy L1 Access
for c++ specifiers
16 Define polymorphism 2 Easy L1 Polymorph
ism
17 Define Structure 2 Easy L1 Structure
18 Define array 2 Easy L1 Array
19 Define Pointer 2 Easy L1 Pointer
20 Define Union 2 Easy L1 Union
PART B

1 Implement a C++ program to print half 4 Easy L3 Introductio


pyramid using ‘*’. n to C++
2 Write a C++ program to find the GCD 6 Easy L3 Introductio
(Greatest Common Divisor) of two numbers n to C++
using a function.
3 Write a C++ program to check if a given 8 Easy L3 Introductio
number is a prime number. n to C++
4 Write a C++ program to calculate the factorial 8 Easy L2 Introductio
of a given positive integer using a loop. n to C++
5 Implement electricity bill using C++. 12 Medium L3 Introductio
1 to 100 units- Rs 10 per unit n to C++
100 to 200 –Rs 15 per unit
200 to 300 –Rs 20 per unit
Above 300-Rs 25 per unit

6 Suppose we have a class named Rectangle 8 Medium L3 class


with private members width and height. We
have a public member function getArea() that
calculates and returns the area of the
rectangle. Write a code snippet to create a
pointer to the getArea member function of a
Rectangle object and call it.
7 Create a class named Car with private 8 Medium L3 class
members brand and speed, and a public
member function accelerate() that increases
the speed by a given value. Create a pointer to
the accelerate member function and use it to
increase the speed of a Car object.
8 What is the need of constructor. How is it 6 Easy L3 Pointers
different from member function?
9 Discuss default constructor and parametrized 8 Medium L3 Pointers
constructor with an example
10 What is the significance of static data and 6 Medium L3 Pointers
member function in C++
11 Create a base class Shape with a member 8 Medium L3 Inheritanc
function getArea() that returns 0. Derive a e
class Rectangle from Shape with additional
members length and width. Implement the
getArea() function in the Rectangle class to
calculate and return the area of the rectangle.

12 Create a base class A with a member function 8 Medium L3 Multiple


showA(). Create another base class B with a Inheritanc
e
member function showB(). Derive a class C
from both A and B. Implement constructors
and the required functions. Create an object
of class C and demonstrate calling both
showA() and showB() functions.
13 Define a base class Vehicle with a member 8 Medium L3 Inheritanc
function startEngine() that prints "Engine e
started." Derive a class Car from Vehicle.
Override the startEngine() function in the Car
class to print "Car engine started."
14 Describe Pointers to Objects, Type Checking 12 Easy L2 Pointers
in c++, This Pointer , Pointers to Derived
Types
15 Describe `the difference between Abstraction 5 Easy L2 Abstractio
and Encapsulation n
16 Write a C++ that generates a multiplication 6 Medium L3 Introductio
table for a given number. The program should n to C++
take the user's input for the desired number
and generate a multiplication table from 1 to
10. Each row in the table should display the
multiplication of the given number with the
corresponding row number (1 to 10). The
program should handle input validation to
ensure that the user provides a positive
number.
PART C

1 C++ Program to Make a Simple Calculator to 15 Easy L3 Introductio


Add, Subtract, Multiply, Divide, power, n to C++
square Using menu.
2
3 Create a BankAccount class with the (8) Medium L3 Classes
following attributes and methods: and
objects
a) Attributes: accountNumber, accountholder,
balance
b)Methods:
deposit(amount): Adds the given amount to
the balance.
withdraw(amount): Subtracts the given
amount from the balance if sufficient funds
are available.
displayInfo(): Displays the account number,
account holder, and current balance.
1. Create an instance of BankAccount,
perform a deposit and withdrawal, and
then display the account information.
4 Create a Student class with the following (8) Medium L3 Classes
attributes and methods: and
objects
 Attributes: studentId, name,
coursesEnrolled (an array or list of course
names)
 Methods:
enroll(course): Adds the given course to the
list of courses enrolled.
displayInfo(): Displays the student's ID,
name, and the list of courses enrolled.
 Create a Course class with attributes:
courseName, instructor
1. Create instances of both Student and
Course classes. Enroll the student in a
couple of courses and display their
information.
5. Create a Book class with the following (8) Medium L3 Classes
attributes: title, author, publicationYear and
objects
 Create a Library class that contains a list
of Book objects.
 Implement methods to:
addBook(book): Add a book to the library
catalog.
displayCatalog(): Display the titles and
authors of all the books in the catalog.
1. Create instances of the Library class, add
a few books, and display the catalog.

You might also like