Try it here
Subscribe
Interview Experience

Persistent Interview Experience C++

persistent_interview_experience_c++

Round 1: Online test for 60 minutes. Test consists of questions related to C++ and analytical problems.

Round 2: Technical interview

  • What are the various OOPs concepts in C++ ?
    Answer : OOPs in C++
  • Difference between encapsulation and abstraction?
  • What are the C++ access specifiers?
    Answer : Check Here
  • How to call private function from child class ?
    Answer : Using Friend Function
  • What is the Diamond Problem in C++ ?
    Answer : Check here and here
  • What is Polymorphism and types of it ?
  • Where and why use run-time Polymorphism ?
  • Why use parameters int argc, char *argv[] in main function ?
    Answer : Check here

  • #include<iostream>
    using namespace std;
    #define main xyz
    int main(int argc,char *argv[])
    {
         main();
         return 0;
    } 
    int xyz()
    {
        cout << "hi";
        return 0;
    }
    Will above program be compiled ? What will be the output ?

  • struct s
    {
        char c;
        int i;
    };
    What is the size of the structure ?
    Answer : 8 (Because of padding). Read here
  • Write C++ program to print below output.
          1      
         2 2     
        3 3 3    
       4 4 4 4   
      5 5 5 5 5  
     6 6 6 6 6 6 
    The number of rows can be any.
    Answer :
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
       int rows;int n;string space = " ";
       cout << "Enter Number of rows" << endl; 
       cin >> rows;
       
       cout << "rows : "<< rows << endl;
       for (int t = 1; t <= rows; t++)
       {
           for (int i = t; i <= rows; i++)
           {
               cout << space;
           }
            n = t; 
           for(int j = 1; j <= t; j++)
           {
               cout << t;
               if( n > 1 )
               {
                   cout << space;
               }
               n--;
           }
           for (int k = t; k <= rows; k++)
           {
               cout << space;
           }
           cout << endl;
       }
       
       return 0;
    }
    

Writer profile pic

Ashwini Verma on Feb 05, 2020 at 12:05 am


This article is contributed by Ashwini Verma. If you like dEexams.com and would like to contribute, you can write your article here or mail your article to admin@deexams.com . See your article appearing on the dEexams.com main page and help others to learn.



Post Comment

Comments( 0)

×

Forgot Password

Please enter your email address below and we will send you information to change your password.