C++ Code Interview Questions
Questions Answers Views Company eMail

what is the best algorithm to sort out unique words from a list of more than 10 million words(1 crore+)? we need the best technique in the terms of execution time.

TCS,

9 12948

How to Split Strings with Regex in Managed C++ Applications?

Microsoft,

2476

Code for Method of Handling Factorials of Any Size?

1349




Code for Easily Using Hash Table?

1661

Code for Two Classes for Doing Gzip in Memory?

2097

Code for Small C++ Class to Transform Any Static Control into a Hyperlink Control?

Wipro,

1941

Write A C++ Program To Input A Number Between 20 To 99 And Display Its Numbername?

TCS,

3 10284

Given 1 to n distinct random number of which n+1th element was duplicated. How do find the duplicate element and explain the time complexity of the algorithm.

Microsoft, NetApp,

2383




Given 1 to n random number, find top 10 maximum numbers and explain the time complexity of the algorithm.

NetApp, IMO,

1 5156

Deriving time complexity of Binary tree and AVL tree, step by step.

NetApp,

4 12340

How reader and writer problem was implemented and come up with effective solution for reader and writer problem in case we have n readers and 1 writer.

Microsoft, NetApp,

6 14504

What is the time complexity T(n) of the following program? a) int n, d, i, j; cin >> n; for (d=1; d<=n; d++) for (i=1; i<=d; i++) for (j=1; j<=n; j += n/10) cout << d << " " << i << " " << j << endl; b) void main() { int n, s, t; cin >> n; for (s = 1; s <= n/4; s++) {t = s; while (t >= 1) { cout << s << " " << t << endl; t--; } } } c) void main() { int n, r, s, t; cin >> n; for (r = 2; r <= n; r = r * 2) for (s = 1; s <= n/4; s++) { t = s; while (t >= 1) { cout << s << " " << t << endl; t--; } } }

Infosys, IBM, CTS, Qatar University,

3 6724

Coin Problem You are given 9 gold coins that look identical. One is counterfeit and weighs a bit greater than the others, but the difference is very small that only a balance scale can tell it from the real one. You have a balance scale that costs 25 USD per weighing. Give an algorithm that finds the counterfeit coin with as little weighting as possible. Of primary importance is that your algorithm is correct; of secondary importance is that your algorithm truly uses the minimum number of weightings possible. HINT: THE BEST ALGORITHM USES ONLY 2 WEIGHINGS!!!

Qatar University, Motorola,

1 12736

Show by induction that 2n > n2, for all n > 4.

Qatar University, Karvy,

2 4777

Performance Algorithm A performs 10n2 basic operations and algorithm B performs 300 lg n basic operations. For what value of n does algorithm B start to show its better performance?

Qatar University, ASD Lab, UNV,

5686


Post New C++ Code Questions






Un-Answered Questions { C++ Code }

write a program that reverses the input number of n.Formulate an equation to come up with the answer.

6011


3. Program to find the Sum of give series. a. (1)+(1+2)+(1+2+3)+(1+2+3+4)+……………………………….. b. 1/1+1/9+1/25+1/49+……………...

3684


Implement a command console for changing settings on a particular object. The command console should allow you to enter a string and will return the response (very similar to a terminal session). The commands are as follows: SET propertyname=newvalue will change the target object’s member named “propertyname” to have a value equal to “newvalue”. If the input value is incompatible (i.e. an int being set to a string), print out an appropriate error message. GET propertyname will print out the current value of the target object’s member named “propertyname”. GET * will print out a list of all target object members and their current values. The system should be extensible for future commands and should accept an arbitrary object, such that another developer could insert another object into the system and rely on the command console to get and set the properties correctly.

2674


write a program that reads a series of strings and prints only those strings begging with letter "b"

1579


Code for Two Classes for Doing Gzip in Memory?

2097






write a program that creates a sequenced array of numbers starting with 1 and alternately add 1 and then 2 to create the text number in the series , as shown below. 1,33,4,6,7,9,............147,148,150 Then , using a binary search , searches the array 100 times using randomly generated targets in the range of 1 to 150

2527


write a program that can LOCATE and INSERT elements in array using c++ programming languages.

2759


Teta-Omeg-Big-Oh Show that f(n) = n2 + 3n3 is ;(n3).

2536


solve the problem in the programming language C++"if a five digit number is input through the keyboard.Write a program to calculate the sum of its digits(hint: use the modulus operator)

2177


write a program to perform generic sort in arrays?

1742


Code for Small C++ Class to Transform Any Static Control into a Hyperlink Control?

1941


write a function that reverse the elements of an array in place.The function must accept only one pointer value and return void.

3013


output for printf("printf");

1051


develop a program to calculate and print body mass index for 200 employees

1586


Given a table of the form: Product Sold on A 1/1/1980 B 1/1/1980 C 1/1/1980 A 1/1/1980 B 1/1/1980 C 2/1/1980 A 2/1/1980 There are 30 products and 10,000 records of such type. Also the month period during which sales happened is given to u. Write the program to display the result as: Product Month No. of copies A January 12 A February 15 A March 27 B January 54 B February 15 B March 10 C January 37

1278