C++ Code Interview Questions
Questions Answers Views Company eMail

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

Jomo Kenyatta University,

2364

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)

2930

write a program using 2 D that searches a number and display the number of items 12 inputs values input 15,20, 13, 30, 38, 40,16, 18, 20 ,18 ,20 enter no. to search : 20

3362

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

5531

readers and writers problem

Cognizant,

1 4608

What output does the following code generate? Why? What output does it generate if you make A::Foo() a pure virtual function? class A { A() { this->Foo(); } virtual void Foo() { cout << "A::Foo()" << endl; } }; class B : public A { B() { this->Foo(); } virtual void Foo() { cout << "A::Foo()" << endl; } }; int main(int, char**) { A objectA; B objectB; return 0; }

639

What output does this program generate as shown? Why? class A { A() { cout << "A::A()" << endl; } ~A() { cout << "A::~A()" << endl; throw "A::exception"; } }; class B { B() { cout << "B::B()" << endl; throw "B::exception"; } ~B() { cout << "B::~B()"; } }; int main(int, char**) { try { cout << "Entering try...catch block" << endl; A objectA; B objectB; cout << "Exiting try...catch block" << endl; } catch (char* ex) { cout << ex << endl; } return 0; }

575

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

546


Post New C++ Code Questions

Un-Answered Questions { C++ Code }

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

2396


How to swap two ASCII numbers?

2442


We need to write the function to check the password entered is correct or not based on the following conditions.. a) It must have atleast one lower case character and one digit. b)It must not have any Upper case characters and any special characters c) length should be b/w 5-12. d) It should not have any same immediate patterns like abcanan1 : not acceptable coz of an an pattern abc11se: not acceptable, coz of pattern 11 123sd123 : acceptable, as not immediate pattern adfasdsdf : not acceptable, as no digits Aasdfasd12: not acceptable, as have uppercase character

3949


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+……………...

4349


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

3120






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.

3393


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

2002


i really need help about this.. write a program to display the set of odd and even numbers separately. find the highest and lowest value of the given numbers.

1963


how to take time as input in the format (12:02:13) from user so that controls remains between these columns?

1813


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

5531


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)

2930


Write a program that print in screen a tree with its height taken from user by entering number of 4 digits and find the odd numbers then calculate the sum of odd numbers so he get the height of tree?

2909


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?

7333


Code for Easily Using Hash Table?

2385


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

4300