Other C++ Code Interview Questions 

Question 
Asked @ 
Answers 

Write a program using one dimensional array that accept five
values from the keyboard. Then it should also accept a
number to search. This number is to be searched if it among
the five input values. If it is found, display the message
“Search number is found!” otherwise, display “Search is lost”.
Example:
Enter 5 numbers: 10 15 20 7 8
Enter number to search: 7
Search number is found!


2 
Write a program to enter 10 number of integer entries into
an array n and then odds up all the odd entries. the program
then displays the result.
plssss answer assss fast asss u can... 

1 
#include<iostream.h>
//main()
//{
class A
{
friend class B;
public:
void read();
};
class B
{
public :
int a,b;
};
void A::read()
{
cout<<"welcome";
}
main()
{
A x;
B y;
y.read();
}
In the above program......,
as B is a friend of A B can have access to all members,i
cant access y.read .
could you please tell me the reason and what would i code
to execute this program? 

2 
A string of charaters were given. Find the highest
occurance of a character and display that character.
eg.: INPUT: AEGBCNAVNEETGUPTAEDAGPE
OUTPUT: E


1 
write a program to calculate the radius for a quadratic
equation use modular programming(function abitraction)hint
use quadratic function 
JomoKenyattaUniversity 
1 
can we declare an object of a class in another class?(assume
both class as public classes) 
Microsoft 
1 
write a proram using exceptional handling create a error &
display the message "THERE IS AN ERROR?... PLEASE RECTIFY"? 

1 
hello friends, given an expression we have to remove the
unwanted brackets in that expression.
Eg : (a+b) > a+b
(a+b)*(c)> (a+b)*c. Please mail me if you know
the logic. My mail id is : saravana6m@gmail.com.
Thank you in advance :) 
Microsoft 
1 
write a function oriented program that generates the
Fibonacci, the current numbers of n(as input) and display
them (series). In Fibonacci, the current third number is the
sum of the previous number. 

2 
Counting in Lojban, an artificial language developed over
the last fourty years, is easier than in most languages
The numbers from zero to nine are:
0 no
1 pa
2 re
3 ci
4 vo
5 mk
6 xa
7 ze
8 bi
9 so
Larger numbers are created by gluing the digit togather.
For Examle 123 is pareci
Write a program that reads in a lojban string(representing
a no less than or equal to 1,000,000) and output it in
numbers.


4 
Complexity T(n)
Write a lineartime algorithm that sorts n distinct
integers, each of which is between 1 and 500.
Hint: Use a 500element array. (Lineartime means your
algorithm runs in time c*n + b, where c and b are any
constants that do not depend on n.
For example, your algorithm can run in time n, or time 2n +
1, or time 5n + 10, or time 100n + 6, but not time c*n*n =
c*n?.) 
QatarUniversity 
1 
Find the maximum product of three numbers in an array?
Eg. 9,5,1,2,3
Max product= 9*5*3= 135
The array can hav negative numbers also.. 
CTS 
6 

For more C++ Code Interview Questions Click Here 