-->



Virtusa Placement Paper



1. Print pyramid given as follows
1
2 3
4 5 6
7 8 9 10
11 12 13 ...
The three dots are given as a part of the specification. The above pyramid is to be printed When input number 13 is given.
Write a program to print the above pyramid.
2.Write a function which returns a substring in the string 'Sigma' (character given)which starts with 'Alpha' and ends with 'Thita' 3.You have a job in which you have to take time stamps and store them. So Write a datastructure that can minimize the storage requirements of Year,Month,Date,Hour,Minuite.
4.Write a program to find the four digited numbers, which are perfect squares, and all the digits in that number are even.


Q. 100,100,102,106,112,120, ____

Q. which is greater ?
Product of all Bradman's first class scores or Sum of all test scores of Sachin.

Q. you are provided with 500ml and 300ml jar(it has no markings).
a) you have to measure exactly 100ml.
b) you have to measure exactly 200ml.

Q. Using four 4's you have to make 1 ... 10.
3 = ( 4 + 4 + 4 ) / 4
4 = ( 4 - 4 ) * 4 + 4
5 = ( 4 * 4 + 4 ) / 4
6 = 4 + ( 4 + 4 )/4 // 4 + 2
7 = ( 4 + 4 ) - ( 4 / 4 )
8 = ( 4 + 4 ) * ( 4 / 4 )
9 = ( 4 + 4 ) + ( 4 / 4 )
10 = ( 44 - 4 ) / 4

Q. student,canopy,thirst,.. are the words given.
you have to group the words using the following words
1)Master
2)Teacher
3)Deft


Q. you have to cut a Pizza using 7 straight lines(with out rearranging) and you have to obtain maximum number of pieces.
Q. you have to cut a Cylindrical cake of diameter 32 cm and height 20 cm in to 12 equal pieces.

Q. In a village there are 2 groups.

1) Knight -> always tells true
2) Knave -> always tells false
Mr.X met a man of that village(you don't know which group he belongs to) and questioned "Tell me whether you are a knight
or knave ?"
Reply: "i cannot tell you and left that place"

Find which group that man belongs to?


Q. Obtain 277 from 3,25,50,65,100.use 4 arithmetic operations only.


Q. CODE is encoded as DGBF
READ is encoded as JHNV
Find "KOVAI"


Q. a) Function is given. What it does, Error in the code and way to resolve the issue.
double What( double z, int y)
{
double answer;
while( y > 0 )
{
if( y%2 == 1)
answer = answer * z;
y=y/2;
z=z*z;
}
return answer;
}


b) Write a program to print all Armstrong numbers,
(abc=a^3+b^3+c^3)
(for eg. 153=1^3+5^3+3^3)
c) Write a function with the following conditions,
1)It should have one integer parameter.
2)If the value passed is -ve, return -1.
3)If the value passed is a perfect square, return root of that number.
4)If the value passed is a not a perfect square, return that number itself.