Other C++ Code Interview Questions 

Question 
Asked @ 
Answers 

Write a program that takes a 3 digit number n and finds out
whether the number 2^n + 1 is prime, or if it is not prime
find out its factors. 
TCS 
2 
main(){int a=5,b 10,c=2, d;a=b c;d=++a=(c)*2;
printf("%d%d%d%d,a,b,c,d; return o;} 

1 
Perform the functionality of 2D array through 1D array
and in it the functions to be performed were:
(1) Display the array in 2D format
(2) Display a particular element
(3) Display a particular row
(4) Display a particular column

Nagarro 
1 
Wrie a function which returns the most frequent number in a
list of integers. Handle the case of more than one number
which meets this criterion.
public static int[] GetFrequency(int[] list)

Nagarro 
3 
A Binary no. is given, we hav to find it's decimal
equivalent. 
Microsoft 
2 
swap prog 
TCS 
3 
write a c program, using for loop, that accepts and odds two
numbers. The output must be the sum and the addens. This
should be repeated 5 times while the first number is
decremented by one and the second number is incremented by 1.

IBM 
2 
Subsets
Write an algorithm that prints out all the subsets of 3
elements of a set of n elements. The elements of the set are
stored in a list that is the input to the algorithm. (Since
it is a set, you may assume all elements in the list are
distinct.) 
QatarUniversity 
1 
program to find the magic square using array 

1 
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.

NetApp 
5 
. Remove all the blank spaces between
character.Matrix is of 10* 10.
eg: INPUT

 N  A   V  T

 G  U  P 

T    A  

OUTPUT:

 N  A  V  T  

G U  P   

T  A    


Nagarro 
2 
1. Write a program that performs the following. The user
inputs a number and then enters a series of numbers
from 1 to that number. Your program should determine
which number (or numbers) is missing or duplicated in
the series, if any. For example, if the user entered
5 as the initial number and then entered the
following sequences, the results should be as shown.
Input Sequence Output
 
1 2 3 4 5 Nothing bad
However, if 7 were the high number, the user
would see the results on the right for the following
number entries:
Input Sequence Output
 
1 3 2 4 5 Missing 6
Missing 7
And if 10 were the high number and the user
entered the numbers shown on the left, note the list
of missing and duplicate numbers:
Input Sequence Output
 
1 2 4 7 4 4 5 10 8 2 6 Duplicate 2 ( 2 times)
Missing 3
Duplicate 4 ( 3 times )
Missing 9


1 

For more C++ Code Interview Questions Click Here 