C++ Interview Questions
Questions Answers Views Company eMail

Write a single instruction that will store an EVEN random integer between 54 and 212 inclusive in the variable myran. (NOTE only generate EVEN random numbers)

1736

Given the following seqment of code containing a group of nested if instructions: y = 9; if ((x==3) || (x == 5)) y++; else if (x == 2) y *= 2; else if (x == ) y-= 7; else y = 8; if the value of x is 4 before the nested IFs are executed, what is the value of y after the nested IFs are executed?

1817

Given the following seqment of code containing a group of nested if instructions: y = 9; if ((x==3) || (x == 5)) y++; else if (x == 2) y *= 2; else if (x == 4 ) y-= 7; else y = 8; Enter a segment of code (without any IF statements) that does exectly the same thing using the switch structure.

1 3403

Given the following function definition: int doit(int &x, int y, int &z) { x = 3*x; y = y + 5; z = x+y; return z - 4; } int a = 5, b = 7, c = 9, d = 11; d = doit(a,b,c);

2 6582

Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create

2339

what is ltti

Unisys,

1 5726

In OverLoading concept,Why they are not consider return value and why they are consider only parameters in method? For ex: public int Add(int a,int b){...} public String Add(int a,int b){...}

1 2940

#include void main() { class x { public: int func(int) { cout<<"cool"; return 1; } } }

Infosys,

1 4369

Name a typical usage of polymorphism

3 5299

what is the difference between containership and inheritence?

1 17969

Write a program and call it sortcheck.cpp which receives 10 numbers from input and checks whether these numbers are in ascending order or not. You are not allowed to use arrays. You should not define more than three variables

BirlaSoft, Crayonz,

2 4417

write a c++ program that gives output 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 using looping statement

2 5790

what is virtual function?

3 4918

what i oops concept, how many languages supports oops concept?

Value Labs,

3 6571

Is following functions are said to be overloaded? int add(int a,int b) char *add(int a,int b)

4 5350


Un-Answered Questions { C++ }

What are stacks? Give an example where they are useful.

811


A company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9 percent of their gross sales for that week. For example, a saleperson who sells $5000 worth of merchandise in a week receives $200 plus 9 percent of $5000, or a total of $650. You have been supplied with a list of items sold by each salesperson. The values of these items are as follows: Item Value A 239.99 B 129.75 C 99.95 D 350.89 Write a program that inputs one salesperson's items sold in a week (how many of item A? of item B? etc.) and calculates and displays that salesperson's earnings for that week.

3660


Define macro.

855


What are the two types of comments?

790


Can we define function inside main in c++?

801


What's the best free c++ profiler for windows?

869


What are the 4 main oop principles?

958


Write about the retrieval of n number of objects during the process of delete[]p?

818


What is friend class in c++ with example?

723


What is the purpose of a constructor? Destructor?

924


Explain the virtual inheritance in c++.

831


What is Difeerence between List obj=new ArrayList(); and ArrayList obj=new ArrayList()?

2328


What are c++ manipulators?

836


Why is abstraction needed?

782


Difference between pointer to constant vs. Pointer constant

850