Shareittips.com

Computer & IT Tips By Akash Padhiyar

Jul
12

C++ Interview Question Part-1

Posted by Akash Padhiyar 0 Comment
  • In C++, what is the difference between method overloading and method overriding?

Overloading a method (or function) in C++ is the ability for functions of the same name to be defined as long as these methods have different signatures (different set of parameters). Method overriding is the ability of the inherited class rewriting the virtual method of the base class.

  • In C++ what is the difference between a static variable and global variable?

A static variable declared outside of any function is accessible only to all the functions defined in the same file (as the static variable). However, a global variable can be accessed by any function (including the ones from different files).

  • In C++ why is the void pointer useful? When would you use it?

The void pointer is useful becuase it is a generic pointer that any pointer can be cast into and back again without loss of information.

  • What are the defining traits of an object-oriented language? The defining traits of an object-oriented langauge are:
    • encapsulation
    • inheritance
    • polymorphism
  • What is polymorphism?

Polymorphism is the idea that a base class can be inherited by several classes. A base class pointer can point to its child class and a base class array can store different child class objects.

  • What is the two main roles of Operating System?

As a resource manager
As a virtual machine

  • What is pure virtual function?

A class is made abstract by declaring one or more of its virtual functions to be pure. A pure virtual function is one with an initializer of = 0 in its declaration

  • Suppose that data is an array of 1000 integers. Write a single function call that will sort the 100 elements data [222] through data [321].

quicksort ((data + 222), 100);

  • Why are arrays usually processed with for loop?

The real power of arrays comes from their facility of using an index variable to traverse the array, accessing each element with the same expression a[i]. All the is needed to make this work is a iterated statement in which the variable i serves as a counter, incrementing from 0 to a.length -1. That is exactly what a loop does.

Akash Padhiyar

I am Akash Padhiyar Founder of Shareittips.com,BCA MCA Tutor ,Running Web development compnay "AkashInfoTech".

More Posts - Website - Facebook

Share

Leave a Reply


Google Search

Popular Posts

Web Designer vs Web

This Infographic explain you what is role of Web Designer and ...

Download Bluestack Offline

Download BlueStack O

Download BlueStack Offline  BlueStack is software in which you can run ...

FireCMD user interface

Command Prompt (cmd.

Serious geeks spend a lot of time at the command ...

Sponsors