[Link].
com
New Leaf Ins Pvt Ltd
Hexaware Pattern Set - 01
Hexaware Total Difficulty
Section No of Questions Time Level
Quants 20 Ques 60 mins Medium
Logical 20 Ques 60 mins Medium
Verbal 20 Ques 60 mins Medium
Domain-based • Pseudo Code: 15 ques 30 mins High
• Computer Fundamentals: 15
ques
Coding • 2 Ques 40 mins High
Numerical Ability
Q1) In how many ways can a cricket team of 11 players be selected out of 16 players, if two particular
players are always to be included?
A. 2008
B. 2004
C. 2006
D. None of these
Answer : Option D
Q2) A tells B “If you give me Rs 400, then | shall have 25% more than what you have”. B tells A, “If
you give me Rs 200, then | shall have three-and-a-half times as much as you have.” How much
Rupees B have?
[Link]
A. Rs 1600
B. Rs 800
C. Rs 900
D. Rs 1200
Answer : Option D
Q3) Aman invests Rs. 10,000 in some shares in the ratio 2:3:5 which pay dividends of 10%, 25% and
20% (on his investment) For that year respectively. Find his dividend income.
A. 2050
B. 1950
C. 2000
D. 1900
Answer : Option B
Q4) The length, breadth and height of a room are in the ratio, 3 : 2: 1. If the breadth and height are
halved and the length is doubled, then the total area of the four walls of the room will
A. decrease by 15%
B. decrease by 30%
C. remain the same
D. decrease by 13.64%
Answer : Option B
Q5) If 4 examiners can examine a certain number of answer books in 8 days by working 5 hours a day,
for how many hours a day would 2 examiners have to work in order to examine twice the number Of
error
answer books in 20 days.
A. 8
[Link]
B. 6
C. 9
D. 5
Answer : Option A
Q6) Mitchell travels for a total of 6 hours. If he travelled the first half of the distance at 36 kph and
the second half at 5 mps, find the total distance traveled by him in km.
A.143
B.196
C.164
D.144
Answer : Option D
Q7) A mixture of three materials A, B and C (in powdered form) with the volumes in the ratio 4:2:3 is
required to make good quality powder. The weights of 1 m3 of A, B and C are 90 kg, 100 kg and 120
kg respectively. What is the ratio of the weights of A and B to B and C in the mixture?
A.2 : 3
B.1 : 2
C.1 : 1
D.2 : 1
Answer : Option C
Q8) A man is running at a speed of 2mps. There is a bus stop of length 10m at a distance of 80m
from the man. What is the time required by the man to pass by the bus stop?
A.45 seconds
B.19 seconds
C.34 seconds
D.24 seconds
Answer : Option A
[Link]
Q9) If sinA and cosA are the roots of the equation ax2 + bx + c = 0, then which of the following
relationship is correct?
A.(a - c)2 = b2 + c2
B.(a + c)2 = b2 - c2
C.(a - c)2 = b2 - c2
D.(a + c)2 = b2 + c2
Answer : Option D
Q10) The monthly income of A, B and C in the ratio 2:3:1 and the monthly income of B, C and D are
in the ratio 9:3:15. The saving of C and D are in the ratio 2:3 and C saves $600. What is the annual
saving of D, if monthly income of A is $6000?
A.$9800
B.$11500
C.$10800
D.$8500
Answer : Option C
Q11) The ratio of two numbers A and B is 2 : 5 and the sum of 6 terms of arithmetic progression
starting with A and common difference(B - A) is 285. Find the value of B.
A.25
B.30
C.20
D.15
Answer : Option A
Q12) Cameron covered a certain distance at 108 kph and returned back at 20 mps. Find the average
speed in mps for the entire journey.
A.32
B.25
C.24
D.18
Answer : Option C
[Link]
Q13) The ratio of salaries of Peter and Paul was 2:3. Their salaries were increased by Rs. 200 and Rs.
600 respectively, and the new ratio became 1:2. What were their salaries initially?
[Link]. 600, Rs. 900
[Link]. 200, Rs. 300
[Link]. 800, Rs. 1200
[Link]. 400, Rs. 600
Answer : Option D
Q14) Emma invested $5200 under simple interest at 6% per annum. Find the simple interest earned
by her after 3 years?
A.$956
B.$936
C.$846
D.$898
Answer : Option B
Q15) Pipe M can fill a tank in 3 hours, and pipe N can fill the tank in 2 hours. If they are opened
simultaneously, in how much times (in hours) can they fill it?
A.1.2
B.1.5
C.2.4
D.3.6
Answer : Option A
1. A milkman purchases the milk at Rs. x per litre and sells it at Rs. 2x per litre still he mixes 2 litres
water with every 6 litres of pure milk. What is the profit percentage?
A. 116%
B. 166.66%
C. 60%
D. 100%
Answer : Option B
[Link]
Q17) A sum is invested for 3 years compounded at 5%, 10% and 20 % respectively. In three years, if
the sum amounts to Rs. 1386, then find the sum.
A. Rs 1000
B. Rs 1400
C. Rs 1500
D. Rs 1200
Answer : Option A
Q18) What comes instead of question mark?
8(97)6 ; 4(56)5 ; 6(75)4 ; 7(?)8
A. 89
B. 88
C. 97
D. 99
Answer : Option A
Q19) Extreme old age when a man behaves like a fool
A. Imbecility
B. Senility
C. Dotage
D. Superannuation
Answer : Option C
Q20) The postfix form of the expression (A+ B)*(C*D- E)*F / G is?
A. AB+ CD*E – FG /**
B. AB + CD* E – F **G /
C. AB + CD* E – *F *G /
D. AB + CDE * – * F *G /
Answer : Option D
[Link]
Logical Ability
Q1) The question given below is followed by two statements numbered I and II. Determine if the
statements are, individually or together sufficient to answer the question.
Question: What is the first term in a sequence of numbers?
Statements:
I. The third term is 12.
II. The second term is twice the first and the third term is three times the second.
A. Statements I and II together are not sufficient to answer the question asked and additional data to
the problem is needed.
B. Only one of the statements, alone, is sufficient to answer the question but other statement is not.
C. Each statement alone is sufficient to answer the question.
D. Both statements I and II together are sufficient to answer the question asked but neither
statement alone is sufficient.
Answer : Option D
Q2) If in a certain code language, “F” is coded as 6, “EJZ” is coded as 51026 and “MAT” is coded as
13120, then how would “CAR” be coded in that code language?
A. 3118
B. 3281
C. 3181
D. 3218
Answer : Option A
Q3)Find the missing term in the following series.
4400, 4437, 4472, ?, 4536, 4565
A. 4522
[Link]
B. 4026
C. 4526
D. 4505
Answer : Option D
Q4) The question given below is followed by two statements numbered I and II. Determine the
statements are individually or together sufficient to answer the question.
Question: What is the value of x?
Statements:
I. x - 2y = 7
II. 4x - 28 = 8y
[Link] statements I and II together are sufficient to answer the question asked but neither statement
alone is sufficient
[Link] statement alone is sufficient to answer the question
[Link] I and II together are not sufficient to answer the question asked and additional data to
the problem is needed.
[Link] one of the statements, alone, is sufficient to answer the question but the other statement is
not
Answer : Option C
Q5) Read the information given below carefully and answer the questions that follow.
In a parking lot, 5 cars each are parked in two parallel lines facing each other. Benz, XUV, Duster, Eco
sports, and Scorpio are parked facing South while Zen, i20, i10, Polo, and Brio are parked facing
North.
- XUV is parked to the immediate left of Eco sports and is opposite to Brio.
- Duster and i20 are parked diagonally opposite.
- Scorpio is parked opposite to i10 which is to the immediate right of Zen.
[Link]
- Polo is parked to the immediate left of Brio and is opposite to Eco sports.
- Zen is parked to one of the extremes.
Which car is parked third to the right of i10?
A. Zen
B. i20
C. Cannot be determined
D. Brio
Answer : Option B
Q6) Choose the correct alternative that will continue the same pattern and fill in the blank spaces:
2, 3, 5, 7, 11, (....), 17
A. 12
B. 13
C. 14
D. 15
Answer : Option B
Q8) Find the odd one out of the given options.
[Link]
[Link]
[Link]
[Link]
Answer : Option C
Q9) Statement:
[Link]
The principal instructed all the teachers to be careful in class because some students may disturb
other students.
Assumptions:
I. The teachers may handle the situation properly and they may restrict the naughty students.
II. The students will welcome the decision of the Principal.
A. If only assumption I is implicit
B. If only assumption II is implicit
C. If either I or II is implicit
D. If neither I nor II is implicit
Answer : Option A
Q10) Multiple choice (select 1 out of 4 options for the questions below)
A man walks 5 km towards south and then turns right. After walking 3 km he turns to the left and
walks 5 km. Now in which direction is he from the starting place?
[Link]
[Link]
[Link] East
[Link] West
Answer : Option D
Q11) Event (A): Company X is opening an office in city Y for marketing the company's products.
Event (B): Company X has chalked out an expansion plan, involving raising
production capacity at its existing plants.
A. If 'A' is the effect and 'B' is its immediate and principle cause.
B. If 'B' is the effect and 'A' is its immediate and principle cause.
C. If 'A' is the effect but 'B' is not its immediate and principle cause.
D. If 'B' is the effect but 'A' is not its immediate and principle cause.
Answer : Option C
Q12) 522 1235 2661 4800 7652 11217 ?
A.15495
B. 16208
[Link]
C. 14782
D. 16921
Answer : Option A
Q13) The question consists of two terms which have a certain relationship with each other followed
and if the same relationship is followed, which pair will be followed?
Light : Blind :: _________
[Link] : Dumb
[Link] : Deaf
[Link] : Sound
[Link] : Vibration
Answer : Option A
Q14) Statement:
Cutting down of forests is a threat to the wild life. Most of the species of animals are on the verge of
extinction.
Courses of Action:
I. The species of animals, which are on the verge of extinction, must be protected by creating wild life
sanctuaries which contain flora that defines the native habitat of the endangered animals.
II. To the maximum extent possible we should stop deforestation.
III. Growing urban forests to compensate for deforestation.
A. Only II follows
B. Only III follows
C. Only I and II follow
D. Only I and
Answer : Option C
Q15) Study the following information carefully and answer the given questions:
A word and number arrangement machine when given an input line of words and numbers
rearranges them following a particular rule in each step.
The following isan illustration of input and rearrangement:
Input: 39 121 48 18 76 112 14 45 63 96
[Link]
Step I: 14 39 121 48 18 76 112 45 63 96
Step II: 14 39 48 18 76 112 45 63 96 121
Step III: 14 18 39 48 76 112 45 63 96 121
Step IV: 14 18 39 48 76 45 63 96 112 121
Step V: 14 18 39 45 48 76 63 96 112 121
Step VI: 14 18 39 45 48 63 76 96 112 121
This is the final arrangement and step VI is the last step for this input.
How many steps will be required for getting the final output for the following input?
Input: 101 85 66 49 73 39 142 25 115 74
A. 5
B. 6
C. 7
D. 8
Answer : Option D
Q16) Statements: All the bananas are apples. All the apples are fruits.
Conclusions:
1. All the fruits are apples.
2. All the bananas are fruits.
A. Only (1) Conclusion follows
B. Only (2) Conclusion follows
C. Either (1) or (2) follows
D. Neither (1) nor (2) follows
E. Both (1) and (2) follow
Answer: Option B
Q17) Aman, Bhavesh, Chimpa, Dimple, Ellen and Farukh are sitting in a row. Ellen and Farukh are in
the centre. Aman and Bhavesh are at the ends. Chimpa is sitting to the left of Aman. Who is to the
right of Bhavesh ?
A. Aman
B. Dimple
[Link]
C. Ellen
D. Farukh
Answer: Option B
Q18) What should come in the place of question mark (?) in the alpha numeric series?
A3B, E9E, I27H, O81K, ?
A. Y530U
B. U729N
C. W569B
D. U729M
Answer: Option B
Q19) Pointing to a boy, Swapnil said, "He is the son of the only son of my mother." How is Swapnil
related to that boy?
A. Brother
B. Uncle
C. Cousin
D. Father
Answer: Option D
Q20) Statement: “Repeat your Matrimonial ads on Sunday for just 100 per sq cm.” – An
advertisement in a newspaper
Assumption:
1. People want advertisement at no cost.
2. There are some people who want to repeat their matrimonial advertisement.
A. Only assumption 1 is implicit
B. Only assumption 2 is implicit
C. Both assumption 1 and 2 are implicit
D. Neither assumption 1 nor 2 are implicit
Answer: Option B
[Link]
Verbal Ability
Q1) There are five sentences or parts of sentences that form a paragraph. Identify the sentence or
part of sentence that is/are correct in terms of grammar and usage. Then, choose the most
appropriate option.
A. Itis sometimes told that democratic
B. government originated in the city-states
C. of ancient Greece. Democratic ideals have been handed to us from that time.
D. In truth, however, this is an unhelpful assertion. ‘A Mark as error
E. The Greeks gave us the word, hence did not provide us with a model
A. B only
B. A,B and D
C. B, C and D
D. B and D
Answer : Option D
Q2) Choose the word which would make the sentence grammatically correct and meaningful.
Everybody these days complains ........ corruption in public life.
A. off
B. of
C. against
D. about
Answer : Option D
Q3) In the following question a statement is followed by two arguments | and II. You have to decide
which of the arguments is strong.
[Link]
Give Answer (A) if only argument | is strong.
Give Answer (B) if only argument II is strong.
Give Answer (C) if either | or Il is strong.
Give Answer (D) if neither I nor Il is strong.
Statement: Should military training be made compulsory in our country like other countries?
Arguments:
|. Yes, every citizen has right to protect his country.
II. No, it is against the policy of non-violence.
A. (A)
B. (C)
C. (B)
D. (D)
Answer : Option A
Q4) Consider the statement to be true, decide which of the given course of action logically follows
for pursuing.
Statement:
A large number of tribal inhabitants are found to have been suffering from various diseases due to
exposure to radioactive waste near the Uranium mine.
Courses of Action:
|. The Government should immediately close down the mine.
ll. The Government should immediately take steps to save local people from exposure to radioactive
waste.
lll. The tribals should be rehabilitated at a safer place.
A. Only III follow
B. Only Il and III follow
[Link]
C. Only | and I follow
D. Only | and III follow
Answer : Option B
Q5) Consider the statement to be true, decide which of the assumptions is implicit for the statement.
(A) if only assumption | is implicit.
(B) if only assumption II is implicit.
(C) if both | and I! implicit.
(D) if neither | nor II is implicit.
Statement: Children, who get encouragement, usually perform better - a note by the Principal to the
parents.
Assumptions:
|. Some parents do not encourage children.
ll. Parents may follow Principal's advice.
A. (A)
B. (D)
C. (C)
D. (B)
Answer : Option C
Q6) Rearrange the given sentences to form a coherent paragraph.
(1) But the fact is that most of us lie about 18 to 50 times a day. Often without thinking.
(2) And so, honesty can make all the difference in a relationship.
(3) We all like to think of ourselves as honest people.
(4) So we land in trouble constantly, even though we never meant to hurt someone's feelings.
A) 3412
[Link]
B) 3142
C) 3421
D) 3124
Answer : Option B
Q7) Fill in the blank with the most suitable option.
Jerry stays ___a penthouse atop a skyscraper.
A) at
B) on
C) None of the mentioned options
D) in
Answer : Option D
Q8) Choose the option which is closest in meaning to the word given below.
CONTRAST
A) Compare
B) Check
C) Prepare
D) Display
Answer : Option A
Q9) Fill in the blank with the most suitable option.
This family needs a counselor to____ guide them towards happiness.
A) gaunty
B) smartly
C) gently
D) sweetly
Answer : Option C
Q10) Find out which underlined part of the sentence below has an error and mark the option
accordingly.
[Link]
I regret that I wasn't aware that you have lost your job when you visited me last week.
A) I wasn't aware
B) have lost your
C) when you visited me
D) No Error
Answer : Option B
Q11) Choose the answer that shows the best punctuation for the underlined part of the sentence.
She was the one you were talking of, wasn't she?
A) of, wasn't she?
B) of wasn't she?
C) of wasn’t she.
D) of, wasn't she.
Answer : Option A
Q12) Fill in the blank with the most suitable option.
I told her that I___ German fluently, thanks to her efforts.
A) None of the mentioned options
B) could have spoken
C) could speak
D) can be speaking
Answer : Option C
Q13) Mark the option which is closest to the meaning of the word.
BAIL
A) Promise
B) Group
C) Leave
D) Money
Answer : Option C
[Link]
Q14) Fill in the blank with the most suitable option.
Don't dismiss the idea completely; talk it ______ with your husband and see if you agree on it.
A) at
B) up
C) for
D) over
Answer : Option D
Q15) Find out which underlined part of the sentence below has an error and mark the option
accordingly.
lam guilty of not knowing you have come to me to seek help for the next issue of your magazine.
A) your magazine
B) for the next issue
C) not knowing
D) have come to me
Answer : Option D
Q16) Choose the correct Preposition here:
Since he met his new girlfriend, Juan never seems to be ______ home
A) on
B) in
C) at
D) None
Answer : Option C
Q17) Choose the correct Idioms or phrases given in the options for the bold part of the sentence
A video call from my favorite film star on my birthday was a complete surprise.
A. A damp squib
B. Bolt from the blue
[Link]
C. A field day
D. A mare’s nest
Answer : Option B
Q18) Identify the correct part of the sentence from the given option:
Sincere workers do not rest till they have reached perfection in their work.
A. they have achieved
B. they having reached
C. they had achieved
D. No improvement
Answer : Option A
Q19) Read the following passage and answer the questions that follow:-
The first truck to arrive is no. 4272, a seventy-three-foot-long tractor-trailer, driven by Herman
Snook, 67 years old, wiry, chewing a toothpick. He is quick to point out that he, too, thinks the landfill
looks nothing like a landfill, and he believes it doesn’t smell like one, either. He allows that he may
have just gotten used to the odor. (He has.) When fellow truckers arrive, pulling up next to Herman,
the ground—so deep with trash—is so soft it bounces.
At six o’clock, the truckers are allowed to start dumping, and so Herman pushes a red button inside a
panel on his cab. The back end of the trailer rises obediently and 79,650 pounds of debris comes
thundering out, most of it wood and plaster and nails and shreds of wallpaper. Beside him, a truck is
dumping decidedly more organic garbage, pungent indeed, and way down the row, off¬ to the side, a
guy is pouring a truckful of sludge, sterilized human waste, black as ink.
The Puente Hills Landfill, about sixteen miles east of downtown Los Angeles, serves 5 million people
in seventy-eight California cities, one of six landfills operated by the Sanitation Districts of L.A.
County. Every day 13,200 new tons of trash are dumped here. That’s enough to fill a one-acre hole
twenty feet deep.
In five years, on November 1, 2013, the landfill will be out of room, and all that trash will have to go
somewhere else.
Question:-
What does the author mean by, “ the ground—so deep with trash—is so soft it bounces.”?
A. the trash has made the ground soggy and soft
[Link]
B. the trash is so deep that it has covered the ground and made it soft
C. the trash’s quantity is so much it has completely covered the ground and anyone walking on it
basically walking on the trash which feels soft.
D. there is an abundance of trash and the chemical have seeped into the ground and made it soft
Answer : Option C
Q20) Which part of the given sentence has an error in it?
The curved wall led into the dining room/, at the center of which was a mahogany table / that could
easily sit thirty guests
A. The curved wall led into the dining room
B. at the center of which was a mahogany table
C. that could easily sit thirty guests
D. No error
Answer : Option D
Pseudocode Questions
Q.1. What is the output of this program?
#include <stdio.h>
using namespace std;
int main()
int a = 5, b=10, c = 15;
int arr[3] = {&a, &b, &c};
cout << *arr[*arr[1] - 8];
return 0;
(1) garbage value
(2) compile time error
(3) 18
(4) 15
Answer : Option B
[Link]
Q.2. What is the output of this program?
#include <iostream>
#include <deque>
using namespace std;
int main ()
deque<int> mydeque (5);
deque<int>::reverse_iterator rit = [Link]( );
int i = 0
for (rit = [Link]( ); rit!= [Link]( ); ++rit)
*rit = ++i;
for (deque<int> :: iterator it = [Link]( ):
it != [Link]( ); ++it)
cout << '' << *it;
return 0;
(1) 1234
(2) 54321
(3) 43210
(4) 12345
Answer : Option D
Q.3. What is the output of this C code?
#include <stdio.h>
int main()
int a[4] = {1, 2, 3, 4};
int b[4] = {1, 2, 3, 4};
int n = &b[3] - &a[2];
printf("%d\n", n);
}
[Link]
(1) -3
(2) 1
(3) 5
(4) Compile time error
Answer : Option B
Q.4. What is the output of this C code?
#include <stdio.h>
int main()
int ary[2][3];
foo(ary);
void foo(int *ary[ ])
Int i = 10, j =2,k;
ary[0] = &i;
ary[1] = &j;
*ary[0] = 2;
for (k = 0;k < 2; k++)
printf("%d\n", *ary[k]);
(1) Compile time error
(2) 22
(3) Undefined behaviour
(4) 102
Answer : Option B
[Link] is the output of this C code?
#include <stdio.h>
[Link]
int main()
char *str = "hello world";
char strary[] = "hello world”;
printf("%d %d\n", strlen(str), strlen(strary));
return 0;
(1) x 11 where x can be any positive integer
(2) 12 11
(3) 11 11
(4) 11 12
Answer : Option C
Q6). What will be the output of the following pseudocode for arr[] = 1,2,3,4,5
```
Initialize i, n
Set arr[]= 1, 2, 3, 4, 5
for i = 0 to n - 2
arr[i] = arr[i] + arr[i+1]
End for
```
print the array of elements
A. 3 3 4 9 5 B. 4 3 7 5 2 C. 3 5 7 9 5 D. 1 2 3 4 5
Answer : Option C
Q7). Predict the output of the following pseudocode.
```
Integer x, y, z
Set x = 0, y = 3, z = 11
if(x + (1 | 2) && y + (2 | 3))
x=x-2
[Link]
y=x
Else
x=z
y=y^2
End if
Print x + y + z
```
A. 15 B. 10 C. 13 D. 7
Answer : Option D
Q8). "What operation does the following pseudocode perform?
```
Declare an array ""word"" of string data type
Declare a variable l
Take a string as input in the word
for l = (length of word) – 1 to 0
print word[l]
End for
Algorithm End
```
A. None of the above
B. It prints characters in increasing order
C. It deletes the string
D. It reverses the string
Answer : Option D
Q9). "Predict the output of the following pseudocode for x = 10, y = 5.
```
Integer solve(Integer x, Integer y)
if(y > 0)
if(x > 0)
[Link]
return x + y + solve(2, y - 5) + solve(x - 10, 1)
End if
End if
return x + y
End function solve()
```
A. 15 B. 18 C. 13 D. 17
Answer : Option B
Q10). What will be the output of the following pseudocode for arr[]= 5, 4, 3, 2, 1?
```
Initialize i, n
Initialize an array of size n
Take the values for the array
for i = 0 to n - 2
arr[i] = arr[i] - arr[i+1]
End for
```
print the array of elements
A. 3 3 4 9 5 B. 1 1 1 1 1 C. 3 5 7 9 5 D. 2 2 2 2 2
Answer : Option B
Q11) Predict the output of the following pseudocode for n = 5, m = 6.
```
Integer solve(Integer n, Integer m )
if(n > 4 && m < 7)
return solve(n +1, m + 1)
Else
Return n + m
End if
End function solve()
[Link]
```
A. 15 B. 21 C. 13 D. 10
Answer : Option C
Q12) What operation does the following pseudocode perform?
```
Declare an array ""word"" of string data type
Declare a variable l
Take a string as input in the word
for l = 0 to (length of word) – 1
print word[l]
End for
Algorithm End
```
A. None of the above
B. It prints the original string
C. It deletes the string
D. It reverses the string
Answer : Option B
Q13) Predict the output of the following pseudocode
```
Integer x, y, z
Set x = 10, y = 16,z = 3
if(x > y)
x=2*y
Else
y=x/2
End if
if(z > y)
[Link]
z=2*y
Else
y=z/2
End if
Print x + y + z
```
A. 38 B. 20 C. 33 D. 14
Answer : Option D
Q14) What will be the output of the following pseudocode for arr[] = 5, 4, 3, 2, 1
```
Initialize i, n
Initialize an array of size n
Take the values for the array
for i = 0 to n - 2
arr[i] = arr[i] * arr[i+1]
End for
```
A. 10 12 8 2 1 B. 20 12 6 2 1 C. 5 10 6 2 0 D. 20 4 6 1 1
Answer : Option B
Q15) Calculate the output of the following pseudocode.
```
Integer w, x, y, z
Set w = 21, x = 11
for (each y from 21 to 30 )
for (each z from -1 to 0 )
w=w-1
if(w > y)
Continue
End if
[Link]
w=1
if(w > z)
Jump out of the loop
End if
End for
End for
Print w + x
```
A. 8 B. 12 C. 3 D. 2
Answer : Option B
Computer Fundamental Questions
Q.1 Which of these class holds a collection of static methods and variables?
A. Runtime
B. System
C. Process
D. Void
Answer : Option B
Q.2. What is the scope of an external variable?
A. Whole source file in which it is defined
B. From the point of declaration to the end of the file in which it is defined
C. Any source file in a program
D. From the point of declaration to the end of the file being compiled
Answer : Option C
Q.3. What is the use of middle parameter in rotate method?
A. Marks the elements in a sequence
B. Marks the beginning of a sequence
C. None of the mentioned
[Link]
D. Marks the ending of a sequence
Answer : Option D
Q.4. Identify the type of the variables.
typedef char* CHAR;
CHAR p,q;
A. Unknown
B. char*
C. CHAR
D. char
Answer : Option B
Q.5. Which of three sizes of floating point types should be used when extended precision is
required?
A. Float
B. long double
C. Double
D. extended float
Answer : Option B
Q.6. Keep the statement language ______________ while writing a pseudo code.
A. Dependent
B. Independent
C. Case sensitive
D. Capitalized
Answer : Option B
Q.7. Capitalize initial keyword – This is a rule while writing a pseudo code.
A. True
B. False
Answer : Option A
[Link]
Q.8. Which of the following is not a keyword?
A. Read
B. Write
C. start
D. endif
Answer : Option C
Q.9. ______________ is used to show hierarchy in a pseudo code.
A. Indentation
B. Curly Braces
C. Round Brackets
D. Semicolon
Answer : Option A
Q.10. The statement that tells the computer to get a value from an input device and store it in a
memory location.
A. read
B. write
C. READ
D. WRITE
Answer : Option C
Q.11. _____________ are identified by their addresses, we give them names (field names / variable
names) using words.
A. Memory variables
B. Memory Locations
C. Memory Addresses
D. Data variables
Answer : Option B
Q.12. ____________ begins with lower case letters.
[Link]
A. Keywords
B. Variables
C. Tokens
D. Functions
Answer : Option B
Q.13. Another notation for exponentiation.
A. *
B. **
C. ***
D. *^
Answer : Option B
Q.14. A symbol used for grouping.
A. ()
B. {}
C. [].
D. ” ”
Answer : Option A
Q.15. A statement used to close the IF block.
A. ELSE
B. ELSEIF
C. END
D. ENDIF
Answer : Option D
Hexaware Coding Questions
Problem 1:
Adam's Charity
[Link]
Adam decides to be generous and do some charity. Starting today, from day 1 until day n, he gives
i^2 coins to charity on day ‘i’ (1≤i≤n).
Return the total coins, he would give to charity.
Input specification:
Input 1: number of days of Charity.
Output Specification:
Return the total number of coins till charity days.
Example 1:
Input 1: 2
Output: 5
Explanation:
There are 2 days.
Example 2:
Input 1: 3
Output: 14
Explanation:
There are 3 days.
Code:
import [Link].*;
class Main
public static void main(String args[])
Scanner scan = new Scanner([Link]);
int n = [Link]();
int sum = 0;
for(int i=1; i<=n; i++){
sum = sum + (int)[Link](i, 2);
}
[Link]
[Link](sum);
Problem 2:
Problem Statement:
The Cuckoo Sequence
A Cuckoo Sequence is defined as shown.
Cuckoo[1]=0
Cuckoo[2]=1
Cuckoo[n]=1*Cuckoo[n-1]+2*Cuckoo[n-2]+3*1, for n>2
Given n(1<= n <=10^8), find Cuckoo[n].
Input Specification:
Input1: Integer n
Output Specification:
Return the value of Cuckoo[n]
Example:
Input: 3
Output: 4
Explanation: cuckoo(3) = 1*cuckoo(2) + 2*cuckoo(1) + 3*1
= 1*1 + 2*0 + 3 = 4
Code:
import [Link].*;
class Main
public static void main(String args[])
Scanner scan = new Scanner([Link]);
int n = [Link]();
[Link]
int res = cuckoo(n);
[Link](res);
public static int cuckoo(int n ){
if(n==1){
return 0;
else if (n==2){
return 1;
else{
return 1*cuckoo(n-1) + 2*cuckoo(n-2) + 3*1;