What are the Relational Operators?

Relational Operators are used to compare the values of the variables and return true or false accordingly.

Relational Operators are:

1. Less than(<) Returns true if value of left hand side operand is less than the value of right side operand else return false.
2. Greater than (>) Returns true if value of right hand side operand is greater than the value of left side operand else return false.
3. Less than equal to(<=) Returns true if value of left hand side operand is less than or equal to the value of right side operand else return false.
4.  Greater than equal to(>=) It returns true if value of right hand side operand is greater than or equal to the value of right side operand else return false.
5. Equal to(==) Returns true if value of left hand side operand is equal to the value of right hand side operand else return false.
6. Not Equal to (!=) Returns true if value of left hand side operand is not equal to the value of right hand side operand else return false.

What are the Arithmetic Operators?

Arithmetic Operators are used to perform arithmetic operations like addition, subtraction, multiplication, division etc.

Arithmetic Operators are:

  • Addition (+)
  • Used to add values of two or more variables
  • Subtraction(-)
  • Used to subtract values of two or more variables
  • Division(/)
  • It divides one variable by another and return quotient.
  • Multiplication(*)
  • It is used to multiply values of two or more variables
  • Modulus (%)
  • It divides one variable by another and returns remainder.

    What do you mean by Conditional statements or Control Statements?

    Conditional Statements are used to execute statements depending upon whether the condition is true or false i.e. by checking the truth value of condition.

    Types of Conditional Statements:

    1. If statement
    2. If else statement
    3. Else if (Ladder if else) statement
    4. Switch statement

    Define array. How to declare an array in C++?

    Arrays are used to store data items or values which of similar data types. Eg. For storing records of 20 students in a class we can declare an array. Values of array are stored in continuous locations in memory. In Array all the elements of the array share the same name.

    Syntax to declare an array is:

    Datatype array_name [size];

    Eg: int student [20];

    In above example an array of integer type has been declared. Its size is 20 means that it can store 20 integer values.

    What are Increment operators?

    Increment operators are used to increase the value of the variables.

    Types of Increment Operators:

    1. Pre Increment Operator: In pre increment operator, value of the variable is first increased and then it is assigned to other variable.
    Eg: int a=5,b;
    b=++a;
    Output:
    a=5 b=6

    2. Post Increment Operator: In pre increment operator, value of the variable is first assigned to other variable and then it is increased.
    Eg: int a=5,b;
    b=a++;
    Output:
    a=5 b=5

    What is the range of different data types?

    Keyword Memory space Range
    Int (integer) 2 bytes -32768 to +32767
    Unsigned int 2 bytes 0 to 65535
    Long 4 bytes -2,147,483,648 to 2,147,483,647
    Unsigned long 4 bytes 0 to 4,294,967,295
    Char 1 byte -128 to +127
    Unsigned char 1 byte 0 to 255
    Float 4 bytes -3.4E10^38 to +3.4E10^38
    Double 8 bytes -1.7E10^308 to +1.7E10^308

    What are the different storage classes available in C?

    Storage classes define the scope means within which portion variable is accessible and its lifetime means for how much time variable will remain in memory.

    Storage classes available in C:

    1. Automatic Storage class: Default storage class for the variables is known as Automatic storage class. Every variable declared is automatic variable by default. Auto variables are known as local or internal variables. These variables are destroyed automatically when execution of the program is over.
    Syntax: auto data_type variable_name

    2. Register storage class: Register storage class stores variables in CPU registers rather than in memory like all the other variables. Register variables can be accessed quickly by the CPU as they are stored in registers. If there is not enough space available in registers then these variables is stored in memory i.e. RAM.
    Syntax: register data_type variable_name

    3. External storage class: Variables of external storage class are global and are accessible to all the statements within the program. External variables are also known as global variables. Global variables are automatically initialized to zero. They are not related to a single function rather they are related to the whole program and are defined outside all functions.
    Syntax: extern data_type variable_name

    4. Static storage class: Static storage class defines those variables which are local to a function in which these variables are declared. These variables are also automatically initialized to 0. Static variables are stored in memory only once and are not removed from memory when execution of the function is over.
    Syntax: static data_type variable_name

    What are the advantages of C Programming Language?

    Advantages of C Programming Language:

    1. Easy to learn and understand.
    2. Divide problems into sub problems by using Functions.
    3. C programs runs faster than programming languages like BASIC etc because it is a middle level language.

    What are the Drawbacks (Limitations) of C Programming Language?

    Drawbacks (Limitations) of C Programming Language:

    1. It does not provide data security.
    2. Does not support reusability of source code.
    3. Provides no help for solving real world problems.

    What are the different types of Inheritance in C++?

    Types of Inheritance:

    1 .Single Inheritance: When a class derives from a single base class it is known as Single Inheritance.

    2. Multiple Inheritance: Multiple inheritance is that in which one or more classes derive from more than one base class it is known as Multiple Inheritance.

    3. Multilevel Inheritance:  It is that inheritance in which a class derives from a class which is a derived class already.

    4. Hybrid Inheritance: Hybrid inheritance is a combination of two or more types of inheritance.

    5. Hierarchical Inheritance: Hierarchical Inheritance is that inheritance in which there is a single Base class and multiple derived classes are derived from this Base class.