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 17201

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

Microsoft,

3101

Code for Method of Handling Factorials of Any Size?

1995

Code for Easily Using Hash Table?

2381

Code for Two Classes for Doing Gzip in Memory?

2801

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

Wipro,

2549

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

TCS,

3 12472

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,

3018

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

IMO, NetApp,

1 6533

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

NetApp,

4 14667

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 18051

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--; } } }

CTS, IBM, Infosys, Qatar University,

3 8973

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!!!

Motorola, Qatar University,

1 14790

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

Karvy, Qatar University,

2 6420

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?

ASD Lab, Qatar University, UNV,

7322


Post New C++ Code Questions

Un-Answered Questions { C++ Code }

Code for Easily Using Hash Table?

2381


find level of following tree (state, parent) " J,D I,D H,C E,B F,B G,C B,A D,A C,A A,& K,E L,E L,F M,F N,G O,H P,I P,H Q,I R,J S,K U,P T,L

1994


write a program to perform generic sort in arrays?

2610


Create a program to read two random data set in two files named data1.txt and data2.txt manifold contains integer numbers, whereas data2.txt file contains the float type numbers. Simpanlahmasing each into 2 pieces of data that is an array of type integer array and an array of type float, then calculate the average numbers in the second array.

2136


write a program to calculate the amount of investment after a period n years if the principal investors was p and interest is calculated using compound interest,formular=a=p(1+r)^n

2358






Question 1: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date. *This Should Be Done IN C++

543


write a program that prompt the user to enter his height and weight,then calculate the body mass index and show the algorithm used

4294


how to write a program that opens a file and display in reverse order?

2557


output for printf("printf");

1972


How can I Draw an ellipse in 3d space and color it by using graph3d?

2122


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?

7322


A suduco given & u hv 2 check if it is incomplete(blanks left),or correct or incorrect

2392


Write a simple encryption program using string function which apply the substitution method.

5527


1+1/2!+1/3!+...+1/n!

1935


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 total number of disk writes by MySQL.

2058