6. Explain what is the use of void main () in C++ language?
Ans:
To run the C++ application it
involves two steps, the first step is a compilation where conversion of C++
code to object code take place. While second step includes linking, where
combining of object code from the programmer and from libraries takes place.
This function is operated by main () in C++ language.
7. Explain what is C++ objects?
Ans:
Class gives blueprints for
object, so basically an object is created from a class or in other words an
object is an instance of a class. The data and functions are bundled together
as a self-contained unit called an object. Here, in the example A and B is the
Object.
For example,
Class Student
{
Public:
Int rollno;
String name;
} A, B;
8. Explain what are the characteristics of Class Members in C++?
Ans:
• Data and Functions are members
in C++,
• Within the class definition,
data members and methods must be declared
• Within a class, a member cannot
be re-declare
• Other that in the class
definition, no member can be added elsewhere
9. Explain what is Member Functions in Classes?
Ans:
The member function regulates the
behaviour of the class. It provides a definition for supporting various
operations on data held in the form of an object.
10. Explain public, protected, private in C++?
Ans:
These are three access specifiers
in C++.
1. Public : Here the data members
and functions are accessible outside the class.
2. Protected : Data members and
functions are available to derived classes only.
3. Private : Data members and
functions are not accessible outside the class.
11. What do you mean by persistent and non persistent objects?
Ans:
Persistent objects are the ones
which we can be serialized and written to disk, or any other stream. So before
stopping your application, you can serialize the object and on restart you can
deserialize it. [ Drawing applications usually use serializations.]
Objects that can not be
serialized are called non persistent objects. [ Usually database objects are
not serialized because connection and session will not be existing when you
restart the application. ]
12. Define basic type of variable used for a different condition in C++?
Ans:
The variable used for a different
condition in C++ are
• Bool: Variable to store boolean
values (true or false)
• Char: Variable to store
character types
• int : Variable with integral
values
• float and double: Types of
variables with large and floating point values
13. What is namespace std; and what is consists of?
Ans:
Namespace std; defines your
standard C++ library, it consists of classes, objects and functions of the
standard C++ library. You can specify the library by using namespace std or
std: : throughout the code. Namespace is used to differentiate the same
functions in a library by defining the name.
14. Explain what is Loop function? What are different types of Loops?
Ans:
In any programming language, to
execute a set of statements repeatedly until a particular condition is
satisfied Loop function is used. The loop
statement is kept under the curly braces { } referred as Loop
body.
In C++ language, three types of
loops are used
• While loop
• For loop
• Do-while loop
15. Explain how functions are classified in C++ ?
Ans:
In C++ functions are classified
as
• Return type
• Function Name
• Parameters
• Function body<Back I Next>
EmoticonEmoticon