Professional Documents
Culture Documents
DXC5
DXC5
Test Summary
No. of Sections: 6
No. of Questions: 62
Total Duration: 100 min
Section 1 - Quants
Section Summary
No. of Questions: 16
Duration: 18 min
Additional Instructions:
None
Q1. A train of 24 carriages, each carriage of 60 metres length,with engine of 60 metres length, is running at a speed of 60 km per hour.
Find out the time in which the train will cross the bridge measuring 1(1/2) km in length
2 minutes
2 1/2 minutes
3 1/2 minutes
3 minutes
Q2. A plane left 30 minutes later than the scheduled time and in order to reach its destination 1,500 km away in time it has to increase
its speed by 250 km/hr from its usual speed. Find its usual speed in m/sec
202 m/sec
208 m/sec
350 m/sec
326 m/sec
Q3. A and B working separately can nish a work in 8 and 12 days respectively. If they work for a day alternately (beginning with A),
then in how many days will the work be completed?
9 days
9.5 days
10 days
9.8 days
Q4.
/
In a 20-liter solution of water and milk, the percentage of pure milk is 50%. How many liters of pure milk is required to increase the
percentage of pure milk to 80%?
20 litres
30 litres
40 litres
50 litres
Q5. A’s salary is rst increased by 25% and then decreased by 20%. The result is the same as B’s salary increased by 20% and then
reduced by 25%. Find the ratio of B’s salary to that of A’s?
4:3
11 : 10
10 : 9
12 : 11
Q6. Four men and three women are to be seated in a row so that the women occupy the even places. How many such arrangements
are possible?
7!
144
30
6!
Q7. Find the number of triangles formed by joining 12 different points on a plane, no three of them being collinear ( with the exception
of 4 points which are collinear).
126
216
220
222
Q8. In how many ways a team of 11 must be selected a team 5 men and 11 women such that the team must comprise of not more
than 3 men
/
1565
2256
2456
1243
Q9. If A and B be two mutually exclusive events in a sample space such that, P (A) = 2/5 and P(B) = ½, then nd P(AUB).
7/16
9/16
9/10
1/2
Q10. A box contains 10 balls numbered 1 through 10. Anuj, Anisha and Amit pick a ball each, one after the other, each time replacing the
ball. What is the probability that Anuj picks a ball numbered less than that picked by Anisha, who in turn picks a lesser number than
amit.
3/25
4/25
81/400
1/6
10
Q12. A sum of money at compound interest doubles itself in 1 year. In how many years will it amount to eight times itself?
8 years
16 years
/
10 years
3 years
Q13. On what sum will the difference between the simple and compound interest for 3 years at 5% per annum amount to Rs.12.20?
Rs.1200
Rs.1500
Rs.1600
Rs.2000
Q14. There were 42 students in a hostel. Due to the admission of 13 new students, the expenses of the mess increase by Rs.31 per day
while the average expenditure per head diminished by Rs.3. What was the original expenditure of the mess?
Rs.633.23
Rs.583.3
Rs.623.3
None of these
Q15. A bath can be lled by the cold water pipe in 10 min and by the hot water pipe in 15 min. A person leaves the bath room after
turning on both pipes simultaneously and returns at the moment when the bath should be full. Finding, however, that the waste pipe
has been open, he now closes it. In 4 minutes more the bath is full. In what time would the waste pipe empty it?
6 min
9 min
10 min
12 min
Q16. A shopkeeper makes a pro t of 20% on every kilogram of rice sold at the rate of Rs.36 per kg. The selling price is reduced in such a
way that he gets a pro t of Rs.2 per kg. By what percent must his sales increase so that his pro t remains the same as before?
220%
200%
150%
175%
/
Section 2 - Logical
Section Summary
No. of Questions: 14
Duration: 15 min
Additional Instructions:
None
OFT
LET
OEK
OET
Monday
Tuesday
Wednesday
Saturday
Q3. Following problem consists of a question and three statements I, II and III given below it. Read all the statements carefully and
seek all possible combinations which could be suf cient for answering a question.
I and II only
Q4. Andrew on his death bed keeps half his property for his wife and divides the rest equally among his three sons Ben, Carl and Dave.
Some years later Ben dies leaving half his property to his widow and half to his brothers Carl and Dave together, shared equally.
When Carl makes his will he keeps half his property for his widow and the rest he bequeaths to his younger brother Dave. When
Dave dies some years later, he keeps half his property for his widow and the remaining for his mother. The mother now has
Rs.1,575,000. What was the ratio of the property owned by the widows of the three sons, in the end?
/
8:10:18
8:10:15
8:18:20
8:12:15
Q5. In each of the following questions one term is missing as shown by a (?). The term to ll in the blank is given as one of the
alternatives among the four given after each question.
51
34
37
84
Q6. Each question has a set of four deductions. Each deduction three statements. Choose the alternative where the third statement
can be logically deduced using both the preceding two, but not just one of them.
(A) All students in my class are intelligent. Rohit is not intelligent. Rohit is not a student of my class.
(B) All plants are trees. No tree is green. Those plants that are not trees are green.
(C) Some sticks are bolts. Kites are sticks. Some kites are bolts.
(D) No magazine is a cap. All caps are cameras. Some cameras are not magazines.
A and D
B and C
B only
C and B
Q7. B is to the South-West of A, C is to the East of B and South-East of A and D is to the North of C in line with B and A. In which
direction of A is D located?
North
South
South-East
North-East
Q8. Each of the questions below has a few statements, followed by four conclusions numbered 1, 2, 3 and 4. You have to consider
every given statements as true, even if it does not conform to the well known facts. Read the conclusions and then decide which of
the conclusions can be logically derived.
Statements: Some books are papers. Some papers are plastics. No plastic is black.
Conclusions:
/
1. Some papers are not black.
2. All papers are not black.
3. Some papers are black.
4. Some books are black
Either 1 or 3 follows
Only 1, 3, 4 follows
Q9. For how many times, the minute hand of a clock will be opposite to the hour hand from 3:00 p.m on Friday to 11:00 a.m on the
subsequent Sunday?
41
40
42
43
Q10. There is a certain relation between two given words on one side of :: and one word is given on another side of :: while another word
is to be found from the given alternatives, having the same relation with this word as the given pair has. Select the best alternative.
Bark
Puppy
Bitch
Colt
Q11. Find out the gure which does not belong to the group i.e., which does not share the common features/characteristics with, the
other four gures.
/
Common Content:
The following graph shows the total sales (in million dollars) of three multinational companies A, B and C in four different countries. Refer
to the graph to answer the questions that follow.
Sales Performance of companies A, B, C in different countries
Q12. In which country does B exhibit the maximum value of its sales expressed as a percentage of total
sales of the three companies?
India
Srilanka
Nepal
China
Common Content:
Read the information given below and answer the questions that follow.
1. Eleven students Anwar, Baham, Chetan, Dayal, Eshwar, Farooq, Gajendra, Hariom, Inayat, Jatin and Kishore are sitting on a bench in a
lecture room facing towards the teacher.
2. Dayal is towards the left of Farooq and second to the right of Chetan.
3. Eshwar is second to the left of Anwar and is sitting on one end.
4. Jatin is the neighbourer of Anwar and Baham and is third to the left of Gajendra.
5. Hariom is next to left of Dayal and is third to the right of Inayat
1 and 3 only
1 only
3 only
Q14. Which group of students is sitting just next to the right of Gajendra?
/
Chetan, Hariom, Dayal, Eshwar
Section 3 - Verbal
Section Summary
No. of Questions: 12
Duration: 12 min
Additional Instructions:
None
Q1. Select the word or phrase which best expresses the meaning of the given word. : WRETCHED
Poor
Foolish
Insane
Strained
Q2. Select the word or phrase which best expresses the meaning of the word typed in bold. :
verbose
involved
lucid
witty
Q3. Select the option that is most nearly OPPOSITE in meaning to the given word . :
lively
argumentative
loud
/
curious
pledge
question
coach
commit
strikingly
silently
incredibly
incredulously
Q6. In the question, there is a sentence of which some parts have been jumbled up. Re-arrange these parts which are labelled P, Q, R
and S to produce the correct sentence. Choose the proper sequence. :
It is easy to excuse
P: but it is hard
Q: in a boy of fourteen
R: the mischief of early childhood
S: to tolerate even unavoidable faults
RPQS
QRSP
QRPS
RPSQ
Q7. The sentence is divided into parts A,B,C and D. Identify the part with error. If there is no error, mark the answer as D.
(A) The meeting adjourned abruptly/(B) by the CEO after/(C) about three hours of deliberation./(D) No error
C
/
D
Q8. In the question a part of the sentence is italicised. Alternatives to the italicised part is given which may improve the construction
of the sentence. Select the correct alternative:
got ned
ned
was to be ned
No improvement needed
Q9. Select the option that is most nearly OPPOSITE in meaning to the given word . : DISPARITY (OPPOSITE)
timidity
bigotry
likeness
in uence
Common Content:
Courage is not only the basis of virtue; it is its expression. faith, hope, charity and all the rest don't become virtues until it takes courage to
exercise them. There are roughly two types of courage. The rst an emotional state which urges a man to risk injury or death, is physical
courage. The second, more reasoning attitude which enables him to take coolly his career, happiness, his whole future or his judgement of
what he thinks either right or worthwhile, is moral courage.
I have known many men, who had marked physical courage, but lacked moral courage. Some of them were in high places, but they failed to
be great in themselves because they lacked moral courage. On the other hand I have seen men who undoubtedly possessed moral courage
but were very cautious about taking physical risks. But I have never met a man with moral courage who couldn't, when it was really
necessary, face a situation boldly.
Cunning
Intelligent
Curious
Careful
overall diffulties
/
face a situation boldly
be very pragmatic
faith
charity
courage
hope
Section 4 - Essay
Section Summary
No. of Questions: 1
Duration: 20 min
Additional Instructions:
None
Directions
Follow the common grammatical rules, punctuation according to standard English.
Keywords
Section Summary
No. of Questions: 12
Duration: 15 min
Additional Instructions:
None
/
3.75
Depends on compiler
24
Syntax error
10
Varies
Q4. Suppose block hold either three records or ten-key pointer pairs. If a data le contains 90 distinct records, how many blocks do we
need to hold that data le a and its sparse index?
26
20
/
23
33
I. Lock_X(A), Lock_X(B), Lock_X(D), Unlock (D), Lock_X(F), Unlock (F), Unlock (B), Unlock (A)
II. Lock_X(A), Lock_X(E), Lock_X(H), Unlock (H), Unlock (E), Unlock (A)
III. Lock_X(B), Lock_X(F), Lock_X(E), Unlock (F), Unlock (E), Unlock (B)
Which of the following is the valid locking sequence for true based protocol?
II and III
I only
I and III
II only
Q6. There are 2 transaction T1 and T2, T1 has 5 transactions and T2 has 3 transaction. Find the number of concurrent schedules for the
given 2 transactions
15
25
54
56
Q8. Which multiple access technique is used by IEEE 802.11 standard for wireless LAN?
CDMA
/
CSMA/CA
ALOHA
None
Q9. How big is a 8 – way set associative cache made up of 32 bit words, 4 words per line and having 2048 sets ?
128 KB
256 KB
512 KB
1024 KB
P-1 Q-2 R-3 S-4
P-4 Q-3 R-1 S-2
P-4 Q-1 R-2 S-3
P-4 Q-3 R-2 S-1
Q11. The page fault service time in a demand paging system is 20 m.s. and memory access time is 200 n.s. If page fault is occurred for
every 106 references. The effective access time is _________ nano-second (approx)
220
224
228
230
Q12. Paging system uses TLB's and access time is 20 ns and memory access time is 150 ns. If the effective memory access time is 250
ns. What will be the hit ratio of TLB ?
40%
/
50%
98.2%
46%
Section Summary
No. of Questions: 7
Duration: 20 min
Additional Instructions:
None
Q1. Analyze the code and complete the missing code to print the zigzag pattern of array.
Input Format
Output Format
Corresponding pattern.
6 132546
1
2
3
Sample Input Sample Output
5 45231
5
4
3
Time Limit: - ms Memory Limit: - kb Code Size: - kb
Input Format
Output Format
1 1 is an Armstrong number
/
Input Format
Positive integer
Output Format
Corresponding output
Q4. A train of compartments are reserved only with the seat numbers like digits 4 and 7 such as 4, 7, 44, 47, 74,...... 44744,.. etc. Given a
ticket K, we need to nd K-th seat number in the train. The code is given below, ll the missing code such that it passes through all
the test cases.
Input Format
The rst line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an integer k.
Output Format
3 4
1 7
2 44
3
Sample Input Sample Output
5 4
1 44
3 74
5 444
Time Limit: - ms Memory Limit: - kb Code Size: - kb
Q5. Roy bought a new bike last Sunday. He needs to decide the number plate number now. Though he likes 0’s and 1’s most out of
number system, he wants his number plate to start with 1. Lets help him in nding out how many unique permutations start with 1
when he is given with N 0’s and M 1’s.
The code is given below. Complete the missing lines of code to execute the program.Try printing the answer modulo (109+7).
Input Format
Output Format
2
2 1
1 2
2 1
Sample Input Sample Output
2 1
1 1 6
2 3
Input Format
The rst line of input contains a single integer T, the number of test cases.
T lines follow, each line containing the integer X as stated above.
Output Format
For every X, print the output (2 x a) + b in a newline as stated in the problem statement.
2
2 3
2
10
Sample Input Sample Output
3 2
4 2
4 3
10
Time Limit: - ms Memory Limit: - kb Code Size: - kb
Q7. The seats are arranged in the lab in a rectangular fashion with m rows and n columns. The students are seated in the lab according
to their roll numbers in row wise order.
Given the roll number of a student, the code is given to nd whether the student is seated in the rst row or in the 1st or last
column. But the code has syntax errors. Debug the code without changing the logic.
Input Format
Output Format
5 yes
10
41
5 no
10
12
/
Answer Key & Solution
Section 1 - Quants
Q1
3 minutes
Solution
=3 minutes
Q2
208 m/sec
Solution
Q3
9.5 days
Solution
A=8=3
B = 12 = 2
A + B = 5 units/ 2 days
Q4
30 litres
Solution
10 + X = 4(20 + X)/5
So x = 30 litre
Q5
10 : 9
Solution
so x=0.9y
y/x=1/0.9=10/9
The ratio is 10 : 9
Q6
144
Solution
Each arrangement of the men may be associated with each arrangement of the women.
There are 3 even places women have to be seated 4 odd places men have to be seated
Q7
216
Solution
/
Number of triangles that can be formed if no three points are collinear = 12C3 = 220.
But since 4 points are collinear, we cannot form any triangle from these 4 points by joining any three of them where as we have taken 4C3
Q8
2256
Solution
Maximum 3 men can be played which means there can be 0, 1, 2, 3 men in the team.
(5C0×11C11)+(5C1×11C10)+(5C2×11C9)+(5C3×11C8)=2256
Q9
9/10
Solution
= 2/5 + 1/2 - 0
= 9/10
Q10
3/25
Solution
If 1 numbered ball picks up by Anuj then Anisha will picks up 2 or 3 or 4 or ..... or 10 = 9 ways.
like this,
9 numbered................................ = 1 way
So, number of ways that Anuj picks a ball numbered less than that picked by Anisha = 9+8+7+6+5+4+5+4+3+2+1 = 45 ways
Solution
So remainder is 0
Q12
3 years
Solution
Shortcut:
21/1 = 81/T
2 = 23(1/T)
T = 3 yrs
Q13
Rs.1600
Solution
/
Q14
Rs.633.23
Solution
Q15
9 min
Solution
In 1 minute the hot and cold water pipe can ll (1/10 + 1/15) or 1/6 of the bath. Therefore the bath should have been lled in 6 min. The
waste pipe is closed, and in 4 min more the bath is full. Hence, it is clear that during the rst 6 minutes the waste-pipe emptied as much
as the other two can to gather ll in.4 min i.e. 4/6 or 2/3 of the bath. Therefore, the waste pipe would empty the whole in (6 + 2/3) or 9
min. Ans.(2)
Q16
200%
Solution
Pro t is 20%.
If the pro t is decreased to Rs. 2 per kg, then he has to increase his sales by 3 times to get the same pro t. 3 times increase will
correspond to 200%
Section 2 - Logical
Q1
OET
Solution
First letter: C + 3 = F, F + 3 = I, I + 3 = L
Therefore, L + 3 = O
Second Letter: Y - 5 = T, T - 5 = O, O - 5 = J
Therefore, J - 5 = E
Third Letter: D + 4 = H, H + 4 = L, L + 4 = P
Therefore, P + 4 = T
/
Q2
Saturday
Solution
Q3
All I,II and III
Solution
From III we know Rabin's brother is eight years younger than Rabin.
Q4
8:10:15
Solution
Ben: x. It is divided as
Wife: x/2
Carl: x/4
Dave: x/4
Wife: 5x/8
Dave: 5x/8
Wife: 15x/16
Mother: 15x/16
= 8 : 10 : 15
/
Q5
51
Solution
Series proceeds with a difference of 3, 6, 12, 24, 48. Hence, the missing number will be 51.
Q6
A and D
Solution
Statement (I) and (IV) has a third statement which can be logically deduced from the preceding two statements.
Q7
North-East
Solution
Q8
Only 1 and either 2 or 3 follows
Solution
/
Q9
40
Solution
The exception time for the condition θ = 180° is 6 O' clock. From 3:00 p.m. on Friday to 3.00 p.m. on Saturday (i.e., exactly one day), it
occurs 22 times.
From 3:00 p.m. on Saturday to 3.00 a.m. on Sunday (i.e., exactly half day), it occurs 11 times. From 3:00 a.m. on Sunday to11:00 a.m. on
Sunday (i.e., exactly 8 hours), it occurs 7 times as there is the exception time i.e., 6:00 a.m. lies in between. Hence, both the hands will be
Q10
Puppy
Solution
'Farrow' is the young one of a 'Pig' in the same way 'Puppy' is the young one of a 'Dog'.
Q11
Solution
In all other gures, number of line segments in upper and lower gures are the same.
Q12. China
Solution
This can be clearly deduced from the line graph by comparing the relative heights of the
Solution
ii) C _ D F
v) I _ _ HD
By combining ii & v
I_CHDF ------> vi
/
By combining iv , v & vi
AJBIGCHDF --------->vii
E _ AJBIGCHDF
Eshwar Kishore Anwar Jatin Baham Inayat Gajendra Chetan Hariom Dayal Farooq..
Solution
ii) C _ D F
v) I _ _ HD
By combining ii & v
I_CHDF ------> vi
AJBIGCHDF --------->vii
E _ AJBIGCHDF
Eshwar Kishore Anwar Jatin Baham Inayat Gajendra Chetan Hariom Dayal Farooq.
Section 3 - Verbal
Q1
Poor
Solution
No Solution
Q2
lucid
Solution
/
Verbose : using or expressed in more words than are needed
Q3
lively
Solution
insipid means uninterested
Q4
commit
Solution
winners do not pledge or coach themselves to winning.Moreover , the preposition"to" collocates only with commit.The answer is commit.
Q5
incredulously
Solution
The word 'incredulously' (disbelievingly) is the most appropriate word for the given blank, The reaction to the collapse of the twin towers
was one of disbelief. The word 'Incredibly' is inappropriate as it doesn't collocate with the verb 'watch'. To 'watch incredibly' is inapt.
Q6
RPSQ
Solution
/
Q7
A
Solution
The singular verb in past tense, ‘was’, is missing before ‘adjourned’. ‘Adjourned’ means ‘put off’; it is used as a passive construction
Q8
No improvement needed
Solution
Q9
likeness
Solution
Disparity means a great difference or inequality. Timidity means lack of con dence. In uence is impact. Bigotry means partiality. Likeness
Q10. Careful
Solution
Solution
last line of paragraph makes 'face the situation boldly' is the answer
Q12. courage
Solution
Section 4 - Essay
Q1
Sample Essay
No Essay
Keywords
family, friends, touch, connected, pro le, information, new friends, social, internet, college students, addiction, concentration,
messenger, conversation, Ruined, insecurities, knowledge, education, Lazy, negative , Positive, in uence, network, friend requests,
boon, interest, phone, text, status updates , Security, Communication, Like, Share, Videos,
/
Section 5 - Programming MCQ
Q1
24
Solution
No Solution
Q2
1
Solution
No Solution
Q3
6
Solution
No Solution
Q4
33
Solution
In sparse index we need are pointer for each block of data le.
Q5
I and III
Solution
No Solution
Q6
54
Solution
Q7
Device that allows wireless device to connect to a wired network
/
Solution
No Solution
Q8
CSMA/CA
Solution
No Solution
Q9
256 KB
Solution
Q10
P-4 Q-1 R-2 S-3
Solution
Q11
220
Solution
Q12
46%
Solution
Input Output
20 13254769811010000000-182229775232728
1
2
3
/
Weightage - 40
Input Output
1514131112910785634141957062
15
15
1413
Weightage - 20
Input Output
12 132547698111012
1
2
3
Weightage - 20
Input Output
3 132
1
2
3
Weightage - 10
Input Output
12
2
1
2
Weightage - 10
6 132546
1
2
3
Sample Input Sample Output
5 45231
5
4
3
Solution
#include <stdio.h>
void swap(int *x, int *y)
{
int temp = *x;
*x = *y;
*y = temp;
}
void zig_zag_fashion(int arr[], int n)
{
int flag = 1;
for (int i=0; i<=n-2; i++)
/
{
{
if (flag)
{
if (arr[i] > arr[i+1])
swap(&arr[i], &arr[i+1]);
}
else
{
if (arr[i] < arr[i+1])
swap(&arr[i], &arr[i+1]);
}
flag = !flag;
}
}
int main()
{
int n;
//printf(“\nEnter the number of elements : ” );
scanf("%d", &n);
int arr[n], i;
//printf(“\nInput the array elements : “);
for(i=0; i<n; i++)
scanf("%d", &arr[i]);
//(“\nZigzag pattern of the array : “);
zig_zag_fashion(arr, n);
for (int i=0; i<n; i++)
printf("%d", arr[i]);
printf("\n");
return 0;
}
Q2
Test Case
Input Output
Weightage - 40
Input Output
Weightage - 20
Input Output
Weightage - 20
Input Output
/
3 3 is an Armstrong number
Weightage - 10
Input Output
9 9 is an Armstrong number
Weightage - 10
1 1 is an Armstrong number
Solution
#include <stdio.h>
#include <math.h>
int main()
{
int n1,num,r,res=0,n=0;
scanf("%d", &n1);
num = n1;
while (num != 0)
{
num /= 10;
++n;
}
num = n1;
while (num != 0)
{
r=num % 10;
res += pow(r, n);
num /= 10;
}
if(res==n1)
printf("%d is an Armstrong number \n", n1);
else
printf("%d is not an Armstrong number \n", n1);
return 0;
}
Q3
Test Case
Input Output
/
321123 321123 is a palindrome.
Weightage - 40
Input Output
Weightage - 20
Input Output
52225 is a palindrome.
52225
Weightage - 20
Input Output
20 20 is not a palindrome.
Weightage - 10
Input Output
Weightage - 10
Solution
#include <stdio.h>
int main()
{
int n, reversedInteger = 0, remainder, originalInteger;
//printf("Enter an integer: ");
scanf("%d", &n);
originalInteger = n;
/
// reversed integer is stored in variable
while( n!=0 )
{
remainder = n%10;
reversedInteger = reversedInteger*10 + remainder;
n /= 10;
}
// palindrome if orignalInteger and reversedInteger are equal
if (originalInteger == reversedInteger)
printf("%d is a palindrome.", originalInteger);
else
printf("%d is not a palindrome.", originalInteger);
return 0;
}
Q4 Test Case
Input Output
4
12 7
1 44
2 47
Weightage - 40
Input Output
9 44
3 77
6 474
9 7
Weightage - 20
Input Output
7 477
10 777
14 4444
15 4447
Weightage - 20
Input Output
0
4 4
0 7
1 44
Weightage - 10
Input Output
3 7
2 47
4 77
6
Weightage - 10
3 4
1 7
2 44
3
Sample Input Sample Output
5 4
1 44
3 74
5 444
Solution
#include<stdio.h>
int main()
{
int i,j,k,t,n,a[10000];
scanf("%d",&t);
for(j=0;j<t;j++)
{
scanf("%d",&n);
a[1]=4;
a[2]=7;
{
if (i%2 != 0)
a[i] = a[i/2]*10 + 4;
else
a[i] = a[(i/2)-1]*10 + 7;
}
printf("%d\n",a[n]);
}
Q5 Test Case
Input Output
3 43078818
16 24 28719212
15 25 4132423
14 27
Weightage - 40
Input Output
/
3 184756
10 11 48620
9 10 24310
8 10
Weightage - 20
Input Output
4 1
1 1 3
2 2 10
3 3 35
Weightage - 20
Input Output
6 1
0 1 1
0 2 1
1 1 3
Weightage - 10
Input Output
3 1
1 1 3
2 2 10
3 3
Weightage - 10
2
2 1
1 2
2 1
2 1
1 1 6
2 3
Solution
#include <stdio.h>
#define MOD 1000000007
long long fact(int n,int m)
{
int s=n+m;
long long res=1;
if(n<m)
{
n=n+m;
m=n-m;
n=n-m;
}
int f=1,i;
for(i=s;i>n;i--)
{
res*=i;res%=MOD;
/
res/=f++;res%=MOD;
res/=f++;res%=MOD;
}
return res;
}
int main(void) {
// your code goes here
int t,N,M;
scanf("%d",&t);
while(t--)
{
scanf("%d %d",&N,&M);
long long ans=fact(N,M-1);
printf("%lld\n",ans);
}
return 0;
}
Q6
Test Case
Input Output
4 13
56 13
56 6
12 7
Weightage - 20
Input Output
6 2
4 3
5 3
8 18
Weightage - 10
Input Output
18
7 20
85 12
63 19
Weightage - 40
Input Output
18
7 20
85 12
63 19
Weightage - 20
Input Output
2 18
9 6
6
Weightage - 10
/
Sample Input Sample Output
2
2 3
2
10
Sample Input Sample Output
3 2
4 2
4 3
10
Solution
Header
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
int t,x,i,ans,out=0,multiple=0,j,k,power,n4,n0;
scanf("%d", &t);
for(;t>0;t-=1) {
scanf("%d",&x);
power = 1;
multiple=0;
out=0;
k=1;
n0=1;
while(1) {
for(i=power,j=1;j<=k;i=i/10,j+=1) {
multiple += (4*i);
//printf("Here %d: %d\n",power, multiple);
if((multiple%x)==0) {
out=1;
break;
}
}
if(out==1) {
break;
}
power*=10;
k+=1;
multiple = 0;
n0+=1;
}
ans = (2*j) + n0-j;
//printf("j= %d, n0 = %d ans = %d\n",j,n0,ans);
printf("%d\n",ans);
}
Footer
return 0;
}
/
Q7 Test Case
Input Output
no
40
60
1020
Weightage - 40
Input Output
10 yes
3
3
Weightage - 10
Input Output
yes
5
5
5
Weightage - 10
Input Output
20 no
10
150
Weightage - 20
Input Output
8 yes
10
65
Weightage - 20
5 yes
10
41
5 no
10
12
Solution
Header
/
#include<stdio.h>
int main()
{
int rows,columns,rnum,d,e;
scanf("%d",&rows);
scanf("%d",&columns);
scanf("%d",&rnum);
d=rows*columns;
e=d-rows;
if((rnum%rows==1)||(rnum<=rows)||(rnum>e))
{
printf("yes");
}
else
{
printf("no");
}
Footer
return 0;
}