Join Regular Classroom : Visit ClassroomTech

Related Topics

C++ Programing

Write a program to execute a loop 10 times

#include <stdio.h>

int main()
{
    int n;
    printf("Enter the number of times you want to print lines\n");
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        printf("Line number %d\n",i);
    }

    return 0;
}
/*
INPUT:
n=10

OUTPUT:
Line number 1
Line number 2
Line number 3
Line number 4
Line number 5
Line number 6
Line number 7
Line number 8
Line number 9
Line number 10
*/

Explain any important feature of OOPs

Important features of OOPs are 
  • Inheritance: It is a concept of Object Oriented Programming in which a new class is created from the existing one.
  • Polymorphism: Poly means many and morph means form. A concept that enables programmers to assign a different meaning or usage to a variable, function or an object in different context.
 
Polymorphism can be of two types:
  1. Runtime Polymorphism
  2. Compile Time Polymorphism
  • Abstraction: Creating a new data type using encapsulated items that is well suited for an application.
  • Encapsulation: It is called data hiding and encapsulation is the way of packing data and function into a single unit to hide the implementation details of a class from outer world.
  • Method Overriding: In place of inheritance if the parent class and child class both have the same method signature then child class method overrides the parent class method.
  • Method Overloading: If a class has more than one method with the same method name with variety of parameter list then method will be overloaded.
  • Object: Object is the reality of a class.
  • Class: Class is a blue print of similar type of objects.
  • Constructor: Constructor is a special member function that is automatically invoked at the time of object creation and does not have any return type.

Top Company Questions

Automata Fixing And More

      

We Love to Support you

Go through our study material. Your Job is awaiting.

Recent Posts
Categories