Skip to main content

Sahaj - Online Test and Coding Round

Date of visit : 29/08/2018
Criteria        :  7.5 above

First Round

Duration : 40 minutes.

The first round was a online test that had 50 multiple choice questions. The questions were very standard and covered everything like java, C, C++, Python, CSS, DBMS, OOPs, Networks, OS etc.
After the first round 20 people were shortlisted for the second round.

Second round

Duration : 45 minutes 

The second round was a coding round where we were given only one question. The objective of the round was not only to check whether the logic and code was correct but whether the students have used paradigms of the programming language they chose. for example, if we choose java to write our code we must have used OOPs principles.

The question was to encode the given string in a format specified.

Input : this is a secret

procedure :

1. remove the spaces, s = thisisasecret
2. find the length of s, l  = 13
3. find w which is the ceil of sqrt of l, w = 4
4. separate s using w, s= this isas ecre t
5. encode the string by taking the first character of each word from as the first word of the new string and the second character of each word from s as the second word of the new string and so on..
encoded string = tiet hsc iar sse

Outputtiet hsc iar sse

Comments

  1. This comment has been removed by the author.

    ReplyDelete
  2. i have solution of this problem, can i post if you allow to me

    ReplyDelete
  3. language:python
    This is the solution
    n='this is a secret'
    res=''
    for i in n:
    if i!=' ':
    res+=i
    print(res)

    l=len(res)
    print(l)
    r=int((l**0.5)//1+1)
    print(r)
    ee=[]
    for i in res:
    if not res:
    break
    ee.append(res[0:4])
    res=res[4:]

    p=' '.join(ee)
    print(p)
    print(ee)
    w=[]
    for i in ee:
    ll=[ j for j in i]
    w.append(ll)
    for i in range(len(w)):
    for j in w:
    if j:
    print(j.pop(0),end='')
    print(end=' ')

    This solution contains implementation of OOP
    class StringManipulation:
    def __init__(self, input_string):
    self.input_string = input_string

    def remove_spaces(self):
    self.input_string = ''.join(self.input_string.split())

    def calculate_length(self):
    return len(self.input_string)

    def chunk_string(self):
    chunk_size = int((self.calculate_length() ** 0.5) // 1 + 1)
    chunks = [self.input_string[i:i + chunk_size] for i in range(0, len(self.input_string), chunk_size)]
    return chunks

    def display_chunks(self):
    chunks = self.chunk_string()
    for chunk in chunks:
    print(chunk, end=' ')

    def transform_to_matrix(self):
    chunks = self.chunk_string()
    matrix = [list(chunk) for chunk in chunks]
    return matrix

    def print_matrix_transpose(self):
    matrix = self.transform_to_matrix()
    for i in range(len(matrix[0])):
    for row in matrix:
    if row:
    print(row.pop(0), end='')
    print(end=' ')


    # Main code
    initial_string = 'this is a secret'
    string_manipulator = StringManipulation(initial_string)

    string_manipulator.remove_spaces()
    print(f"Processed String: {string_manipulator.input_string}")

    length = string_manipulator.calculate_length()
    print(f"Length of String: {length}")

    print("Chunks:")
    string_manipulator.display_chunks()
    print()

    print("Matrix:")
    matrix = string_manipulator.transform_to_matrix()
    for row in matrix:
    print(''.join(row), end=' ')

    print("\nTransposed Matrix:")
    string_manipulator.print_matrix_transpose()

    ReplyDelete

Post a Comment

Popular posts from this blog

Thorogood Associates - online test and Interview experience

Date of Visit : 18.08.2018 Criteria: CGPA 7.5 above, No current arrear First Round Duration: 1 hr This is an online round which had two parts,one is about essay writing,other one is about aptitude. Essay Writing Part had two questions,out of these 2 questions we have to write an essay on any one of the topic within 15 minutes. Question: What do you know about Thorogood and what will you do in your first year of Thorogood? Aptitude Part covered Data Interpretation,Logical Reasoning,Profit-Loss problem and other basics aptitude topics which are in R.S Agarwal Book ( link ) or else in IndiaBix ( link ) and this part lasted for next 45 minutes. Second Round Duration: 30 Minutes In this round,our communication,presentation skills and confidence level were tested. They asked us to explain any one of the projects that we mentioned in our resume. They checked whether we can present the project that we did in a professional way.

Ninjacart - coding round

Platform: Hackerrank     The challenge comprised of three questions which were based on arrays and strings .. It may seem easy but the problems were little tricky to solve.. If one is strong enuf in those concepts, then solving them becomes piece of cake😋. I listed two problems(I ve forgot the third one) asked below: Question 1: Buy stocks .. problem link Question 2: Find the number of smooth pairs problem link