Search This Blog

Sunday 31 March 2019

Skill Rack Daily MCQ Answer & Solution - 01/04/2019

Skill Rack
Daily MCQ Answer & Solution
Date : 01/04/2019


REFID: 29277

Introducing a woman, Manohar said, "Her mother is the wife of my father's brother". How the woman is related to the father of Manohar?

Answer  :  SISTER

Skill Rack Daily Challenge Solution - 01/04/2019

Skill Rack
Daily Challenge Solution
Date : 01/04/2019




ProgramID- 7786

Sum of Rows - Matrix


The program must accept an integer matrix of size MxN as the input. For each row in the matrix, the program must print all the integers in the row along with their sum as the output.

Boundary Condition(s):

1 <= M, N <= 50
1 <= Each Integer Value <= 999

Input Format:
The first line contains the integers M and N separated by a space.
The next M lines each contain N integers separated by space(s).

Output Format:
The first M lines each contain N+1 integers separated by a space.

Example Input/Output 1:

Input:
3 4
1 2 3 7
4 5 6 1
7 8 9 3

Output:
1 2 3 7 13
4 5 6 1 16
7 8 9 3 27

Explanation:
The sum of integers in the first row is 13 (1 + 2 + 3 + 7).
The sum of integers in the second row is 16 (4 + 5 + 6 + 1).
The sum of integers in the third row is 27 (7 + 8 + 9 + 3).
Hence the output is
1 2 3 7 13
4 5 6 1 16
7 8 9 3 27

Example Input/Output 2:

Input:
5 7
41 46 42 44 28 40 27
14 29 14 1 19 12 24
42 45 15 36 23 20 39
19 46 24 17 1 40 24
36 35 23 10 44 43 40

Output:
41 46 42 44 28 40 27 268
14 29 14 1 19 12 24 113
42 45 15 36 23 20 39 220
19 46 24 17 1 40 24 171
36 35 23 10 44 43 40 231


Solution :


---------------------------------------------------------------------------------

#include<stdio.h>
#include <stdlib.h>

int main()
{
    int a[50][50],m,n,sum=0,i,j;
    scanf("%d %d",&m,&n);
    for(i=0;i<m;i++)
    {
        for(j=0;j<n;j++)
        {
            scanf("%d",&a[i][j]);
            printf("%d ",a[i][j]);
            sum+=a[i][j];
        }
        printf("%d\n",sum);
        sum=0;
    }
    return 0;
}


---------------------------------------------------------------------------------



Saturday 30 March 2019

Skill Rack Daily MCQ Answer and Solution - 30/03/2019

Skill Rack

Daily MCQ Answer and Solution

Date : 30/03/2019

REFID: 40460

A man walked at a speed of 4 km/h from point A to B and came back from point B to A at the speed of 6 km/h. What would be the ratio of the time taken by the man in walking from point A to B to that from point B to A?

Answer : 3:2

Solution :

Required ratio = 6 : 4 = 3 : 2 as time taken is inversely proportional to the speed.

Friday 29 March 2019

Skill Rack Daily MCQ Answer and Solution - 29/03/2019

Skill Rack
Daily MCQ Answer and Solution
Date : 29/03/2019


REFID-70975


A man bought three shirts (each shirt costs the same price) from a shop and gave Rs.2000. He got Rs.200 as the balance. What was the price of 1 shirt?

Answer : Rs.600


Solution:
         2000-200 = 1800
         3 shirts
          1800/3 = 600
     The price of 1 shirt is Rs.600

Thursday 28 March 2019

Skill Rack Daily Challenge Solution - 29/03/2019

Skill Rack
Daily Challenge Solution
Date : 29/03/2019



ProgramID- 8452

Stabilize Voltage


The program must accept two integers X representing the voltage supplied from a socket and Y representing the voltage required by a television. The television can stabilize voltage variations of plus or minus 50 units. The program must print yes if the television can work if plugged into the socket. Else the program must print no as the output.

Boundary Condition(s):
50 <= X, Y <= 1000

Input Format:
The first line contains X and Y separated by space.

Output Format:
The first line contains yes or no.

Example Input/Output 1:
Input:
220 260

Output:
yes

Explanation:
The voltage supplied from the socket is 40 less than the required voltage (260) which can be stabilized by the television.
So yes is printed as the output.

Example Input/Output 2:
Input:
150 205

Output:
no

Solution:

-------------------------------------------------------------------------------------------------------------

#include<stdio.h>
#include <stdlib.h>

int main()
{
    int x,y;
    scanf("%d %d",&x,&y);
    (x>y)?(x=x-y):(x=y-x);
    if(x<=50)
    {
        printf("yes");
    }
    else
    {
        printf("no");
    }
return 0;
}
-------------------------------------------------------------------------------------------------------------

