0% found this document useful (0 votes)
167 views8 pages

Wipro Assessment Milestone 1 Questions

gugkjdhcvyugds

Uploaded by

nkp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
167 views8 pages

Wipro Assessment Milestone 1 Questions

gugkjdhcvyugds

Uploaded by

nkp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Program 1:

Given three integers input1, input2, input3


Constraints:
1000 <= input1 <= 9999
1000 <= input2 <= 9999
1000 <= input3 <= 9999
Test case – 1:
Input:
Input1: 3721
Input2: 2379
Input3: 7083
Output
2021
Explanation:
Generate a four-digit integer that should contain the smallest integer in its respective place
value.
Program 2:
Test case – 1:
Input:
{“apple”, “car”, “oregano”}
Output:
appleoregano
Test case – 2:
Input:
{“van”, “bike”, “car”}
Output:
No matches found
Explanation:
Return a string that should contain all the words in the array that starts and ends with vowel.
Program – 3: [Prime series]
Given two inputs, i.e., input1 is an array and the input2 is an nth integer.
Example 1:
Input1 = [1,2,3]
Input2 = 2
Explanation:
If the nth integer value is 2, then from the prime series 2,3,5,7,13… The second (nth value) is
3. Then the 3 will be added to the input1 array.
Output:
[4,5,6]
Example 2:
Input1=[10,2,5]
Input2=5
Output:
[21,13,16]
Note:
The prime series should be from 2 to 100
Program 4:
Test case:
Input:
Input1= 5391
Input2 = 4021
Input3 = 9861
Output:
27
Explanation:
You are given three numbers. For each number determine the digit with the highest value and
the digits with the lowest value.
Your task is to return a key where the key is the sum of all the maximum digits obtained from
each numbers and the sum of all the minimum digits obtained from each numbers.
Program 5:
Given a string, check if the whole string is in increasing order based on ASCII values
(character by character).
If it is increasing, return the count of words in the string.
Otherwise, return 0
Program 6:
You are given three 4-digit integers: input1, input2, and input3, where each number lies in the
range from 1000 to 9999.
Task:
Write a program to perform the following steps:
1. From each input number, find the maximum digit and calculate the sum of all three
maximum digits.
2. From each input number, find the minimum digit and calculate the sum of all three
minimum digits.
3. Return the difference between the sum of maximum digits and the sum of minimum digits.
Formula:
Result = (sum of maximum digits) - (sum of minimum digits)
Input Format:
- Three integers: input1, input2, and input3
Output Format:
- A single integer: the required result
Sample Input:
input1 = 3452
input2 = 3457
input3 = 6787
Sample Output:
9
Explanation:
Max digits: 5 (from 3452), 7 (from 3457), 8 (from 6787) → Sum = 20
Min digits: 2, 3, 6 → Sum = 11
Output: 20 - 11 = 9
Program 7:
You are given three 4-digit numbers as inputs, where each number is in the range 1000 to
9999 (inclusive). Write a program in Java to perform the following operations:
Extract the thousands place digit from input1.
Extract the hundreds place digit from input2.
Find the largest digit present in input3.
Compute the result using the formula:
(thousands place of input1 * hundreds place of input2) - (largest digit in input3)
Print the result.
Thousands place of 4521 → 4
Hundreds place of 3698 → 6
Largest digit in 5876 → 8
(4 * 6) - 8 = 24 - 8 = 16
Program 8:
Write a Java program that takes a string as input and performs the following operation:
If the length of the string is greater than 10, print the string in the abbreviated form:
First character + (number of characters between first and last) + last character.
For example:
localization → l10n
internationalization → i18n
If the length of the string is 10 or less, print the string as it is.
Program 9:
You are given:
- An integer input1 — representing the number of words in the list.
- A list of input1 words as input2.
Task:
Write a program to perform the following:
1. From the given list of words (input2), select only those words where both the first and last
characters are vowels.
2. If one or more such words are found, concatenate them into a single string and print it.
3. If no such word exists, print "no string available".
Input Format:
- An integer input1 (1 ≤ input1 ≤ 100)
- A list of strings input2 of size input1
Output Format:
- A single concatenated string (if valid words exist)
- Otherwise, the string: "no string available"
Sample Input 1:
input1 = 3
input2 = [apple, alie, mango]
Sample Output 1:
applealie
Sample Input 2:
input1 = 2
input2 = [tree, drum]
Sample Output 2:
no string available
Note:
Vowels include: a, e, i, o, u (lowercase only)
Program 10:
1. input1=3457, input2=8721, input3=2934.
To return the value of : (a*b)-c
Where a=thousandth place value of input1
b=hundredth place value of input2
c=largest digit of input3
(3*7)-9=12.
Program 11
input1={10,20,30}
input2=2.
To find the prime number, if input2=2 then to find 2nd prime number from 1 to 100.
And Add that prime number with each values in the array input1.
2nd prime number is 3 . so, add 3 with the array and return the array.
Answer = {13,23,33}
Program 12
Given two char arrays input1[] and input2[ ] which contains only upper case alphabets,
Step 1: Extract the alphabets which are present only in any one of the array.
(Uncommon alphabets)
Step 2: Get the ascii values of all the extracted alphabets.
Step 3: Calculate the sum of those ascii values, lets us call it as sum1 and calculate
single digit sum for sum1
ile keep adding the digits of sum1 until you arrive at a single digit.
Step 4: Return the single digit as output.
Note :
1. Array size ranges from 1 to 15.
2. All the array elements are upper case alphabets.
Example 1:
input1: (‘A’, ‘B’, ‘C’}
input2: (‘B’, ‘C’)
output: 65 => 6 + 5 = 11
==> 1 + 1 = 2
Program 13
Return the count of the vowel present in the word which is given aas the input.
Input:
“wipro”
Output: 2
Explanation: (I, O) is vowel is the word
[case-insensitive]
Program 14
To find Key Value from three inputs
 Three inputs = input1, input2, input3 (given range from 1000 to 9999)
 To find key value follow conditions:
Key value is also a four digit value,
a) Find the largest number in the thousand’s place in all three inputs for key
values thousand’s place.
b) Find the largest number in the hundred’s place in all three inputs for key
values hundred’s place.
c) Find the largest number in the ten’s place in all three inputs for key values
ten’s place.
d) Find the largest number in the unit’s place in all three inputs for key values
unit’s place.
Test case:
input1 = 5243
input2 = 2376
input3= 2912
Key value = [5], [9], [7], [6] = 5976
Output:
5976
Program 16:
The given three integers as input:
Input1 = 5321
Input2 = 5474
Input3 = 4253
Step: For each number, find the largest digit. Then calculate the Key using: Key = (largest
digit of input1) × (largest digit of input2) × (largest digit of input3) Largest digit in 5321 = 5
Largest digit in 5474 = 5 Largest digit in 4253 = 5 Key = 5 × 5 × 5 = 125 2. Given a string:
Input = "hi hello"
Step 1: Split the string into words. - Word 1: "hi" -> length = 2 - Word 2: "hello" -> length = 5
Step 2: For each word, shift each character forward in the alphabet by the word's length. - 'h' -
> 'j', 'i' -> 'k' -> "jk" - 'h' -> 'm', 'e' -> 'j', 'l' -> 'q', 'l' -> 'q', 'o' -> 't' -> "mjqqt"
Step 3: Join the shifted words, keeping the space between them.
Output:
"jk mjqqt"

You might also like