You are on page 1of 10

Core Java Developer Assessment -

sample Test Taken on: February 24, 2017 11:29:32 AM IST


sample@mettl.com Finish State: Normal

Registration Details

Email sample@mettl.com First Name: sample


Address:
Last Name: 1

Date of birth: Feb 10, 1939 Experience: < 2 years

Performance Summary

Low Moderate High


Technical Skills
85

Hands on Experience
0
40 70 100

Values shown in above chart are percentages

Low Moderate High

Recommendation
Not Recommended
The candidate has excellent knowledge of basic concepts but lacks in hands on experience in programming skills. It is difficult
for him/her to apply basic technical concepts while solving assigned application level task at work.
Question-wise Details

i Note: Some sections/questions are hidden by your Administrator

Hands on Experience

Question 1:
Compilation: Failed Time: 16 Min 31 Sec Marks: 0 / 10
The Race

There is an F1 race going on and there is just one pit crew for a team. There are X racers. There is a position
matrix, which contains the current position of each of these X racers and the end point, till which point the fuel will
get over. Pit crew team can put their pit location to just one place. What is the maximum number of racers the pit
crew team can attend to?

Input:

input1: X, number of racers.

input2: Position matrix of X racers.

Output:

Return maximum number of racers that can be serviced, setting up just one pit crew.

Example 1:

Input: 4, {{1,3},{2,5},{2,4},{3,5}}

Output: 3
Example 2:

Input: 5, {{1,7},{2,4},{6,9},{3,8},{5,10}}

Output: 4

Explanation:

Example 1:

Example 2:

///
Compilation Time Taken Marks Scored Language

16 0
Minutes
Failed 31 Seconds Out of 10 JAVA8

1 import java.io.*; JAVA8


2 import java.util.*;
3
4 // Read only region start
5 class UserMainCode
6 {
7
8 public int maxRacers(int input1,int[][] input2){
9 // Read only region end
10 // Write code here...
11 throw new UnsupportedOperationException("maxRacers(int input1,int[][]
input2)");
12 System.out.print(input1-1);
13
14 }
15 }

Sample Test Case Timestamp Graded Test Case Timestamp

Graded Test Case Code compilation : 0 Successful 9 Attempts Code complexity : 0


Sample Test Case Code compilation : 0 Successful 9 Attempts

Console Output:

./UserMainCode.java:12: error: unreachable statement System.out.print(input1-1); ^ ./UserMainCode.java:14: error: missing


return statement } ^ 2 errors
Test Cases : None Specified

Question 2:
Compilation: Failed Time: 20 Min 48 Sec Marks: 0 / 10
The Game

Ryan and Sam have just started playing with palindrome numbers. On one boring day, they decide to play a game.
The game is simple. One person would say a random string of numbers or characters and the other person has to
correctly guess the biggest palindrome substring inside the given string.

Note: If there are two substrings of equal lengths, the substring appearing first in the main string will be the answer.

Now, Ryan being the intelligent one, was too quick to give the answer but Sam needs your help.

Input Specification

input1: A string.

Output Specification

Your function must return the biggest palindrome substring from the given string.

Example 1:

input1: ACGTGTCAAAATCG

Output: AAAA
Explanation:

The string has only one palindrome of max length 4. Hence, the answer is AAAA.

Example 2:

input1: 123434532455321

Output: 343

Explanation:

The string contains 2 palindromes of length 3 (343 and 434), but 343 appears first. Hence, it is the answer.

Compilation Time Taken Marks Scored Language

20 0
Minutes
Failed 48 Seconds Out of 10 JAVA8
1 import java.io.*; JAVA8
2 import java.util.*;
3
4 // Read only region start
5 class UserMainCode
6 {
7
8 public String game(String input1){
9 // Read only region end
10 // Write code here...
11 throw new UnsupportedOperationException("game(String input1)");
12 int n=strlen(input1);
13 bool table[n][n];
14 memset(table,0,sizeof(table));
15 int maxlen=1;
16 for(int i=0;i<n;++i)
17 table[i][i]=true;
18 int start=0;
19 for(int i=0;i<n-1;++i)
20 {
21 if(input1[i] == input1[i+1])
22 {
23 table[i][i+1]=true;
24 start = i;
25 maxlen = 2;
26 }
27 }
28 for(int k =3;k<=n;++k)
29 {
30 for(int i=0;i<n-k+1;++i)
31 {
32 int j=i+k-1;
33 if(table[i+1][j+1]&&input1[i] == input1[j])
34 {
35 table[i][j]=true;
36 if(k>maxlen)
37 {
38 start = i;
39 maxlen=k; }
40 }
41 }
42 }
43 }
0

Sample Test Case Timestamp Graded Test Case Timestamp

Graded Test Case Code compilation : 0 Successful 1 Attempts Code complexity : 0


Sample Test Case Code compilation : 0 Successful 1 Attempts

Console Output:

./UserMainCode.java:13: error: ']' expected bool table[n][n]; ^ ./UserMainCode.java:13: error: illegal start of expression bool
table[n][n]; ^ ./UserMainCode.java:13: error: ';' expected bool table[n][n]; ^ ./UserMainCode.java:13: error: not a statement
bool table[n][n]; ^ ./UserMainCode.java:13: error: ';' expected bool table[n][n]; ^ ./UserMainCode.java:43: error: reached end
of file while parsing } ^ ./UserMainCode.java:12: error: cannot find symbol int n=strlen(input1); ^ symbol: method
strlen(String) location: class UserMainCode ./UserMainCode.java:13: error: cannot find symbol bool table[n][n]; ^ symbol:
class bool location: class UserMainCode ./UserMainCode.java:21: error: array required, but String found if(input1[i] ==
input1[i+1]) ^ ./UserMainCode.java:21: error: array required, but String found if(input1[i] == input1[i+1]) ^
./UserMainCode.java:33: error: array required, but String found if(table[i+1][j+1]&&input1[i] == input1[j]) ^
./UserMainCode.java:33: error: array required, but String found if(table[i+1][j+1]&&input1[i] == input1[j]) ^ 12 errors

Test Cases : None Specified

Test Log

24 Feb,2017
10:35 am Started the test with Hands on Experience
11:13 am Went to Technical Skills of the test
11:29 am Finished the test

You might also like