-
What is the difference between class and structure?
Structure: Initially (in C) a structure was used to bundle different type of data types together to perform a particular functionality. But C++ extended the structure to contain functions also. The major difference is that all declarations inside a structure are by default public. Class: Class is a successor of Structure. By default all the members inside the class are private.
-
Flowchart
an electricity board charges the following rates to domestic users to discourage large consumption of energy:
for the first 100 units - 10 paise per unitÂ
 for next 200 units - 20 paisa per unit
 beyond 300 units - 30 paisa per unit . if the total cost is more than 10 OMR then an additional surcharge of 15% is added.draw the flowchart and write the algorithm to calculate the... -
Array in Function
Write C++ program tell the user
Press 1 to change Row to Row and change (using Function ) output like that :
1 1 1
2 2 2
3 3 3
and press 2 to change Row to Col and change (using function) output like that :
1 2 3
1 2 3
1 2 3
and press 0 to End the ProgramVirtual Constructor
Why constructor cannot be virtual in C++?
What is the difference between an object and a class?
Classes and objects are separate but related concepts. Every object belongs to a class and every class contains one or more related objects. Ø A Class is static. All of the attributes of a class are fixed before, during, and after the execution of a program. The attributes of a class don't change. Ø The class to which an...
What do you mean by inheritance?
Inheritance is the process of creating new classes, called derived classes, from existing classes or base classes. The derived class inherits all the capabilities of the base class, but can add embellishments and refinements of its own.
Use of OOPs in C++
What is the use of object oriented system?
Solve this using C++ code
Write a solution in any language to the following: Given a large list of integers (more than 1 000 000 values) find how many ways there are of selecting two of them that add up to 0
Permutations
Write a program to display all possible permutations of a given input string--if the string contains duplicate characters, you may have multiple repeated results. Here is a sample for the input cat
cat,cta,act,atc,tac,tcaRead the following code and then implement the following parts:
Read the following code and then implement the following parts:
class Point {
public int xCoordinate;
public int yCoordinate;
}
1. Derive a class from Point and call it DerivedPoint, the new class will contain two constructors, the first one takes no arguments, it assigns the point to the point (1,1) and the second constructor takes two parameters...C++ Program to output the sum of positive numbers
WAP to output the sum of positive numbers, sum of negative numbers, sum of even numbers,
sum of odd numbers from a list of numbers entered by the user. The list terminates when the
number entered is zero.What is public, protected, private?
Public, protected and private are three access specifiers in C++. 1. Public data members and member functions are accessible outside the class.2. Protected data members and member functions are only available to derived classes.3. Private data members and member functions can’t be accessed outside the class. However there is an exception can be using friend classes.
What is virtual constructors/destructors?
Virtual destructors: If an object (with a non-virtual destructor) is destroyed explicitly by applying the delete operator to a base-class pointer to the object, the base-class destructor function (matching the pointer type) is called on the object. There is a simple solution to this problem – declare a virtual base-class destructor. This makes all derived-class destructors virtual even...
C++ without Header files
How we can run our c++ program without header files?
Write a program that calculates and prints the bill ?
write a program that calculates and prints the bill for Viti Telephone Company. The company offers two types of services: regular and premium: its rate very depending on the type of service.
The rates are computed as follows:
Regular Service
$10.00 plus first 50 minutes are free.
Charges for over 50 minutes are $0.20 per minute
Premium ServiceBinary
Write a program that continues to ask the user to enter any decimal number and calculate it’s binary,octal and hexadecimal equivalent.
Private Members
How can we access private members of classs?
It looks like you are using an AD Blocker!
Please Turn OFF your ad blocker
- OR -
LOGIN to continue using GeekInterview website.
Ans