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

Accolite Online Test and Interview Experience

Date of Visit : 11.08.2018 Criteria : 6.0 and above (No Current Arrear) ROUND 1 Duration : 1 hr This round composed of both written and online test Each one happened for 30 Minutes consecutively without any filtration. There is no negative grading. This is a MCQ type round. Both test covered OS Topics like Job Scheduling,Process,Dead lock detection and avoidance algorithm,semaphore,Output for C programs , Network Topics from sub net mask problems,TCP header information,Purpose of Time To Live (TTL), DBMS queries from natural join,left join,join, Age Problems,Data structure 1. Here are some words translated from an artificial language. migenlasan means cupboard lasanpoen means boardwalk cuopdansa means pullman Which word could mean "walkway"? A.    poenmigen B.    cuopeisel C.    lasandansa D.    poenforc 2. Consider three processes (process id 0, 1, 2 respectively) with compute time bursts 2, 4 and 8 time units. All processes arrive at time ze

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