Wednesday 27 March 2019

Skill Rack Daily MCQ Answer and Solution - 28/03/2019

Skill Rack
Daily MCQ Answer and Solution
Date : 28/03/2019




REFID: 23448


A positive number when decreased by 2 is equal to 15 times the reciprocal of the number. The number is



Answer : 5



Solution :
suppose the positive number is n.

 hence,

      n-2= 15/n 

      n^2 -2n -15 = 0

     (n-5)(n+3) = 0

      n = 5 (n is positive number)

Skill Rack Daily Challenge Solution - 28/03/2019

Skill Rack

Daily Challenge Solution

Date : 28/03/2019

ProgramID- 8451


Counter from String

The program must accept a string S as the input. The program must maintain a counter which starts from 0 based on the characters in the string. The program must traverse the string and manipulate the counter based on the following conditions.
If the character is I (i.e. uppercase i) the program must increment the counter by 1.
If the character is D the program must decrement the counter by 1.
If the character is R the program must Reset the counter to 0.
Finally, the program must print the value of the counter.

Boundary Condition(s):
1 <= Length of String <= 1000

Input Format:
The first line contains S.

Output Format:
The first line contains the final counter value.

Example Input/Output 1:
Input:
DRIDD

Output:
-1

Explanation:
Counter starts from 0.
For the character D the counter is decremented by 1. So the counter becomes -1.
For the character R the counter is reset to 0.
For the character I the counter is incremented by 1. So the counter becomes 1.
For the character D the counter is decremented by 1. So the counter becomes 0.
For the character D the counter is decremented by 1. So the counter becomes -1.

Example Input/Output 2:
Input:
RDRIDRDIII

Output:
2

Solution:

------------------------------------------------------------------------------------------------------------------------------------------------------------------
#include<stdio.h>
#include <stdlib.h>
int main()
{
    char a[1000];
    int i,n=0;
    scanf("%s",a);
    for(i=0;a[i]!=NULL;i++)
    {
        if(a[i]=='I')
        {
            n++;
        }
        else if(a[i]=='D')
        {
            n--;
        }
        else if(a[i]=='R')
        {
            n=0;
        }
    }
    printf("%d",n);
    return 0;
}


----------------------------------------------------------------------------------------------------------------------------------------------------------------------

Skillrack Daily MCQ Answer- 27/03/2019

Skill Rack

Daily MCQ Answer

Date : 27/03/2019

*************************************************

In how many ways can 1200 be expressed as a product of two co primes?

Answer : 4

Solution:

Prime factors of 1200 = 2*2*2*2*3*5*5

= 2⁴ × 3¹ × 5²

The number of factors of ways writing a number N as a product of two co-primes = 2ⁿ⁻¹ , where N = the number of prime factors of a number.

Number of prime factors of 1200 are 2, 3 and 5

So, total number of prime factors of 1200 = 3

Therefore, total number of ways of writing 1200 as a product of 2 co-primes

= 2ⁿ⁻¹

= 2³⁻¹

= 2²

= 4

So, 1200 can be written in 4 ways as a product of two co-primes.

SkillRack Daily Challenge Solution - 27/03/2019


Skill Rack

Daily Challenge Solution

Date : 27/03/2019




Program ID- 8450


String Pattern - Alphabet Position                                                                               

      The program must accept a string S as the input. The program must print the desired pattern as shown in the Example Input/Output section.
Note: All the alphabets in S are only in lower case.

Boundary Condition(s):
1 <= Length of S <= 1000

Input Format:
The first line contains the string S.

Output Format:
The list of lines containing the desired pattern as shown in the Example Input/Output section.

Example Input/Output 1
Input:
abcdacg
Output:
a
bb
ccc
dddd
a
ccc
ggggggg

Example Input/Output 2:
Input:
skillrack
Output:
sssssssssssssssssss
kkkkkkkkkkk
iiiiiiiii
llllllllllll
llllllllllll
rrrrrrrrrrrrrrrrrr
a
ccc
kkkkkkkkkkk

Solution:
*******************************************************************************
#include <stdio.h>
int main()
{
    char s[1000],a[26];
    int i,j,k,l=0;
    scanf("%s",s);
    for(i='a';i<='z';i++)
    {
        a[l]=i;
        l++;
    }
    for(i=0;s[i]!=NULL;i++)
    {
        for(j=0;j<26;j++)
        {
            if(s[i]==a[j])
            {
                for(k=0;k<=j;k++)
                {
                    printf("%c",s[i]);
                }
            }
        }
        printf("\n");
    }
    return 0;
}

******************************************************************************