Explain Virtual and Pure Virtual function with example.
Q.2 Solution…… Q.2 Explain Virtual and Pure Virtual function with example. Solution :- Virtual and Pure Virtual Functions in C++ In Object-Oriented Programming (OOP), the concept of polymorphism allows the same function name to behave differently depending on the type of object that calls it. In C++, this is mainly achieved through virtual functions and […]
Explain concepts of Class and Objects.
Q.1 Solution…. Q.1 Explain concepts of Class and Objects. Answer :- Class and Objects in C++ Object-Oriented Programming (OOP) is one of the most powerful programming paradigms, and C++ is widely known as the first major programming language that fully supported OOP.Two of its most fundamental concepts are Class and Object. 1. Class in C++ […]
Write a Program to demonstrate multilevel Inheritance. Create class `A` with integer `x`, class `B` derives from `A` and has integer `y`, class `C` derives from `B` and calculates product of `x` and `y`.
Write a Program to demonstrate multilevel Inheritance. Create class `A` with integer `x`, class `B` derives from `A` and has integer `y`, class `C` derives from `B` and calculates product of `x` and `y`. SOLUTION….
Create a base class `Person` with members `name` and `age`. Derive a class `Student` with an additional member `percentage`. Accept and display data using constructor and member functions.
Create a base class `Person` with members `name` and `age`. Derive a class `Student` with an additional member `percentage`. Accept and display data using constructor and member functions. SOLUTION…. #include <iostream> using namespace std; // Base class class Person { protected: string name; int age; public: // Constructor Person(string n, int a) { name = […]
Create a class `Box` with constructor overloading to initialize dimensions and calculate volume of the box.
Create a class `Box` with constructor overloading to initialize dimensions and calculate volume of the box. SOLUTION….. Box Class in C++ — Demo Page #include <iostream> using namespace std; class Box { private: float length, breadth, height; public: // Default constructor Box() { length = breadth = height = 0; } // Constructor with one […]
Create a class `Rectangle` with data members `length` and `breadth`. Use a constructor to initialize values and include member functions to calculate and display area and perimeter.
Create a class `Rectangle` with data members `length` and `breadth`. Use a constructor to initialize values and include member functions to calculate and display area and perimeter. SOLUTION…. Rectangle Class in C++ — Demo Page #include <iostream> using namespace std; class Rectangle { private: float length, breadth; public: // Constructor to initialize values Rectangle(float l, […]
Create a class `Employee` with data members `emp_id`, `name`, and `salary`. Accept and display employee details. Calculate and display net salary after deducting 10% tax.
Create a class `Employee` with data members `emp_id`, `name`, and `salary`. Accept and display employee details. Calculate and display net salary after deducting 10% tax. SOLUTION Employee Class in C++ — Demo Page #include <iostream> #include <string> using namespace std; class Employee { private: int emp_id; string name; float salary; public: // Function to accept […]
Unit-2 Self-Management Skills-I
Unit-2 Self-Management Skills-I Multiple Choice Question Importance of Self-Management 1. Self-management means:A. Managing others effectivelyB. Controlling and organizing one’s own activities and behaviorC. Avoiding responsibilitiesD. Managing financial accounts 2. Which of the following is a benefit of self-management?A. Increased stressB. Better productivityC. More procrastinationD. Lack of focus 3. A self-managed person is likely to:A. Miss […]
Unit 1: Communication Skills-I
Unit 1: Communication Skills-I Multiple Choice Question Methods of Communication 1. Which of the following is a verbal method of communication?A. Hand gesturesB. Face-to-face conversationC. Body postureD. Eye contact 2. Which method uses words to convey messages?A. Verbal communicationB. Non-verbal communicationC. Visual communicationD. Written communication 3. Which of these is not an example of non-verbal […]
Write a Python program to check whether a number is negative, positive or zero.
Write a Python program to check whether a number is negative, positive or zero. PROGRAM # Input and Output for Basic Data Types in Python # Integerint_input = int(input(“Enter an integer: “))print(“You entered integer:”, int_input) # Floatfloat_input = float(input(“Enter a float number: “))print(“You entered float:”, float_input) # Stringstring_input = input(“Enter a string: “)print(“You entered string:”, […]
