0% found this document useful (0 votes)
69 views6 pages

MTS - L1 - Set 2

The document outlines the instructions for an exam, including rules against malpractice, the prohibition of electronic devices, and the structure of the question paper divided into two sections: programming and aptitude. Section A consists of 10 programming questions to be completed in 40 minutes, while Section B has 10 aptitude questions to be completed in 35 minutes, with each question worth one mark and no negative marking. It emphasizes the importance of legibility and proper marking on the answer sheet.

Uploaded by

ashusharma268235
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)
69 views6 pages

MTS - L1 - Set 2

The document outlines the instructions for an exam, including rules against malpractice, the prohibition of electronic devices, and the structure of the question paper divided into two sections: programming and aptitude. Section A consists of 10 programming questions to be completed in 40 minutes, while Section B has 10 aptitude questions to be completed in 35 minutes, with each question worth one mark and no negative marking. It emphasizes the importance of legibility and proper marking on the answer sheet.

Uploaded by

ashusharma268235
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/ 6

Code : UEMS 2412

General Instructions:
● Strictly avoid any form of malpractice, as it will result in immediate
disqualification.
● Electronic devices, including cell phones, smart watches, and calculators, are
not permitted during the exam.
● Please refrain from writing or marking anything on the question paper.
● The question paper consists of 2 sections with a total of 20 questions.
○ Section A includes 10 programming questions to be completed within
40 minutes.
○ Section B includes 10 aptitude questions to be completed within 35
minutes.
● Each question is worth one mark.
● There are no negative marks for incorrect answers.
● The questions are free from errors in logic, spelling, syntax, or meaning.
● Please write your answers on the provided Answer Sheet and use the Rough
Sheets for any calculations.
● Ensure that your answer sheet is clearly marked and that all answers are
written legibly to avoid any discrepancies during marking.

Section A - Programming
10 questions | 40 minutes

1. What is the 'zoho' method's output with 's = "D4V1D"'?


public static String zoho(String s) {
char[] c = s.toCharArray();
for(int i = 1; i<c.length; i = i + 2)
c[i] = (char) (c[i - 1] + c[i] - '0');
return String.valueOf(c);
}

2. What is the 'zoho' method's output with 's = "work", t = "HappyWorkHappyLife"' as


input?

Page No : 1
Code : UEMS 2412

public boolean zoho(String s, String t) {


return help(s , 0 , t, 0);
}
private boolean help(String s , int i , String t, int j){
if(i == s.length())
return true;
if(i < s.length() && j == t.length())
return false;
if(s.charAt(i) == t.charAt(j))
return help(s , i+1, t , j+1);
else
return help(s , i, t, j+1);
}

3. What is the output of the below method when given the input s1 = ["Race",
"CarDriver"] & s2 = ["RaceCar", "Driver"]?
public boolean zoho(String[] s1, String[] s2) {
int i = 0, j = 0;
int m = 0, n = 0;
while (i < s1.length && j < s2.length) {
if (s1[i].charAt(m++) != s2[j].charAt(n++))
return false;
if (m == s1[i].length()) {
i++;
m = 0;
}
if (n == s2[j].length()) {
j++;
n = 0;
}
}
return i == s1.length && j == s2.length;
}

4. What does the 'zoho' method return when given the input 'n = 6'?
public bool zoho(int n) {
if ( n == 1)
return false;

Page No : 2
Code : UEMS 2412

else
return !zoho(n -1);
}

5. What is the 'zoho' method's output with 'nums1 = [2,3,4], nums2 = [0,1,2,3,4,5]' as
input?
public int[] zoho(int[] nums1, int[] nums2) {
int[] ans = new int[nums1.length];
for(int i = 0; i < nums1.length; i++) {
int temp = -1, j = nums2.length - 1;
while(j >= 0 && nums2[j] != nums1[i]) {
if(nums2[j] > nums1[i])
temp = nums2[j];
j--;
}
ans[i] = temp;
}
return ans;
}

6. Given `num = 5`, what is the output of the following code?


public int[] zoho(int num) {
int[] f = new int[num];
for (int i=1; i<num; i++)
f[i] = f[i >> 1] + (i & 1);
return f;
}

7. What does the 'zoho' method return when given the input 'n = 5'?
public int zoho(int n) {
if (n == 0)
return 0;
if (n == 1)

Page No : 3
Code : UEMS 2412

return 1;
int[] nums = new int[n + 1];
nums[0] = 0;
nums[1] = 1;
int ans = 1;
for (int i = 1; (2 * i + 1) <= n; i++) {
nums[2 * i] = nums[i];
nums[2 * i + 1] = nums[i] + nums[i + 1];
ans = Math.max(ans, nums[2 * i + 1]);
}
return ans;
}

8. What does this function return when provided A = [1,3,5,6,8] and target = 7?
class Solution {
public int zoho(int[] A, int target) {
int x = 0, y = A.length-1;
while(x <= y){
int z = (x+y)/2;
if(A[z] == target)
return z;
else if(A[z] > target)
y = z-1;
else
x = z+1;
}
return x;
}
}

9. What does the 'zoho' method return when given the input 'N = 5'?
public int zoho(int N) {
if (N <= 1)
return N;
HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
map.put(0, 0);
map.put(1, 1);
return help(N, map);

Page No : 4
Code : UEMS 2412

}
private int help(int N, HashMap<Integer, Integer> map) {
if (!map.containsKey(N)) {
int i = help(N - 1, map) + help(N - 2, map);
map.put(N, i);
}
return map.get(N);
}

10. What is the 'zoho' method's output with 's = "l|*e*et|c**o|*de|"'?


public int zoho(String s) {
int ans = 0, j = 0;
for (int i = 0; i < s.length(); ++i) {
if (s.charAt(i) == '*' && j % 2 == 0)
ans++;
if (s.charAt(i) == '|')
j++;
}
return ans;
}

Page No : 5
Code : UEMS 2412

Section B - Aptitude
10 questions | 35 minutes

1. A rectangular garden has a length that is 4 meters more than its width. If the area
of the garden is 140 square meters, what are the dimensions of the garden?

2. If you flip a fair coin 4 times, what is the probability of getting at least 3 heads?

3. There are three pipes, named A, B, and C, that can fill a tank together in 6 hours.
They start filling the tank together, but after 2 hours, pipe C is turned off. The
remaining two pipes, A and B, then take 7 more hours to fill the tank. How long
would it take for pipe C to fill the tank by itself?

4. A box contains 5 red balls, 3 green balls, and 2 blue balls. If one ball is drawn
randomly, what is the probability that it is not green?

5. A shopkeeper sold an item (A) at a 20% loss, which originally cost ₹4500. He then
used the money from this sale to buy another item (B), which he sold for a 30%
profit. What is the total profit or loss from both these transactions?

6. How long does a bus stop every hour if its speed is 54 km/h without stops, and 45
km/h with stops?

7. How many years younger is C compared to A, given that the combined age of A
and B is 12 years more than the combined age of B and C?

8. In a class, 25% of the students scored an A grade, 40% scored a B grade, and the
rest scored a C grade. If there are 60 students in the class, how many students
scored a C grade?

9. The sum of three consecutive even numbers is 96. What are these numbers?

10. What is the smaller number when two numbers with an initial ratio of 3:5 change
to a ratio of 12:23 after subtracting 9 from each?

Page No : 6

You might also like