281 / 348

You have a job in which you have to take time stamps and store them. So Write a data structure that can minimize the storage requirements of Year, Month, Date, Hour, Minute.

Input : NA

Output : NA

|  Basics | | | |  Fresher
` `No Discussion on this question yet!``

Tags:Virtusa

282 / 348

Write a program to find the four digit numbers, which are perfect squares, and all the digits in that number are even.

Input : NA

Output : NA

|  Strings | | | |  Fresher
``` ```
<p>#include <stdio.h><br />#include <string.h><br />int main(){<br />  int x,y=4,z,k;<br /> for(x=1;x<=9;x  )<br /> {<br />   if(x%2==0){<br />  z=11*(100*x y);<br />  printf("%d ",z);<br />}<br /> }<br /> return 0;<br />}</p>
``````

Tags:Virtusa

283 / 348

Start from a random number, generate a sequence such that if number is odd multiply it 3 and add 1. If number is even, divide the number by 2. This Sequence will always cyclic with 4, 2, 1. In this sequence, find the maximum power of 2 generated in the sequence and print only the power, not the sequence.

Input : NA

Output : NA

|  Hashing | | | |  Fresher
` `No Discussion on this question yet!``

Tags:Virtusa

284 / 348

Start with a random 2 digit number, The series is generated by multiplying the number by 2 and placing the last 2 digits as the next number. Series continues until one of the element repeats.

Input : NA

Output : NA

|  Hashing | | | |  Fresher
` `No Discussion on this question yet!``

Tags:Virtusa

285 / 348

Write a program to print all the four digit numbers whose squares must have all the even digits.

Input : NA

Output : NA

|  Basics | | | |  Fresher
``` ```
<p>#include <stdio.h><br />#include <math.h><br />int main()<br />{<br />   printf("the numbers are:\n");<br />   for(int num=1000;num<=9999;num  )<br />   {<br />    int nroot=(int) sqrt(num);<br />    if(num==nroot*nroot)<br />    {<br />     int upper=num/100;<br />     int uroot=sqrt(upper);<br />     if(upper==uroot*uroot)<br />     {<br />     int lower=num0;<br />     int lroot=sqrt(lower);<br />     if(lower==lroot*lroot)<br />        printf("%d\n",num);<br />     }<br />    }<br />   }<br />}</p>
``````

Tags:Virtusa

286 / 348

Write a program to print the pyramid up to the passed integer value. 1 2 3 4 5 6 7 8 9 10 11 12 13 . . If we pass the value 13 it should print like the above (no need to print the 3 dots)

Input : NA

Output : NA

|  Basics | | | |  Fresher
` `No Discussion on this question yet!``

Tags:Virtusa

287 / 348

Write a function which takes one string S, one character X, one more Character Y, which should return the longest substring in the String S, which starts with the X and ends with Y?

Input : NA

Output : NA

|  Strings | | | |  Fresher
` `No Discussion on this question yet!``

Tags:Virtusa

288 / 348

Write a program to accept two time stamps in the given format HH:MM:SS using apropriate datatypes and find the difference between the time stamps in seconds.

Input : NA

Output : NA

|  Basics | | | |  Fresher
` `No Discussion on this question yet!``

Tags:Virtusa

289 / 348

Write a function to accept a number 'n' and a)if n is negative then return -1. b)if n is positive and perfect number then return sqrt(n). c)if n is positive and not a perfect no. then return n(n+1)/2

Input : NA

Output : NA

|  Basics | | | |  Fresher
` `No Discussion on this question yet!``

Tags:Virtusa

290 / 348

Write a program to print in the format 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5

Input : NA

Output : NA

|  Basics | | | |  Fresher
``` ```